Commit d9dddd9f by Gideon Greenspan

1.6-beta-2

parent 42a56c92
<HTML> <html>
<HEAD> <head>
<META HTTP-EQUIV="Refresh" CONTENT="2;URL=http://www.question2answer.org/versions.php"> <meta http-equiv="refresh" content="2;url=http://www.question2answer.org/versions.php">
</HEAD> </head>
<BODY> <body>
Redirecting... if nothing happens, <A HREF="http://www.question2answer.org/versions.php">click here</A>. Redirecting... if nothing happens, <a href="http://www.question2answer.org/versions.php">click here</a>.
</BODY> </body>
</HTML> </html>
\ No newline at end of file \ No newline at end of file
<HTML> <html>
<HEAD> <head>
<META HTTP-EQUIV="Refresh" CONTENT="2;URL=http://www.question2answer.org/license.php"> <meta http-equiv="refresh" content="2;url=http://www.question2answer.org/license.php">
</HEAD> </head>
<BODY> <body>
Redirecting... if nothing happens, <A HREF="http://www.question2answer.org/license.php">click here</A>. Redirecting... if nothing happens, <a href="http://www.question2answer.org/license.php">click here</a>.
</BODY> </body>
</HTML> </html>
\ No newline at end of file \ No newline at end of file
<HTML> <html>
<HEAD> <head>
<META HTTP-EQUIV="Refresh" CONTENT="2;URL=http://www.question2answer.org/install.php"> <meta http-equiv="refresh" content="2;url=http://www.question2answer.org/install.php">
</HEAD> </head>
<BODY> <body>
Redirecting... if nothing happens, <A HREF="http://www.question2answer.org/install.php">click here</A>. Redirecting... if nothing happens, <a href="http://www.question2answer.org/install.php">click here</a>.
</BODY> </body>
</HTML> </html>
\ No newline at end of file \ No newline at end of file
1.6-beta-1 1.6-beta-2
\ No newline at end of file \ No newline at end of file
...@@ -125,8 +125,8 @@ function qa_tags_to_html(tags, matchlc) ...@@ -125,8 +125,8 @@ function qa_tags_to_html(tags, matchlc)
if (matchlc) { // if matching, show appropriate part in bold if (matchlc) { // if matching, show appropriate part in bold
var matchstart=taglc.indexOf(matchlc); var matchstart=taglc.indexOf(matchlc);
var matchend=matchstart+matchlc.length; var matchend=matchstart+matchlc.length;
inner='<SPAN STYLE="font-weight:normal;">'+qa_html_escape(tag.substring(0, matchstart))+'<B>'+ inner='<span style="font-weight:normal;">'+qa_html_escape(tag.substring(0, matchstart))+'<b>'+
qa_html_escape(tag.substring(matchstart, matchend))+'</B>'+qa_html_escape(tag.substring(matchend))+'</SPAN>'; qa_html_escape(tag.substring(matchstart, matchend))+'</b>'+qa_html_escape(tag.substring(matchend))+'</span>';
} else // otherwise show as-is } else // otherwise show as-is
inner=qa_html_escape(tag); inner=qa_html_escape(tag);
......
...@@ -42,7 +42,7 @@ function qa_set_inner_html(elem, type, html) ...@@ -42,7 +42,7 @@ function qa_set_inner_html(elem, type, html)
function qa_set_outer_html(elem, type, html) function qa_set_outer_html(elem, type, html)
{ {
if (elem) { if (elem) {
var e=document.createElement('DIV'); var e=document.createElement('div');
e.innerHTML=html; e.innerHTML=html;
elem.parentNode.replaceChild(e.firstChild, elem); elem.parentNode.replaceChild(e.firstChild, elem);
} }
......
...@@ -90,7 +90,7 @@ function qa_submit_answer(questionid, elem) ...@@ -90,7 +90,7 @@ function qa_submit_answer(questionid, elem)
qa_set_inner_html(t, 'a_list_title', lines[2]); qa_set_inner_html(t, 'a_list_title', lines[2]);
qa_reveal(t, 'a_list_title'); qa_reveal(t, 'a_list_title');
var e=document.createElement('DIV'); var e=document.createElement('div');
e.innerHTML=lines.slice(3).join("\n"); e.innerHTML=lines.slice(3).join("\n");
var c=e.firstChild; var c=e.firstChild;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
File: qa-content/qa-user.js File: qa-content/qa-user.js
Version: See define()s at top of qa-include/qa-base.php Version: See define()s at top of qa-include/qa-base.php
Description: Javascript to handle question page actions Description: Javascript to handle user page actions
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
More about this license: http://www.question2answer.org/license.php More about this license: http://www.question2answer.org/license.php
*/ */
/* /*
========================================================================= =========================================================================
THIS FILE ALLOWS YOU TO INTEGRATE WITH AN EXISTING USER MANAGEMENT SYSTEM THIS FILE ALLOWS YOU TO INTEGRATE WITH AN EXISTING USER MANAGEMENT SYSTEM
...@@ -475,8 +476,8 @@ ...@@ -475,8 +476,8 @@
$publicusername=$logged_in_user['publicusername']; $publicusername=$logged_in_user['publicusername'];
return '<A HREF="'.htmlspecialchars($relative_url_prefix.'user/'.urlencode($publicusername)). return '<a href="'.htmlspecialchars($relative_url_prefix.'user/'.urlencode($publicusername)).
'" CLASS="qa-user-link">'.htmlspecialchars($publicusername).'</A>'; '" class="qa-user-link">'.htmlspecialchars($publicusername).'</a>';
/* /*
Example 1 - suitable if: Example 1 - suitable if:
...@@ -486,8 +487,8 @@ ...@@ -486,8 +487,8 @@
$publicusername=$logged_in_user['publicusername']; $publicusername=$logged_in_user['publicusername'];
return '<A HREF="'.htmlspecialchars($relative_url_prefix.'../user/'.urlencode($publicusername)). return '<a href="'.htmlspecialchars($relative_url_prefix.'../user/'.urlencode($publicusername)).
'" CLASS="qa-user-link">'.htmlspecialchars($publicusername).'</A>'; '" class="qa-user-link">'.htmlspecialchars($publicusername).'</a>';
*/ */
/* /*
...@@ -499,9 +500,9 @@ ...@@ -499,9 +500,9 @@
$publicusername=$logged_in_user['publicusername']; $publicusername=$logged_in_user['publicusername'];
return '<A HREF="http://www.mysite.com/'.htmlspecialchars(urlencode($publicusername)).'/" CLASS="qa-user-link">'. return '<a href="http://www.mysite.com/'.htmlspecialchars(urlencode($publicusername)).'/" class="qa-user-link">'.
'<IMG SRC="http://www.mysite.com/'.htmlspecialchars(urlencode($publicusername)).'/photo-small.jpeg" '. '<img src="http://www.mysite.com/'.htmlspecialchars(urlencode($publicusername)).'/photo-small.jpeg" '.
'STYLE="width:16px; height:16px; border:none; margin-right:4px;">'.htmlspecialchars($publicusername).'</A>'; 'style="width:16px; height:16px; border:none; margin-right:4px;">'.htmlspecialchars($publicusername).'</a>';
*/ */
} }
...@@ -546,8 +547,8 @@ ...@@ -546,8 +547,8 @@
$usershtml[$userid]=htmlspecialchars($publicusername); $usershtml[$userid]=htmlspecialchars($publicusername);
if ($should_include_link) if ($should_include_link)
$usershtml[$userid]='<A HREF="'.htmlspecialchars($relative_url_prefix.'user/'.urlencode($publicusername)). $usershtml[$userid]='<a href="'.htmlspecialchars($relative_url_prefix.'user/'.urlencode($publicusername)).
'" CLASS="qa-user-link">'.$usershtml[$userid].'</A>'; '" class="qa-user-link">'.$usershtml[$userid].'</a>';
} }
return $usershtml; return $usershtml;
...@@ -566,8 +567,8 @@ ...@@ -566,8 +567,8 @@
$usershtml[$userid]=htmlspecialchars($publicusername); $usershtml[$userid]=htmlspecialchars($publicusername);
if ($should_include_link) if ($should_include_link)
$usershtml[$userid]='<A HREF="'.htmlspecialchars($relative_url_prefix.'../user/'.urlencode($publicusername)). $usershtml[$userid]='<a href="'.htmlspecialchars($relative_url_prefix.'../user/'.urlencode($publicusername)).
'" CLASS="qa-user-link">'.$usershtml[$userid].'</A>'; '" class="qa-user-link">'.$usershtml[$userid].'</a>';
} }
return $usershtml; return $usershtml;
...@@ -585,12 +586,12 @@ ...@@ -585,12 +586,12 @@
foreach ($userids as $userid) { foreach ($userids as $userid) {
$publicusername=$useridtopublic[$userid]; $publicusername=$useridtopublic[$userid];
$usershtml[$userid]='<IMG SRC="http://www.mysite.com/'.htmlspecialchars(urlencode($publicusername)).'/photo-small.jpeg" '. $usershtml[$userid]='<img src="http://www.mysite.com/'.htmlspecialchars(urlencode($publicusername)).'/photo-small.jpeg" '.
'STYLE="width:16px; height:16px; border:0; margin-right:4px;">'.htmlspecialchars($publicusername); 'style="width:16px; height:16px; border:0; margin-right:4px;">'.htmlspecialchars($publicusername);
if ($should_include_link) if ($should_include_link)
$usershtml[$userid]='<A HREF="http://www.mysite.com/'.htmlspecialchars(urlencode($publicusername)). $usershtml[$userid]='<a href="http://www.mysite.com/'.htmlspecialchars(urlencode($publicusername)).
'/" CLASS="qa-user-link">'.$usershtml[$userid].'</A>'; '/" class="qa-user-link">'.$usershtml[$userid].'</a>';
} }
return $usershtml; return $usershtml;
...@@ -635,8 +636,8 @@ ...@@ -635,8 +636,8 @@
$htmlsize=(int)$size; $htmlsize=(int)$size;
return '<IMG SRC="http://www.mysite.com/avatar/'.htmlspecialchars($userid).'-'.$htmlsize.'x'.$htmlsize.'.jpg" '. return '<img src="http://www.mysite.com/avatar/'.htmlspecialchars($userid).'-'.$htmlsize.'x'.$htmlsize.'.jpg" '.
'WIDTH="'.$htmlsize.'" HEIGHT="'.$htmlsize.'" CLASS="qa-avatar-image" ALT=""/>'; 'width="'.$htmlsize.'" height="'.$htmlsize.'" class="qa-avatar-image" alt=""/>';
*/ */
} }
......
...@@ -96,10 +96,10 @@ ...@@ -96,10 +96,10 @@
break; break;
if (!$count) if (!$count)
echo qa_lang_html('question/ask_same_q').'<BR/>'; echo qa_lang_html('question/ask_same_q').'<br/>';
echo strtr( echo strtr(
'<A HREF="'.qa_q_path_html($question['postid'], $question['title']).'" TARGET="_blank">'.qa_html($question['title']).'</A><BR/>', '<a href="'.qa_q_path_html($question['postid'], $question['title']).'" target="_blank">'.qa_html($question['title']).'</a><br/>',
"\r\n", ' ' "\r\n", ' '
)."\n"; )."\n";
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
$response=qa_lang_html_sub('admin/version_get_x', qa_html('v'.$metadata['version'])); $response=qa_lang_html_sub('admin/version_get_x', qa_html('v'.$metadata['version']));
if (strlen(@$metadata['uri'])) if (strlen(@$metadata['uri']))
$response='<A HREF="'.qa_html($metadata['uri']).'" STYLE="color:#d00;">'.$response.'</A>'; $response='<a href="'.qa_html($metadata['uri']).'" style="color:#d00;">'.$response.'</a>';
} }
} else } else
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
$touseraccount=qa_db_select_with_pending(qa_db_user_account_selectspec($tohandle, false)); $touseraccount=qa_db_select_with_pending(qa_db_user_account_selectspec($tohandle, false));
$loginuserid=qa_get_logged_in_userid(); $loginuserid=qa_get_logged_in_userid();
$errorhtml=qa_wall_error_html($loginuserid, $touseraccount); $errorhtml=qa_wall_error_html($loginuserid, $touseraccount['userid'], $touseraccount['flags']);
if ($errorhtml || (!strlen($message)) || !qa_check_form_security_code('wall-'.$tohandle, qa_post_text('code')) ) if ($errorhtml || (!strlen($message)) || !qa_check_form_security_code('wall-'.$tohandle, qa_post_text('code')) )
echo "QA_AJAX_RESPONSE\n0"; // if there's an error, process in non-Ajax way echo "QA_AJAX_RESPONSE\n0"; // if there's an error, process in non-Ajax way
...@@ -44,8 +44,9 @@ ...@@ -44,8 +44,9 @@
else { else {
$messageid=qa_wall_add_post($loginuserid, qa_get_logged_in_handle(), qa_cookie_get(), $messageid=qa_wall_add_post($loginuserid, qa_get_logged_in_handle(), qa_cookie_get(),
$touseraccount['userid'], $touseraccount['handle'], $message, ''); $touseraccount['userid'], $touseraccount['handle'], $message, '');
$touseraccount['wallposts']++; // won't have been updated
$usermessages=qa_db_select_with_pending(qa_db_recent_messages_selectspec(null, null, $touseraccount['userid'], true)); $usermessages=qa_db_select_with_pending(qa_db_recent_messages_selectspec(null, null, $touseraccount['userid'], true, qa_opt('page_size_wall')));
$usermessages=qa_wall_posts_add_rules($usermessages, $loginuserid); $usermessages=qa_wall_posts_add_rules($usermessages, $loginuserid);
$themeclass=qa_load_theme_class(qa_get_site_theme(), 'wall', null, null); $themeclass=qa_load_theme_class(qa_get_site_theme(), 'wall', null, null);
...@@ -55,7 +56,10 @@ ...@@ -55,7 +56,10 @@
echo 'm'.$messageid."\n"; // element in list to be revealed echo 'm'.$messageid."\n"; // element in list to be revealed
foreach ($usermessages as $message) foreach ($usermessages as $message)
$themeclass->message_item(qa_wall_post_view($message, $loginuserid)); $themeclass->message_item(qa_wall_post_view($message));
if ($touseraccount['wallposts']>count($usermessages))
$themeclass->message_item(qa_wall_view_more_link($tohandle, count($usermessages)));
} }
......
...@@ -401,8 +401,8 @@ ...@@ -401,8 +401,8 @@
qa_lang_html('admin/upgrade_db'), qa_lang_html('admin/upgrade_db'),
array( array(
'^1' => '<A HREF="'.qa_path_html('install').'">', '^1' => '<a href="'.qa_path_html('install').'">',
'^2' => '</A>', '^2' => '</a>',
) )
); );
...@@ -462,8 +462,8 @@ ...@@ -462,8 +462,8 @@
function qa_admin_single_click($entityid, $action) function qa_admin_single_click($entityid, $action)
/* /*
Returns true if admin (hidden/flagged/approve) page $action performed on $entityid is permitted by the current user Returns true if admin (hidden/flagged/approve/moderate) page $action performed on $entityid is permitted by the
and was processed successfully logged in user and was processed successfully
*/ */
{ {
$userid=qa_get_logged_in_userid(); $userid=qa_get_logged_in_userid();
...@@ -552,7 +552,7 @@ ...@@ -552,7 +552,7 @@
function qa_admin_check_clicks() function qa_admin_check_clicks()
/* /*
Checks for a POSTed click on an admin (hidden/flagged/approve) page, and refresh the page if processed successfully (non Ajax) Checks for a POSTed click on an admin (hidden/flagged/approve/moderate) page, and refresh the page if processed successfully (non Ajax)
*/ */
{ {
if (qa_is_http_post()) if (qa_is_http_post())
...@@ -588,12 +588,18 @@ ...@@ -588,12 +588,18 @@
function qa_admin_plugin_directory_hash($directory) function qa_admin_plugin_directory_hash($directory)
/*
Return the hash code for the plugin in $directory, used for in-page navigation on admin/plugins page
*/
{ {
return md5($directory); return md5($directory);
} }
function qa_admin_plugin_options_path($directory) function qa_admin_plugin_options_path($directory)
/*
Return the URL (relative to the current page) to navigate to the options panel for the plugin in $directory
*/
{ {
$hash=qa_admin_plugin_directory_hash($directory); $hash=qa_admin_plugin_directory_hash($directory);
return qa_path_html('admin/plugins', array('show' => $hash), null, null, $hash); return qa_path_html('admin/plugins', array('show' => $hash), null, null, $hash);
...@@ -601,6 +607,9 @@ ...@@ -601,6 +607,9 @@
function qa_admin_module_options_path($type, $name) function qa_admin_module_options_path($type, $name)
/*
Return the URL (relative to the current page) to navigate to the options panel for plugin module $name of $type
*/
{ {
$info=qa_get_module_info($type, $name); $info=qa_get_module_info($type, $name);
return qa_admin_plugin_options_path($info['directory']); return qa_admin_plugin_options_path($info['directory']);
......
...@@ -42,6 +42,9 @@ ...@@ -42,6 +42,9 @@
function qa_get_blob_directory($blobid) function qa_get_blob_directory($blobid)
/*
Return the full path to the on-disk directory for blob $blobid (subdirectories are named by the first 3 digits of $blobid)
*/
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -50,6 +53,9 @@ ...@@ -50,6 +53,9 @@
function qa_get_blob_filename($blobid, $format) function qa_get_blob_filename($blobid, $format)
/*
Return the full page and filename of blob $blobid which is in $format ($format is used as the file name suffix e.g. .jpg)
*/
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -58,6 +64,10 @@ ...@@ -58,6 +64,10 @@
function qa_create_blob($content, $format, $sourcefilename=null, $userid=null, $cookieid=null, $ip=null) function qa_create_blob($content, $format, $sourcefilename=null, $userid=null, $cookieid=null, $ip=null)
/*
Create a new blob (storing the content in the database or on disk as appropriate) with $content and $format, returning its blobid.
Pass the original name of the file uploaded in $sourcefilename and the $userid, $cookieid and $ip of the user creating it
*/
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -65,15 +75,18 @@ ...@@ -65,15 +75,18 @@
$blobid=qa_db_blob_create(defined('QA_BLOBS_DIRECTORY') ? null : $content, $format, $sourcefilename, $userid, $cookieid, $ip); $blobid=qa_db_blob_create(defined('QA_BLOBS_DIRECTORY') ? null : $content, $format, $sourcefilename, $userid, $cookieid, $ip);
if (defined('QA_BLOBS_DIRECTORY')) if (isset($blobid) && defined('QA_BLOBS_DIRECTORY'))
if (!qa_write_blob_file($blobid, $content, $format)) if (!qa_write_blob_file($blobid, $content, $format))
qa_db_blob_set_content($blobid, $content); // still write to database if writing to disk failed qa_db_blob_set_content($blobid, $content); // still write content to the database if writing to disk failed
return $blobid; return $blobid;
} }
function qa_write_blob_file($blobid, $content, $format) function qa_write_blob_file($blobid, $content, $format)
/*
Write the on-disk file for blob $blobid with $content and $format. Returns true if the write succeeded, false otherwise.
*/
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -100,6 +113,9 @@ ...@@ -100,6 +113,9 @@
function qa_read_blob($blobid) function qa_read_blob($blobid)
/*
Retrieve blob $blobid from the database, reading the content from disk if appropriate
*/
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -115,6 +131,9 @@ ...@@ -115,6 +131,9 @@
function qa_read_blob_file($blobid, $format) function qa_read_blob_file($blobid, $format)
/*
Read the content of blob $blobid in $format from disk. On failure, it will return false.
*/
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -123,6 +142,9 @@ ...@@ -123,6 +142,9 @@
function qa_delete_blob($blobid) function qa_delete_blob($blobid)
/*
Delete blob $blobid from the database, and remove the on-disk file if appropriate
*/
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -140,6 +162,9 @@ ...@@ -140,6 +162,9 @@
function qa_delete_blob_file($blobid, $format) function qa_delete_blob_file($blobid, $format)
/*
Delete the on-disk file for blob $blobid in $format
*/
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -147,6 +172,19 @@ ...@@ -147,6 +172,19 @@
} }
function qa_blob_exists($blobid)
/*
Check if blob $blobid exists
*/
{
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
require_once QA_INCLUDE_DIR.'qa-db-blobs.php';
return qa_db_blob_exists($blobid);
}
/* /*
Omit PHP closing tag to help avoid accidental output Omit PHP closing tag to help avoid accidental output
*/ */
\ No newline at end of file
...@@ -42,6 +42,9 @@ ...@@ -42,6 +42,9 @@
function qa_captcha_reason_note($captchareason) function qa_captcha_reason_note($captchareason)
/*
Return an HTML string explaining $captchareason (from qa_user_captcha_reason()) to the user about why they are seeing a captcha
*/
{ {
$notehtml=null; $notehtml=null;
...@@ -83,7 +86,7 @@ ...@@ -83,7 +86,7 @@
$fields['captcha']=array( $fields['captcha']=array(
'type' => 'custom', 'type' => 'custom',
'label' => qa_lang_html('misc/captcha_label'), 'label' => qa_lang_html('misc/captcha_label'),
'html' => '<DIV ID="qa_captcha_div_'.$count.'">'.$html.'</DIV>', 'html' => '<div id="qa_captcha_div_'.$count.'">'.$html.'</div>',
'error' => @array_key_exists('captcha', $errors) ? qa_lang_html('misc/captcha_error') : null, 'error' => @array_key_exists('captcha', $errors) ? qa_lang_html('misc/captcha_error') : null,
'note' => $note, 'note' => $note,
); );
......
...@@ -38,10 +38,15 @@ ...@@ -38,10 +38,15 @@
define('QA_LIMIT_LOGINS', 'L'); define('QA_LIMIT_LOGINS', 'L');
define('QA_LIMIT_UPLOADS', 'U'); define('QA_LIMIT_UPLOADS', 'U');
define('QA_LIMIT_FLAGS', 'F'); define('QA_LIMIT_FLAGS', 'F');
define('QA_LIMIT_MESSAGES', 'M'); define('QA_LIMIT_MESSAGES', 'M'); // i.e. private messages
define('QA_LIMIT_WALL_POSTS', 'W');
function qa_user_limits_remaining($action) function qa_user_limits_remaining($action)
/*
Return how many more times the logged in user (and requesting IP address) can perform $action this hour,
where $action is one of the QA_LIMIT_* constants defined above.
*/
{ {
$userlimits=qa_db_get_pending_result('userlimits', qa_db_user_limits_selectspec(qa_get_logged_in_userid())); $userlimits=qa_db_get_pending_result('userlimits', qa_db_user_limits_selectspec(qa_get_logged_in_userid()));
$iplimits=qa_db_get_pending_result('iplimits', qa_db_ip_limits_selectspec(qa_remote_ip_address())); $iplimits=qa_db_get_pending_result('iplimits', qa_db_ip_limits_selectspec(qa_remote_ip_address()));
...@@ -52,8 +57,8 @@ ...@@ -52,8 +57,8 @@
function qa_limits_remaining($userid, $action) function qa_limits_remaining($userid, $action)
/* /*
Return how many more times user $userid and/or the requesting IP can perform $action this hour, Return how many more times user $userid and/or the requesting IP can perform $action this hour, where $action is one
where $action is one of the QA_LIMIT_* constants defined above. of the QA_LIMIT_* constants above. This function is no longer used and only included for backwards compatibility.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -67,6 +72,9 @@ ...@@ -67,6 +72,9 @@
function qa_limits_calc_remaining($action, $userlimits, $iplimits) function qa_limits_calc_remaining($action, $userlimits, $iplimits)
/*
Calculate how many more times $action can be performed this hour, based on $userlimits and $iplimits retrieved from the database
*/
{ {
switch ($action) { switch ($action) {
case QA_LIMIT_QUESTIONS: case QA_LIMIT_QUESTIONS:
...@@ -110,12 +118,13 @@ ...@@ -110,12 +118,13 @@
break; break;
case QA_LIMIT_MESSAGES: case QA_LIMIT_MESSAGES:
case QA_LIMIT_WALL_POSTS:
$usermax=qa_opt('max_rate_user_messages'); $usermax=qa_opt('max_rate_user_messages');
$ipmax=qa_opt('max_rate_ip_messages'); $ipmax=qa_opt('max_rate_ip_messages');
break; break;
default: default:
qa_fatal_error('Unknown limit code in qa_limits_remaining: '.$action); qa_fatal_error('Unknown limit code in qa_limits_calc_remaining: '.$action);
break; break;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
File: qa-include/qa-app-messages.php File: qa-include/qa-app-messages.php
Version: See define()s at top of qa-include/qa-base.php Version: See define()s at top of qa-include/qa-base.php
Description: Handling public/private messages Description: Handling private or public messages (wall posts)
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
...@@ -30,18 +30,22 @@ ...@@ -30,18 +30,22 @@
} }
function qa_wall_error_html($fromuserid, $touseraccount) function qa_wall_error_html($fromuserid, $touserid, $touserflags)
/*
Returns an HTML string describing the reason why user $fromuserid cannot post on the wall of $touserid who has
user flags $touserflags. If there is no such reason the function returns false.
*/
{ {
require_once QA_INCLUDE_DIR.'qa-app-limits.php'; require_once QA_INCLUDE_DIR.'qa-app-limits.php';
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
if ((!QA_FINAL_EXTERNAL_USERS) && qa_opt('allow_user_walls')) { if ((!QA_FINAL_EXTERNAL_USERS) && qa_opt('allow_user_walls')) {
if ( ($touseraccount['flags'] & QA_USER_FLAGS_NO_WALL_POSTS) && !(isset($fromuserid) && ($fromuserid==$touseraccount['userid'])) ) if ( ($touserflags & QA_USER_FLAGS_NO_WALL_POSTS) && !(isset($fromuserid) && ($fromuserid==$touserid)) )
return qa_lang_html('profile/post_wall_blocked'); return qa_lang_html('profile/post_wall_blocked');
else else
switch (qa_user_permit_error('permit_post_wall', QA_LIMIT_MESSAGES)) { switch (qa_user_permit_error('permit_post_wall', QA_LIMIT_WALL_POSTS)) {
case 'limit': case 'limit':
return qa_lang_html('profile/post_wall_limit'); return qa_lang_html('profile/post_wall_limit');
break; break;
...@@ -69,6 +73,10 @@ ...@@ -69,6 +73,10 @@
function qa_wall_add_post($userid, $handle, $cookieid, $touserid, $tohandle, $content, $format) function qa_wall_add_post($userid, $handle, $cookieid, $touserid, $tohandle, $content, $format)
/*
Adds a post to the wall of user $touserid with handle $tohandle, containing $content in $format (e.g. '' for text or 'html')
The post is by user $userid with handle $handle, and $cookieid is the user's current cookie (used for reporting the event).
*/
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -76,6 +84,7 @@ ...@@ -76,6 +84,7 @@
require_once QA_INCLUDE_DIR.'qa-db-messages.php'; require_once QA_INCLUDE_DIR.'qa-db-messages.php';
$messageid=qa_db_message_create($userid, $touserid, $content, $format, true); $messageid=qa_db_message_create($userid, $touserid, $content, $format, true);
qa_db_user_recount_posts($touserid);
qa_report_event('u_wall_post', $userid, $handle, $cookieid, array( qa_report_event('u_wall_post', $userid, $handle, $cookieid, array(
'userid' => $touserid, 'userid' => $touserid,
...@@ -91,10 +100,15 @@ ...@@ -91,10 +100,15 @@
function qa_wall_delete_post($userid, $handle, $cookieid, $message) function qa_wall_delete_post($userid, $handle, $cookieid, $message)
/*
Deletes the wall post described in $message (as obtained via qa_db_recent_messages_selectspec()). The deletion was performed
by user $userid with handle $handle, and $cookieid is the user's current cookie (all used for reporting the event).
*/
{ {
require_once QA_INCLUDE_DIR.'qa-db-messages.php'; require_once QA_INCLUDE_DIR.'qa-db-messages.php';
qa_db_message_delete($message['messageid']); qa_db_message_delete($message['messageid']);
qa_db_user_recount_posts($message['touserid']);
qa_report_event('u_wall_delete', $userid, $handle, $cookieid, array( qa_report_event('u_wall_delete', $userid, $handle, $cookieid, array(
'messageid' => $message['messageid'], 'messageid' => $message['messageid'],
...@@ -104,6 +118,10 @@ ...@@ -104,6 +118,10 @@
function qa_wall_posts_add_rules($usermessages, $userid) function qa_wall_posts_add_rules($usermessages, $userid)
/*
Return the list of messages in $usermessages (as obtained via qa_db_recent_messages_selectspec()) with additional fields
indicating what actions can be performed on them by user $userid. Currently only 'deleteable' is relevant.
*/
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -120,21 +138,25 @@ ...@@ -120,21 +138,25 @@
} }
function qa_wall_post_view($message, $userid) function qa_wall_post_view($message)
/*
Returns an element to add to $qa_content['message_list']['messages'] for $message (as obtained via qa_db_recent_messages_selectspec()
and then qa_wall_posts_add_rules()) where $userid is the identity of the user currently viewing the message.
*/
{ {
require_once QA_INCLUDE_DIR.'qa-app-format.php'; require_once QA_INCLUDE_DIR.'qa-app-format.php';
$options=qa_message_html_defaults(); $options=qa_message_html_defaults();
$htmlfields=qa_message_html_fields($message, $userid, $options); $htmlfields=qa_message_html_fields($message, $options);
if ($message['deleteable']) if (@$message['deleteable'])
$htmlfields['form']=array( $htmlfields['form']=array(
'style' => 'light', 'style' => 'light',
'buttons' => array( 'buttons' => array(
'delete' => array( 'delete' => array(
'tags' => 'NAME="m'.qa_html($message['messageid']).'_dodelete" onClick="return qa_wall_post_click('.qa_js($message['messageid']).', this);"', 'tags' => 'name="m'.qa_html($message['messageid']).'_dodelete" onclick="return qa_wall_post_click('.qa_js($message['messageid']).', this);"',
'label' => qa_lang_html('question/delete_button'), 'label' => qa_lang_html('question/delete_button'),
'popup' => qa_lang_html('profile/delete_wall_post_popup'), 'popup' => qa_lang_html('profile/delete_wall_post_popup'),
), ),
...@@ -145,6 +167,17 @@ ...@@ -145,6 +167,17 @@
} }
function qa_wall_view_more_link($handle, $start)
/*
Returns an element to add to $qa_content['message_list']['messages'] with a link to view all wall posts
*/
{
return array(
'content' => '<a href="'.qa_path_html('user/'.$handle.'/wall', array('start' => $start)).'">'.qa_lang_html('profile/wall_view_more').'</a>',
);
}
/* /*
Omit PHP closing tag to help avoid accidental output Omit PHP closing tag to help avoid accidental output
*/ */
\ No newline at end of file
...@@ -309,6 +309,7 @@ ...@@ -309,6 +309,7 @@
'page_size_tags' => 30, 'page_size_tags' => 30,
'page_size_una_qs' => 20, 'page_size_una_qs' => 20,
'page_size_users' => 20, 'page_size_users' => 20,
'page_size_wall' => 10,
'pages_prev_next' => 3, 'pages_prev_next' => 3,
'permit_anon_view_ips' => QA_PERMIT_EDITORS, 'permit_anon_view_ips' => QA_PERMIT_EDITORS,
'permit_close_q' => QA_PERMIT_EDITORS, 'permit_close_q' => QA_PERMIT_EDITORS,
...@@ -525,7 +526,8 @@ ...@@ -525,7 +526,8 @@
function qa_post_html_defaults($basetype, $full=false) function qa_post_html_defaults($basetype, $full=false)
/* /*
Return an array of defaults for the $options parameter passed to qa_post_html_fields() and its ilk Return an array of defaults for the $options parameter passed to qa_post_html_fields() and its ilk for posts of $basetype='Q'/'A'/'C'
Set $full to true if these posts will be viewed in full, i.e. on a question page rather than a question listing
*/ */
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -560,6 +562,11 @@ ...@@ -560,6 +562,11 @@
function qa_post_html_options($post, $defaults=null, $full=false) function qa_post_html_options($post, $defaults=null, $full=false)
/*
Return an array of options for post $post to pass in the $options parameter to qa_post_html_fields() and its ilk. Preferably,
call qa_post_html_defaults() previously and pass its output in $defaults, to save excessive recalculation for each item in a
list. Set $full to true if these posts will be viewed in full, i.e. on a question page rather than a question listing.
*/
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -574,6 +581,9 @@ ...@@ -574,6 +581,9 @@
function qa_message_html_defaults() function qa_message_html_defaults()
/*
Return an array of defaults for the $options parameter passed to qa_message_html_fields()
*/
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
......
...@@ -97,6 +97,9 @@ ...@@ -97,6 +97,9 @@
function qa_update_counts_for_q($postid) function qa_update_counts_for_q($postid)
/*
Perform various common cached count updating operations to reflect changes in the question whose id is $postid
*/
{ {
if (isset($postid)) // post might no longer exist if (isset($postid)) // post might no longer exist
qa_db_category_path_qcount_update(qa_db_post_get_category_path($postid)); qa_db_category_path_qcount_update(qa_db_post_get_category_path($postid));
...@@ -196,6 +199,9 @@ ...@@ -196,6 +199,9 @@
function qa_update_q_counts_for_a($questionid) function qa_update_q_counts_for_a($questionid)
/*
Perform various common cached count updating operations to reflect changes in an answer of question $questionid
*/
{ {
qa_db_post_acount_update($questionid); qa_db_post_acount_update($questionid);
qa_db_hotness_update($questionid); qa_db_hotness_update($questionid);
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
require_once QA_INCLUDE_DIR.'qa-util-string.php'; require_once QA_INCLUDE_DIR.'qa-util-string.php';
function qa_post_create($type, $parentid, $title, $content, $format='', $categoryid=null, $tags=null, $userid=null, $notify=null, $email=null, $extravalue=null) function qa_post_create($type, $parentid, $title, $content, $format='', $categoryid=null, $tags=null, $userid=null, $notify=null, $email=null, $extravalue=null, $name=null)
/* /*
Create a new post in the database, and return its postid. Create a new post in the database, and return its postid.
...@@ -50,9 +50,10 @@ ...@@ -50,9 +50,10 @@
should be in UTF-8 HTML. Other values of $format may be allowed if an appropriate viewer module is installed. The should be in UTF-8 HTML. Other values of $format may be allowed if an appropriate viewer module is installed. The
$title, $categoryid and $tags parameters are only relevant when creating a question - $tags can either be an array $title, $categoryid and $tags parameters are only relevant when creating a question - $tags can either be an array
of tags, or a string of tags separated by commas. The new post will be assigned to $userid if it is not null, of tags, or a string of tags separated by commas. The new post will be assigned to $userid if it is not null,
otherwise it will be anonymous. If $notify is true then the author will be sent notifications relating to the post - otherwise it will be by a non-user. If $notify is true then the author will be sent notifications relating to the
either to $email if it is specified and valid, or to the current email address of $userid if $email is '@'. If post - either to $email if it is specified and valid, or to the current email address of $userid if $email is '@'.
you're creating a question, the $extravalue parameter will be set as the custom extra field, if not null. If you're creating a question, the $extravalue parameter will be set as the custom extra field, if not null. For all
post types you can specify the $name of the post's author, which is relevant if the $userid is null.
*/ */
{ {
$handle=qa_post_userid_to_handle($userid); $handle=qa_post_userid_to_handle($userid);
...@@ -64,13 +65,13 @@ ...@@ -64,13 +65,13 @@
$followanswer=isset($parentid) ? qa_post_get_full($parentid, 'A') : null; $followanswer=isset($parentid) ? qa_post_get_full($parentid, 'A') : null;
$tagstring=qa_post_tags_to_tagstring($tags); $tagstring=qa_post_tags_to_tagstring($tags);
$postid=qa_question_create($followanswer, $userid, $handle, null, $title, $content, $format, $text, $tagstring, $postid=qa_question_create($followanswer, $userid, $handle, null, $title, $content, $format, $text, $tagstring,
$notify, $email, $categoryid, $extravalue, $type=='Q_QUEUED'); $notify, $email, $categoryid, $extravalue, $type=='Q_QUEUED', $name);
break; break;
case 'A': case 'A':
case 'A_QUEUED': case 'A_QUEUED':
$question=qa_post_get_full($parentid, 'Q'); $question=qa_post_get_full($parentid, 'Q');
$postid=qa_answer_create($userid, $handle, null, $content, $format, $text, $notify, $email, $question, $type=='A_QUEUED'); $postid=qa_answer_create($userid, $handle, null, $content, $format, $text, $notify, $email, $question, $type=='A_QUEUED', $name);
break; break;
case 'C': case 'C':
...@@ -78,7 +79,7 @@ ...@@ -78,7 +79,7 @@
$parent=qa_post_get_full($parentid, 'QA'); $parent=qa_post_get_full($parentid, 'QA');
$commentsfollows=qa_db_single_select(qa_db_full_child_posts_selectspec(null, $parentid)); $commentsfollows=qa_db_single_select(qa_db_full_child_posts_selectspec(null, $parentid));
$question=qa_post_parent_to_question($parent); $question=qa_post_parent_to_question($parent);
$postid=qa_comment_create($userid, $handle, null, $content, $format, $text, $notify, $email, $question, $parent, $commentsfollows, $type=='C_QUEUED'); $postid=qa_comment_create($userid, $handle, null, $content, $format, $text, $notify, $email, $question, $parent, $commentsfollows, $type=='C_QUEUED', $name);
break; break;
default: default:
...@@ -90,11 +91,11 @@ ...@@ -90,11 +91,11 @@
} }
function qa_post_set_content($postid, $title, $content, $format=null, $tags=null, $notify=null, $email=null, $byuserid=null, $extravalue=null) function qa_post_set_content($postid, $title, $content, $format=null, $tags=null, $notify=null, $email=null, $byuserid=null, $extravalue=null, $name=null)
/* /*
Change the data stored for post $postid based on any of the $title, $content, $format, $tags, $notify, $email Change the data stored for post $postid based on any of the $title, $content, $format, $tags, $notify, $email,
and $extravalue parameters passed which are not null. The meaning of these parameters is the same as for $extravalue and $name parameters passed which are not null. The meaning of these parameters is the same as for
qa_post_create() above. Pass the identify of the user making this change in $byuserid (or null for anonymous). qa_post_create() above. Pass the identify of the user making this change in $byuserid (or null for silent).
*/ */
{ {
$oldpost=qa_post_get_full($postid, 'QAC'); $oldpost=qa_post_get_full($postid, 'QAC');
...@@ -123,18 +124,18 @@ ...@@ -123,18 +124,18 @@
switch ($oldpost['basetype']) { switch ($oldpost['basetype']) {
case 'Q': case 'Q':
$tagstring=qa_post_tags_to_tagstring($tags); $tagstring=qa_post_tags_to_tagstring($tags);
qa_question_set_content($oldpost, $title, $content, $format, $text, $tagstring, $setnotify, $byuserid, $byhandle, null, $extravalue); qa_question_set_content($oldpost, $title, $content, $format, $text, $tagstring, $setnotify, $byuserid, $byhandle, null, $extravalue, $name);
break; break;
case 'A': case 'A':
$question=qa_post_get_full($oldpost['parentid'], 'Q'); $question=qa_post_get_full($oldpost['parentid'], 'Q');
qa_answer_set_content($oldpost, $content, $format, $text, $setnotify, $byuserid, $byhandle, null, $question); qa_answer_set_content($oldpost, $content, $format, $text, $setnotify, $byuserid, $byhandle, null, $question, $name);
break; break;
case 'C': case 'C':
$parent=qa_post_get_full($oldpost['parentid'], 'QA'); $parent=qa_post_get_full($oldpost['parentid'], 'QA');
$question=qa_post_parent_to_question($parent); $question=qa_post_parent_to_question($parent);
qa_comment_set_content($oldpost, $content, $format, $text, $setnotify, $byuserid, $byhandle, null, $question, $parent); qa_comment_set_content($oldpost, $content, $format, $text, $setnotify, $byuserid, $byhandle, null, $question, $parent, $name);
break; break;
} }
} }
...@@ -204,8 +205,18 @@ ...@@ -204,8 +205,18 @@
function qa_post_set_hidden($postid, $hidden=true, $byuserid=null) function qa_post_set_hidden($postid, $hidden=true, $byuserid=null)
/* /*
Hide $postid if $hidden is true, show the post. Pass the identify of the user making this change in $byuserid (or Hide $postid if $hidden is true, otherwise show the post. Pass the identify of the user making this change in
null for an anonymous change). $byuserid (or null for a silent change). This function is included mainly for backwards compatibility.
*/
{
qa_post_set_status($postid, $hidden ? QA_POST_STATUS_HIDDEN : QA_POST_STATUS_NORMAL, $byuserid);
}
function qa_post_set_status($postid, $status, $byuserid=null)
/*
Change the status of $postid to $status, which should be one of the QA_POST_STATUS_* constants defined in
qa-app-post-update.php. Pass the identify of the user making this change in $byuserid (or null for a silent change).
*/ */
{ {
$oldpost=qa_post_get_full($postid, 'QAC'); $oldpost=qa_post_get_full($postid, 'QAC');
...@@ -216,19 +227,19 @@ ...@@ -216,19 +227,19 @@
$answers=qa_post_get_question_answers($postid); $answers=qa_post_get_question_answers($postid);
$commentsfollows=qa_post_get_question_commentsfollows($postid); $commentsfollows=qa_post_get_question_commentsfollows($postid);
$closepost=qa_post_get_question_closepost($postid); $closepost=qa_post_get_question_closepost($postid);
qa_question_set_hidden($oldpost, $hidden, $byuserid, $byhandle, null, $answers, $commentsfollows, $closepost); qa_question_set_status($oldpost, $status, $byuserid, $byhandle, null, $answers, $commentsfollows, $closepost);
break; break;
case 'A': case 'A':
$question=qa_post_get_full($oldpost['parentid'], 'Q'); $question=qa_post_get_full($oldpost['parentid'], 'Q');
$commentsfollows=qa_post_get_answer_commentsfollows($postid); $commentsfollows=qa_post_get_answer_commentsfollows($postid);
qa_answer_set_hidden($oldpost, $hidden, $byuserid, $byhandle, null, $question, $commentsfollows); qa_answer_set_status($oldpost, $status, $byuserid, $byhandle, null, $question, $commentsfollows);
break; break;
case 'C': case 'C':
$parent=qa_post_get_full($oldpost['parentid'], 'QA'); $parent=qa_post_get_full($oldpost['parentid'], 'QA');
$question=qa_post_parent_to_question($parent); $question=qa_post_parent_to_question($parent);
qa_comment_set_hidden($oldpost, $hidden, $byuserid, $byhandle, null, $question, $parent); qa_comment_set_status($oldpost, $status, $byuserid, $byhandle, null, $question, $parent);
break; break;
} }
} }
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
$qa_content=qa_content_prepare(true, array_keys(qa_category_path($navcategories, $categoryid))); $qa_content=qa_content_prepare(true, array_keys(qa_category_path($navcategories, $categoryid)));
$qa_content['q_list']['form']=array( $qa_content['q_list']['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'hidden' => array( 'hidden' => array(
'code' => qa_get_form_security_code('vote'), 'code' => qa_get_form_security_code('vote'),
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
} else } else
$qa_content['title']=$nonetitle; $qa_content['title']=$nonetitle;
if (isset($userid) && isset($categoryid) && isset($categoryisfavorite)) { if (isset($userid) && isset($categoryid)) {
$favoritemap=qa_get_favorite_non_qs_map(); $favoritemap=qa_get_favorite_non_qs_map();
$categoryisfavorite=@$favoritemap['category'][$navcategories[$categoryid]['backpath']] ? true : false; $categoryisfavorite=@$favoritemap['category'][$navcategories[$categoryid]['backpath']] ? true : false;
......
...@@ -54,15 +54,22 @@ ...@@ -54,15 +54,22 @@
} }
function qa_upload_file_one($maxfilesize=null, $onlyimage=false, $imagemaxwidth=null, $imagemaxheight=null)
{
$file=reset($_FILES);
return qa_upload_file($file['tmp_name'], $file['name'], $maxfilesize, $onlyimage, $imagemaxwidth, $imagemaxheight);
}
function qa_upload_file($localfilename, $sourcefilename, $maxfilesize=null, $onlyimage=false, $imagemaxwidth=null, $imagemaxheight=null) function qa_upload_file($localfilename, $sourcefilename, $maxfilesize=null, $onlyimage=false, $imagemaxwidth=null, $imagemaxheight=null)
/*
Move an uploaded image or other file into blob storage. Pass the $localfilename where the file is currently stored
(temporarily) and the $sourcefilename of the file on the user's computer (if using PHP's usual file upload
mechanism, these are obtained from $_FILES[..]['tmp_name'] and $_FILES[..]['name'] fields respectively). To apply a
maximum file size (in bytes) beyond the general one, use $maxfilesize, otherwise set it to null. Set $onlyimage to
true if only image uploads (PNG, GIF, JPEG) are allowed. To apply a maximum width or height (in pixels) to uploaded
images, set $imagemaxwidth and $imagemaxheight. The function returns an array which may contain the following elements:
'error' => a string containing an error, if one occurred
'format' => the format (file extension) of the blob created (all scaled images end up as 'jpeg')
'width' => if an image, the width in pixels of the blob created (after possible scaling)
'height' => if an image, the height in pixels of the blob created (after possible scaling)
'blobid' => the blobid that was created (if there was no error)
'bloburl' => the url that can be used to view/download the created blob (if there was no error)
*/
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -193,6 +200,17 @@ ...@@ -193,6 +200,17 @@
} }
function qa_upload_file_one($maxfilesize=null, $onlyimage=false, $imagemaxwidth=null, $imagemaxheight=null)
/*
In response to a file upload, move the first uploaded file into blob storage. Other parameters are as for qa_upload_file(...)
*/
{
$file=reset($_FILES);
return qa_upload_file($file['tmp_name'], $file['name'], $maxfilesize, $onlyimage, $imagemaxwidth, $imagemaxheight);
}
/* /*
Omit PHP closing tag to help avoid accidental output Omit PHP closing tag to help avoid accidental output
*/ */
\ No newline at end of file
...@@ -293,10 +293,13 @@ ...@@ -293,10 +293,13 @@
function qa_set_user_level($userid, $handle, $level, $oldlevel) function qa_set_user_level($userid, $handle, $level, $oldlevel)
/*
Set the user level of user $userid with $handle to $level (one of the QA_USER_LEVEL_* constraints in qa-app-users.php)
Pass the previous user level in $oldlevel. Reports the appropriate event, assumes change performed by the logged in user.
*/
{ {
require_once QA_INCLUDE_DIR.'qa-db-users.php'; require_once QA_INCLUDE_DIR.'qa-db-users.php';
if ($level!=$oldlevel) {
qa_db_user_set($userid, 'level', $level); qa_db_user_set($userid, 'level', $level);
qa_db_uapprovecount_update(); qa_db_uapprovecount_update();
...@@ -310,10 +313,13 @@ ...@@ -310,10 +313,13 @@
'oldlevel' => $oldlevel, 'oldlevel' => $oldlevel,
)); ));
} }
}
function qa_set_user_blocked($userid, $handle, $blocked) function qa_set_user_blocked($userid, $handle, $blocked)
/*
Set the status of user $userid with $handle to blocked if $blocked is true, otherwise to unblocked. Reports the appropriate
event, assumes change performed by the logged in user.
*/
{ {
require_once QA_INCLUDE_DIR.'qa-db-users.php'; require_once QA_INCLUDE_DIR.'qa-db-users.php';
......
...@@ -454,13 +454,13 @@ ...@@ -454,13 +454,13 @@
function qa_get_one_user_html($handle, $microformats=false, $favorited=false) function qa_get_one_user_html($handle, $microformats=false, $favorited=false)
/* /*
Return HTML to display for user with username $handle Return HTML to display for user with username $handle, with microformats if $microformats is true. Set $favorited to true to show the user as favorited.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return strlen($handle) ? ('<A HREF="'.qa_path_html('user/'.$handle).'" CLASS="qa-user-link' return strlen($handle) ? ('<a href="'.qa_path_html('user/'.$handle).'" class="qa-user-link'
.($favorited ? ' qa-user-favorited' : '').($microformats ? ' url nickname' : '').'">'.qa_html($handle).'</A>') : ''; .($favorited ? ' qa-user-favorited' : '').($microformats ? ' url nickname' : '').'">'.qa_html($handle).'</a>') : '';
} }
...@@ -483,7 +483,7 @@ ...@@ -483,7 +483,7 @@
else else
$html=null; $html=null;
return (isset($html) && strlen($handle)) ? ('<A HREF="'.qa_path_html('user/'.$handle).'" CLASS="qa-avatar-link">'.$html.'</A>') : $html; return (isset($html) && strlen($handle)) ? ('<a href="'.qa_path_html('user/'.$handle).'" class="qa-avatar-link">'.$html.'</a>') : $html;
} }
...@@ -603,6 +603,9 @@ ...@@ -603,6 +603,9 @@
function qa_get_logged_in_levels() function qa_get_logged_in_levels()
/*
Return an array of all the specific (e.g. per category) level privileges for the logged in user, retrieving from the database if necessary
*/
{ {
require_once QA_INCLUDE_DIR.'qa-db-selects.php'; require_once QA_INCLUDE_DIR.'qa-db-selects.php';
...@@ -668,6 +671,9 @@ ...@@ -668,6 +671,9 @@
function qa_handle_to_userid($handle) function qa_handle_to_userid($handle)
/*
Return the userid corresponding to $handle (not case- or accent-sensitive)
*/
{ {
if (QA_FINAL_EXTERNAL_USERS) if (QA_FINAL_EXTERNAL_USERS)
$handleuserids=qa_get_userids_from_public(array($handle)); $handleuserids=qa_get_userids_from_public(array($handle));
...@@ -685,6 +691,9 @@ ...@@ -685,6 +691,9 @@
function qa_user_level_for_categories($categoryids) function qa_user_level_for_categories($categoryids)
/*
Return the level of the logged in user for a post with $categoryids (expressing the full hierarchy to the final category)
*/
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -709,6 +718,9 @@ ...@@ -709,6 +718,9 @@
function qa_user_level_for_post($post) function qa_user_level_for_post($post)
/*
Return the level of the logged in user for $post, as retrieved from the database
*/
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -720,6 +732,9 @@ ...@@ -720,6 +732,9 @@
function qa_user_level_maximum() function qa_user_level_maximum()
/*
Return the maximum possible level of the logged in user in any context (i.e. for any category)
*/
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -734,12 +749,20 @@ ...@@ -734,12 +749,20 @@
function qa_user_post_permit_error($permitoption, $post, $limitaction=null, $checkblocks=true) function qa_user_post_permit_error($permitoption, $post, $limitaction=null, $checkblocks=true)
/*
Check whether the logged in user has permission to perform $permitoption on post $post (from the database)
Other parameters and the return value are as for qa_user_permit_error(...)
*/
{ {
return qa_user_permit_error($permitoption, $limitaction, qa_user_level_for_post($post), $checkblocks); return qa_user_permit_error($permitoption, $limitaction, qa_user_level_for_post($post), $checkblocks);
} }
function qa_user_maximum_permit_error($permitoption, $limitaction=null, $checkblocks=true) function qa_user_maximum_permit_error($permitoption, $limitaction=null, $checkblocks=true)
/*
Check whether the logged in user would have permittion to perform $permitoption in any context (i.e. for any category)
Other parameters and the return value are as for qa_user_permit_error(...)
*/
{ {
return qa_user_permit_error($permitoption, $limitaction, qa_user_level_maximum(), $checkblocks); return qa_user_permit_error($permitoption, $limitaction, qa_user_level_maximum(), $checkblocks);
} }
...@@ -749,8 +772,9 @@ ...@@ -749,8 +772,9 @@
/* /*
Check whether the logged in user has permission to perform $permitoption. If $permitoption is null, this simply Check whether the logged in user has permission to perform $permitoption. If $permitoption is null, this simply
checks whether the user is blocked. Optionally provide an $limitaction (see top of qa-app-limits.php) to also check checks whether the user is blocked. Optionally provide an $limitaction (see top of qa-app-limits.php) to also check
against user or IP rate limits. Optionally provide an array of $categoryids within which this permission should be against user or IP rate limits. You can pass in a QA_USER_LEVEL_* constant in $userlevel to consider the user at a
assessed, to support special user permission level in certain categories. different level to usual (e.g. if they are performing this action in a category for which they have elevated
privileges). To ignore the user's blocked status, set $checkblocks to false.
Possible results, in order of priority (i.e. if more than one reason, the first will be given): Possible results, in order of priority (i.e. if more than one reason, the first will be given):
'level' => a special privilege level (e.g. expert) or minimum number of points is required 'level' => a special privilege level (e.g. expert) or minimum number of points is required
...@@ -887,6 +911,17 @@ ...@@ -887,6 +911,17 @@
function qa_user_captcha_reason($userlevel=null) function qa_user_captcha_reason($userlevel=null)
/*
Return whether a captcha is required for posts submitted by the current user. You can pass in a QA_USER_LEVEL_*
constant in $userlevel to consider the user at a different level to usual (e.g. if they are performing this action
in a category for which they have elevated privileges).
Possible results:
'login' => captcha required because the user is not logged in
'approve' => captcha required because the user has not been approved
'confirm' => captcha required because the user has not confirmed their email address
false => captcha is not required
*/
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -911,7 +946,8 @@ ...@@ -911,7 +946,8 @@
function qa_user_use_captcha($userlevel=null) function qa_user_use_captcha($userlevel=null)
/* /*
Return whether a captcha should be presented to the current user for writing posts Return whether a captcha should be presented to the logged in user for writing posts. You can pass in a
QA_USER_LEVEL_* constant in $userlevel to consider the user at a different level to usual.
*/ */
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -922,7 +958,11 @@ ...@@ -922,7 +958,11 @@
function qa_user_moderation_reason($userlevel=null) function qa_user_moderation_reason($userlevel=null)
/* /*
Return whether moderation is required for posts submitted by the current user. Possible results: Return whether moderation is required for posts submitted by the current user. You can pass in a QA_USER_LEVEL_*
constant in $userlevel to consider the user at a different level to usual (e.g. if they are performing this action
in a category for which they have elevated privileges).
Possible results:
'login' => moderation required because the user is not logged in 'login' => moderation required because the user is not logged in
'approve' => moderation required because the user has not been approved 'approve' => moderation required because the user has not been approved
'confirm' => moderation required because the user has not confirmed their email address 'confirm' => moderation required because the user has not confirmed their email address
...@@ -983,6 +1023,9 @@ ...@@ -983,6 +1023,9 @@
function qa_set_form_security_key() function qa_set_form_security_key()
/*
Set or extend the cookie in browser of non logged-in users which identifies them for the purposes of form security (anti-CSRF protection)
*/
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -1002,6 +1045,10 @@ ...@@ -1002,6 +1045,10 @@
function qa_calc_form_security_hash($action, $timestamp) function qa_calc_form_security_hash($action, $timestamp)
/*
Return the form security (anti-CSRF protection) hash for an $action (any string), that can be performed within
QA_FORM_EXPIRY_SECS of $timestamp (in unix seconds) by the current user.
*/
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -1015,6 +1062,10 @@ ...@@ -1015,6 +1062,10 @@
function qa_get_form_security_code($action) function qa_get_form_security_code($action)
/*
Return the full form security (anti-CSRF protection) code for an $action (any string) performed within
QA_FORM_EXPIRY_SECS of now by the current user.
*/
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -1027,6 +1078,10 @@ ...@@ -1027,6 +1078,10 @@
function qa_check_form_security_code($action, $value) function qa_check_form_security_code($action, $value)
/*
Return whether $value matches the expected form security (anti-CSRF protection) code for $action (any string) and
that the code has not expired (if more than QA_FORM_EXPIRY_SECS have passed). Logs causes for suspicion.
*/
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
......
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
*/ */
define('QA_VERSION', '1.6-beta-1'); // also used as suffix for .js and .css requests define('QA_VERSION', '1.6-beta-2'); // also used as suffix for .js and .css requests
define('QA_BUILD_DATE', '2013-06-06'); define('QA_BUILD_DATE', '2013-06-20');
// Execution section of this file - remainder contains function definitions // Execution section of this file - remainder contains function definitions
...@@ -343,7 +343,7 @@ ...@@ -343,7 +343,7 @@
$functionsphp=substr_replace($functionsphp, $newname, $searchmatch[1], strlen($searchmatch[0])); $functionsphp=substr_replace($functionsphp, $newname, $searchmatch[1], strlen($searchmatch[0]));
} }
// echo '<PRE STYLE="text-align:left;">'.htmlspecialchars($functionsphp).'</PRE>'; // to debug munged code // echo '<pre style="text-align:left;">'.htmlspecialchars($functionsphp).'</pre>'; // to debug munged code
qa_eval_from_file($functionsphp, $filename); qa_eval_from_file($functionsphp, $filename);
} }
...@@ -494,7 +494,11 @@ ...@@ -494,7 +494,11 @@
// Low-level functions used throughout Q2A // Low-level functions used throughout Q2A
function qa_eval_from_file($contents, $filename) function qa_eval_from_file($eval, $filename)
/*
Calls eval() on the PHP code in $eval which came from the file $filename. It supplements PHP's regular error reporting by
displaying/logging (as appropriate) the original source filename, if an error occurred when evaluating the code.
*/
{ {
// could also use ini_set('error_append_string') but apparently it doesn't work for errors logged on disk // could also use ini_set('error_append_string') but apparently it doesn't work for errors logged on disk
...@@ -503,7 +507,7 @@ ...@@ -503,7 +507,7 @@
$oldtrackerrors=@ini_set('track_errors', 1); $oldtrackerrors=@ini_set('track_errors', 1);
$php_errormsg=null; $php_errormsg=null;
eval('?'.'>'.$contents); eval('?'.'>'.$eval);
if (strlen($php_errormsg)) { if (strlen($php_errormsg)) {
switch (strtolower(@ini_get('display_errors'))) { switch (strtolower(@ini_get('display_errors'))) {
...@@ -593,14 +597,14 @@ ...@@ -593,14 +597,14 @@
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
echo 'Question2Answer fatal error:<P><FONT COLOR="red">'.qa_html($message, true).'</FONT></P>'; echo 'Question2Answer fatal error:<p><font color="red">'.qa_html($message, true).'</font></p>';
@error_log('PHP Question2Answer fatal error: '.$message); @error_log('PHP Question2Answer fatal error: '.$message);
echo '<P>Stack trace:<P>'; echo '<p>Stack trace:<p>';
$backtrace=array_reverse(array_slice(debug_backtrace(), 1)); $backtrace=array_reverse(array_slice(debug_backtrace(), 1));
foreach ($backtrace as $trace) foreach ($backtrace as $trace)
echo '<FONT COLOR="#'.((strpos(@$trace['file'], '/qa-plugin/')!==false) ? 'f00' : '999').'">'. echo '<font color="#'.((strpos(@$trace['file'], '/qa-plugin/')!==false) ? 'f00' : '999').'">'.
qa_html(@$trace['function'].'() in '.basename(@$trace['file']).':'.@$trace['line']).'</FONT><BR>'; qa_html(@$trace['function'].'() in '.basename(@$trace['file']).':'.@$trace['line']).'</font><br>';
qa_exit('error'); qa_exit('error');
} }
...@@ -768,6 +772,9 @@ ...@@ -768,6 +772,9 @@
function qa_xml($string) function qa_xml($string)
/*
Return XML representation of $string, which is similar to HTML but ASCII control characters are also disallowed
*/
{ {
return htmlspecialchars(preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F]/', '', (string)$string)); return htmlspecialchars(preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F]/', '', (string)$string));
} }
...@@ -775,7 +782,7 @@ ...@@ -775,7 +782,7 @@
function qa_js($value, $forcequotes=false) function qa_js($value, $forcequotes=false)
/* /*
Return JavaScript representation of $value, putting in quotes if non-numeric or if $forcequote is true Return JavaScript representation of $value, putting in quotes if non-numeric or if $forcequotes is true
*/ */
{ {
if (is_numeric($value) && !$forcequotes) if (is_numeric($value) && !$forcequotes)
...@@ -887,7 +894,7 @@ ...@@ -887,7 +894,7 @@
function qa_clicked($name) function qa_clicked($name)
/* /*
Return true if form button $name was clicked (as TYPE=SUBMIT/IMAGE) to create this page request, or if a Return true if form button $name was clicked (as type=submit/image) to create this page request, or if a
simulated click was sent for the button (via 'qa_click' POST field) simulated click was sent for the button (via 'qa_click' POST field)
*/ */
{ {
...@@ -1201,6 +1208,9 @@ ...@@ -1201,6 +1208,9 @@
function qa_path_absolute($request, $params=null, $anchor=null) function qa_path_absolute($request, $params=null, $anchor=null)
/*
Return the absolute URI for $request - see qa_path() for other parameters
*/
{ {
return qa_path($request, $params, qa_opt('site_url'), null, $anchor); return qa_path($request, $params, qa_opt('site_url'), null, $anchor);
} }
...@@ -1300,7 +1310,7 @@ ...@@ -1300,7 +1310,7 @@
function qa_self_html() function qa_self_html()
/* /*
Return an HTML-ready relative URL for the current page, preserving GET parameters - this is useful for ACTION in FORMs Return an HTML-ready relative URL for the current page, preserving GET parameters - this is useful for action="..." in HTML forms
*/ */
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -1313,7 +1323,7 @@ ...@@ -1313,7 +1323,7 @@
function qa_path_form_html($request, $params=null, $rooturl=null, $neaturls=null, $anchor=null) function qa_path_form_html($request, $params=null, $rooturl=null, $neaturls=null, $anchor=null)
/* /*
Return HTML for hidden fields to insert into a <FORM METHOD="GET"...> on the page. Return HTML for hidden fields to insert into a <form method="get"...> on the page.
This is needed because any parameters on the URL will be lost when the form is submitted. This is needed because any parameters on the URL will be lost when the form is submitted.
*/ */
{ {
...@@ -1328,7 +1338,7 @@ ...@@ -1328,7 +1338,7 @@
foreach ($params as $param) foreach ($params as $param)
if (preg_match('/^([^\=]*)(\=(.*))?$/', $param, $matches)) if (preg_match('/^([^\=]*)(\=(.*))?$/', $param, $matches))
$formhtml.='<INPUT TYPE="hidden" NAME="'.qa_html(urldecode($matches[1])).'" VALUE="'.qa_html(urldecode(@$matches[3])).'"/>'; $formhtml.='<input type="hidden" name="'.qa_html(urldecode($matches[1])).'" value="'.qa_html(urldecode(@$matches[3])).'"/>';
} }
return $formhtml; return $formhtml;
......
...@@ -34,15 +34,15 @@ ...@@ -34,15 +34,15 @@
header('Content-type: text/html; charset=utf-8'); header('Content-type: text/html; charset=utf-8');
?> ?>
<HTML> <html>
<HEAD> <head>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=utf-8"/> <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<TITLE>Question2Answer Language Check</TITLE> <title>Question2Answer Language Check</title>
<STYLE> <style>
code {font-size:125%;} code {font-size:125%;}
</STYLE> </style>
</HEAD> </head>
<BODY STYLE="font-family:arial; font-size:12px;"> <body style="font-family:arial; font-size:12px;">
<?php <?php
function get_phrase_substitutions($phrase) function get_phrase_substitutions($phrase)
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
echo '<font color="#cc0000"><code>Dark red = important to review.</code></font><br>'; echo '<font color="#cc0000"><code>Dark red = important to review.</code></font><br>';
echo '<font color="#cc9999"><code>Light red = probably safe to ignore.</code></font>'; echo '<font color="#cc9999"><code>Light red = probably safe to ignore.</code></font>';
echo '<H1>Checking US English files in <code>qa-include</code>...</H1>'; echo '<h1>Checking US English files in <code>qa-include</code>...</h1>';
$includefiles=array_merge(glob(QA_INCLUDE_DIR.'qa-*.php'), glob(QA_PLUGIN_DIR.'*/qa-*.php')); $includefiles=array_merge(glob(QA_INCLUDE_DIR.'qa-*.php'), glob(QA_PLUGIN_DIR.'*/qa-*.php'));
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
unset($languages['']); unset($languages['']);
foreach ($languages as $code => $language) { foreach ($languages as $code => $language) {
echo '<H1>Checking '.$language.' files in <code>qa-lang/'.$code.'</code>...</H1>'; echo '<h1>Checking '.$language.' files in <code>qa-lang/'.$code.'</code>...</h1>';
$langdefined=array(); $langdefined=array();
$langdifferent=array(); $langdifferent=array();
...@@ -195,16 +195,16 @@ ...@@ -195,16 +195,16 @@
} }
foreach ($langnewphrases as $prefix => $phrases) { foreach ($langnewphrases as $prefix => $phrases) {
echo '<H2>'.$language.' phrases to add to <code>qa-lang/'.$code.'/qa-lang-'.$prefix.'.php</code>:</H2>'; echo '<h2>'.$language.' phrases to add to <code>qa-lang/'.$code.'/qa-lang-'.$prefix.'.php</code>:</h2>';
echo 'Copy and paste this into the middle of <code>qa-lang/'.$code.'/qa-lang-'.$prefix.'.php</code> then translate the right-hand side after the <code>=></code> symbol.'; echo 'Copy and paste this into the middle of <code>qa-lang/'.$code.'/qa-lang-'.$prefix.'.php</code> then translate the right-hand side after the <code>=></code> symbol.';
echo '<PRE>'; echo '<pre>';
foreach ($phrases as $key => $value) foreach ($phrases as $key => $value)
echo '<SPAN STYLE="font-size:25%;">'."\t\t</SPAN>'".$key."' => \"".strtr($value, array('\\' => '\\\\', '"' => '\"', '$' => '\$', "\n" => '\n', "\t" => '\t'))."\",\n"; echo '<span style="font-size:25%;">'."\t\t</span>'".$key."' => \"".strtr($value, array('\\' => '\\\\', '"' => '\"', '$' => '\$', "\n" => '\n', "\t" => '\t'))."\",\n";
echo '</PRE>'; echo '</pre>';
} }
} }
...@@ -213,12 +213,12 @@ ...@@ -213,12 +213,12 @@
{ {
echo '<font color="'.($error ? '#cc0000' : '#cc9999').'"><code>'; echo '<font color="'.($error ? '#cc0000' : '#cc9999').'"><code>';
echo 'qa-lang-<B>'.qa_html($prefix).'</B>.php:'; echo 'qa-lang-<b>'.qa_html($prefix).'</b>.php:';
if (strlen($key)) if (strlen($key))
echo "'<B>".qa_html($key)."</B>'"; echo "'<b>".qa_html($key)."</b>'";
echo '</code></font> &nbsp; '.qa_html($issue).'<BR>'; echo '</code></font> &nbsp; '.qa_html($issue).'<br>';
} }
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
$oneread=false; $oneread=false;
echo '<P STYLE="font-size:80%; color:#999;">Reading: '; echo '<p style="font-size:80%; color:#999;">Reading: ';
} }
...@@ -245,13 +245,13 @@ ...@@ -245,13 +245,13 @@
function output_finish_includes() function output_finish_includes()
{ {
echo '</P>'; echo '</p>';
} }
echo '<H1>Finished scanning for problems!</H1>'; echo '<h1>Finished scanning for problems!</h1>';
?> ?>
</BODY> </body>
</HTML> </html>
\ No newline at end of file \ No newline at end of file
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
function qa_db_get_user_visible_postids($userid) function qa_db_get_user_visible_postids($userid)
/* /*
Return list of postids of visible posts by $userid Return list of postids of visible or queued posts by $userid
*/ */
{ {
return qa_db_read_all_values(qa_db_query_sub( return qa_db_read_all_values(qa_db_query_sub(
...@@ -146,7 +146,7 @@ ...@@ -146,7 +146,7 @@
function qa_db_get_ip_visible_postids($ip) function qa_db_get_ip_visible_postids($ip)
/* /*
Return list of postids of visible posts from $ip address Return list of postids of visible or queued posts from $ip address
*/ */
{ {
return qa_db_read_all_values(qa_db_query_sub( return qa_db_read_all_values(qa_db_query_sub(
...@@ -172,6 +172,10 @@ ...@@ -172,6 +172,10 @@
function qa_db_get_unapproved_users($count) function qa_db_get_unapproved_users($count)
/*
Return an array of the (up to) $count most recently created users who are awaiting approval and have not been blocked.
The array element for each user includes a 'profile' key whose value is an array of non-empty profile fields of the user.
*/
{ {
$results=qa_db_read_all_assoc(qa_db_query_sub( $results=qa_db_read_all_assoc(qa_db_query_sub(
"SELECT ^users.userid, UNIX_TIMESTAMP(created) AS created, INET_NTOA(createip) AS createip, email, handle, title, content FROM ^users LEFT JOIN ^userprofile ON ^users.userid=^userprofile.userid AND LENGTH(content)>0 WHERE level<# AND NOT (flags&#) ORDER BY created DESC LIMIT #", "SELECT ^users.userid, UNIX_TIMESTAMP(created) AS created, INET_NTOA(createip) AS createip, email, handle, title, content FROM ^users LEFT JOIN ^userprofile ON ^users.userid=^userprofile.userid AND LENGTH(content)>0 WHERE level<# AND NOT (flags&#) ORDER BY created DESC LIMIT #",
...@@ -199,12 +203,18 @@ ...@@ -199,12 +203,18 @@
function qa_db_has_blobs_on_disk() function qa_db_has_blobs_on_disk()
/*
Return whether there are any blobs whose content has been stored as a file on disk
*/
{ {
return count(qa_db_read_all_values(qa_db_query_sub('SELECT blobid FROM ^blobs WHERE content IS NULL LIMIT 1'))) ? true : false; return count(qa_db_read_all_values(qa_db_query_sub('SELECT blobid FROM ^blobs WHERE content IS NULL LIMIT 1'))) ? true : false;
} }
function qa_db_has_blobs_in_db() function qa_db_has_blobs_in_db()
/*
Return whether there are any blobs whose content has been stored in the database
*/
{ {
return count(qa_db_read_all_values(qa_db_query_sub('SELECT blobid FROM ^blobs WHERE content IS NOT NULL LIMIT 1'))) ? true : false; return count(qa_db_read_all_values(qa_db_query_sub('SELECT blobid FROM ^blobs WHERE content IS NOT NULL LIMIT 1'))) ? true : false;
} }
...@@ -483,7 +493,7 @@ ...@@ -483,7 +493,7 @@
function qa_db_userfield_create($title, $content, $flags, $permit=null) function qa_db_userfield_create($title, $content, $flags, $permit=null)
/* /*
Create a new user field with (internal) tag $title, label $content, and $flags in the database Create a new user field with (internal) tag $title, label $content, $flags and $permit in the database.
*/ */
{ {
$position=qa_db_read_one_value(qa_db_query_sub('SELECT 1+COALESCE(MAX(position), 0) FROM ^userfields')); $position=qa_db_read_one_value(qa_db_query_sub('SELECT 1+COALESCE(MAX(position), 0) FROM ^userfields'));
...@@ -499,7 +509,7 @@ ...@@ -499,7 +509,7 @@
function qa_db_userfield_set_fields($fieldid, $content, $flags, $permit=null) function qa_db_userfield_set_fields($fieldid, $content, $flags, $permit=null)
/* /*
Change the user field $fieldid to have label $content and $flags in the database (the title column cannot be changed once set) Change the user field $fieldid to have label $content, $flags and $permit in the database (the title column cannot be changed once set)
*/ */
{ {
qa_db_query_sub( qa_db_query_sub(
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
function qa_db_blob_create($content, $format, $sourcefilename=null, $userid=null, $cookieid=null, $ip=null) function qa_db_blob_create($content, $format, $sourcefilename=null, $userid=null, $cookieid=null, $ip=null)
/* /*
Create a new blob in the database with $content and $format, returning its blobid Create a new blob in the database with $content and $format, other fields as provided
*/ */
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
function qa_db_blob_read($blobid) function qa_db_blob_read($blobid)
/* /*
Get the content of blob $blobid from the database Get the information about blob $blobid from the database
*/ */
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
...@@ -70,6 +70,9 @@ ...@@ -70,6 +70,9 @@
function qa_db_blob_set_content($blobid, $content) function qa_db_blob_set_content($blobid, $content)
/*
Change the content of blob $blobid in the database to $content (can also be null)
*/
{ {
qa_db_query_sub( qa_db_query_sub(
'UPDATE ^blobs SET content=$ WHERE blobid=#', 'UPDATE ^blobs SET content=$ WHERE blobid=#',
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
exit; exit;
} }
define('QA_DB_VERSION_CURRENT', 54); define('QA_DB_VERSION_CURRENT', 55);
function qa_db_user_column_type_verify() function qa_db_user_column_type_verify()
...@@ -121,6 +121,7 @@ ...@@ -121,6 +121,7 @@
'sessioncode' => 'CHAR(8) CHARACTER SET ascii NOT NULL DEFAULT \'\'', // for comparing against session cookie in browser 'sessioncode' => 'CHAR(8) CHARACTER SET ascii NOT NULL DEFAULT \'\'', // for comparing against session cookie in browser
'sessionsource' => 'VARCHAR (16) CHARACTER SET ascii DEFAULT \'\'', // e.g. facebook, openid, etc... 'sessionsource' => 'VARCHAR (16) CHARACTER SET ascii DEFAULT \'\'', // e.g. facebook, openid, etc...
'flags' => 'SMALLINT UNSIGNED NOT NULL DEFAULT 0', // see constants at top of qa-app-users.php 'flags' => 'SMALLINT UNSIGNED NOT NULL DEFAULT 0', // see constants at top of qa-app-users.php
'wallposts' => 'MEDIUMINT NOT NULL DEFAULT 0', // cached count of wall posts
'PRIMARY KEY (userid)', 'PRIMARY KEY (userid)',
'KEY email (email)', 'KEY email (email)',
'KEY handle (handle)', 'KEY handle (handle)',
...@@ -255,7 +256,7 @@ ...@@ -255,7 +256,7 @@
'flags' => 'TINYINT UNSIGNED NOT NULL', // local or external, open in new window? 'flags' => 'TINYINT UNSIGNED NOT NULL', // local or external, open in new window?
'permit' => 'TINYINT UNSIGNED', // is there a minimum user level required for it (uses QA_PERMIT_* constants), null means no restriction 'permit' => 'TINYINT UNSIGNED', // is there a minimum user level required for it (uses QA_PERMIT_* constants), null means no restriction
'tags' => 'VARCHAR('.QA_DB_MAX_CAT_PAGE_TAGS_LENGTH.') NOT NULL', // slug (url fragment) for page, or url for external pages 'tags' => 'VARCHAR('.QA_DB_MAX_CAT_PAGE_TAGS_LENGTH.') NOT NULL', // slug (url fragment) for page, or url for external pages
'heading' => 'VARCHAR('.QA_DB_MAX_TITLE_LENGTH.')', // for display within <H1> tags 'heading' => 'VARCHAR('.QA_DB_MAX_TITLE_LENGTH.')', // for display within <h1> tags
'content' => 'MEDIUMTEXT', // remainder of page HTML 'content' => 'MEDIUMTEXT', // remainder of page HTML
'PRIMARY KEY (pageid)', 'PRIMARY KEY (pageid)',
'UNIQUE tags (tags)', 'UNIQUE tags (tags)',
...@@ -1377,7 +1378,24 @@ ...@@ -1377,7 +1378,24 @@
qa_db_upgrade_query($locktablesquery); qa_db_upgrade_query($locktablesquery);
break; break;
// Up to here: Version 1.6 dev // Up to here: Version 1.6 beta 1
case 55:
if (!QA_FINAL_EXTERNAL_USERS) {
$keycolumns=qa_array_to_lower_keys(qa_db_read_all_values(qa_db_query_sub('SHOW COLUMNS FROM ^users')));
// might be using messages table shared with another installation, so check if we need to upgrade
if (isset($keycolumns['wallposts']))
qa_db_upgrade_progress('Skipping upgrading users table since it was already upgraded by another Q2A site sharing it.');
else {
qa_db_upgrade_query('ALTER TABLE ^users ADD COLUMN wallposts '.$definitions['users']['wallposts'].' AFTER flags');
qa_db_upgrade_query($locktablesquery);
}
}
break;
// Up to here: Version 1.6 beta 2
} }
...@@ -1434,7 +1452,7 @@ ...@@ -1434,7 +1452,7 @@
Output $text to the browser (after converting to HTML) and do all we can to get it displayed Output $text to the browser (after converting to HTML) and do all we can to get it displayed
*/ */
{ {
echo qa_html($text).str_repeat(' ', 1024)."<BR><BR>\n"; echo qa_html($text).str_repeat(' ', 1024)."<br><br>\n";
flush(); flush();
} }
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
@define('QA_DB_RETRIEVE_USERS', 200); @define('QA_DB_RETRIEVE_USERS', 200);
@define('QA_DB_RETRIEVE_ASK_TAG_QS', 500); @define('QA_DB_RETRIEVE_ASK_TAG_QS', 500);
@define('QA_DB_RETRIEVE_COMPLETE_TAGS', 1000); @define('QA_DB_RETRIEVE_COMPLETE_TAGS', 1000);
@define('QA_DB_RETRIEVE_MESSAGES', 10); @define('QA_DB_RETRIEVE_MESSAGES', 20);
// Keep event streams trimmed - not worth storing too many events per question because we only display the // Keep event streams trimmed - not worth storing too many events per question because we only display the
......
...@@ -32,7 +32,8 @@ ...@@ -32,7 +32,8 @@
function qa_db_message_create($fromuserid, $touserid, $content, $format, $public=false) function qa_db_message_create($fromuserid, $touserid, $content, $format, $public=false)
/* /*
Record a private message sent from $fromuserid to $touserid with $content in $format Record a message sent from $fromuserid to $touserid with $content in $format in the database. $public sets whether
public (on wall) or private. Return the messageid of the row created.
*/ */
{ {
qa_db_query_sub( qa_db_query_sub(
...@@ -45,6 +46,9 @@ ...@@ -45,6 +46,9 @@
function qa_db_message_delete($messageid) function qa_db_message_delete($messageid)
/*
Delete the message with $messageid from the database
*/
{ {
qa_db_query_sub( qa_db_query_sub(
'DELETE FROM ^messages WHERE messageid=#', 'DELETE FROM ^messages WHERE messageid=#',
...@@ -53,6 +57,19 @@ ...@@ -53,6 +57,19 @@
} }
function qa_db_user_recount_posts($userid)
/*
Recalculate the cached count of wall posts for user $userid in the database
*/
{
if (qa_should_update_counts())
qa_db_query_sub(
"UPDATE ^users AS x, (SELECT COUNT(*) AS wallposts FROM ^messages WHERE touserid=# AND type='PUBLIC') AS a SET x.wallposts=a.wallposts WHERE x.userid=#",
$userid, $userid
);
}
/* /*
Omit PHP closing tag to help avoid accidental output Omit PHP closing tag to help avoid accidental output
*/ */
\ No newline at end of file
...@@ -356,6 +356,9 @@ ...@@ -356,6 +356,9 @@
function qa_db_queuedcount_update() function qa_db_queuedcount_update()
/*
Update the cached count in the database of the number of posts which are queued for moderation
*/
{ {
if (qa_should_update_counts()) if (qa_should_update_counts())
qa_db_query_sub("REPLACE ^options (title, content) SELECT 'cache_queuedcount', COUNT(*) FROM ^posts WHERE type IN ('Q_QUEUED', 'A_QUEUED', 'C_QUEUED')"); qa_db_query_sub("REPLACE ^options (title, content) SELECT 'cache_queuedcount', COUNT(*) FROM ^posts WHERE type IN ('Q_QUEUED', 'A_QUEUED', 'C_QUEUED')");
......
...@@ -115,8 +115,9 @@ ...@@ -115,8 +115,9 @@
function qa_db_post_set_content($postid, $title, $content, $format, $tagstring, $notify, $lastuserid=null, $lastip=null, $updatetype=QA_UPDATE_CONTENT, $name=null) function qa_db_post_set_content($postid, $title, $content, $format, $tagstring, $notify, $lastuserid=null, $lastip=null, $updatetype=QA_UPDATE_CONTENT, $name=null)
/* /*
Set the text fields in the database of $postid to $title, $content, $tagstring and $notify, and record Set the text fields in the database of $postid to $title, $content, $tagstring, $notify and $name, and record that
that $lastuserid did it from $lastip (if at least one is specified) with $updatetype. $lastuserid did it from $lastip (if at least one is specified) with $updatetype. or backwards compatibility if $name
is null then the name will not be changed.
*/ */
{ {
if (isset($lastuserid) || isset($lastip)) // use COALESCE() for name since $name=null means it should not be modified (for backwards compatibility) if (isset($lastuserid) || isset($lastip)) // use COALESCE() for name since $name=null means it should not be modified (for backwards compatibility)
...@@ -177,7 +178,7 @@ ...@@ -177,7 +178,7 @@
function qa_db_post_set_created($postid, $created) function qa_db_post_set_created($postid, $created)
/* /*
Set the created date of $postid to $created, which is a unix timestamp. If created is NULL, set to now. Set the created date of $postid to $created, which is a unix timestamp. If created is null, set to now.
*/ */
{ {
if (isset($created)) if (isset($created))
...@@ -194,6 +195,9 @@ ...@@ -194,6 +195,9 @@
function qa_db_post_set_updated($postid, $updated) function qa_db_post_set_updated($postid, $updated)
/*
Set the last updated date of $postid to $updated, which is a unix timestamp. If updated is nul, set to now.
*/
{ {
if (isset($updated)) if (isset($updated))
qa_db_query_sub( qa_db_query_sub(
...@@ -347,6 +351,9 @@ ...@@ -347,6 +351,9 @@
function qa_db_flaggedcount_update() function qa_db_flaggedcount_update()
/*
Update the cached count of the number of flagged posts in the database
*/
{ {
if (qa_should_update_counts()) if (qa_should_update_counts())
qa_db_query_sub("REPLACE ^options (title, content) SELECT 'cache_flaggedcount', COUNT(*) FROM ^posts WHERE flagcount>0 AND type IN ('Q', 'A', 'C')"); qa_db_query_sub("REPLACE ^options (title, content) SELECT 'cache_flaggedcount', COUNT(*) FROM ^posts WHERE flagcount>0 AND type IN ('Q', 'A', 'C')");
......
...@@ -382,11 +382,18 @@ ...@@ -382,11 +382,18 @@
// For moving blobs between database and disk... // For moving blobs between database and disk...
function qa_db_count_blobs_in_db() function qa_db_count_blobs_in_db()
/*
Return the number of blobs whose content is stored in the database, rather than on disk
*/
{ {
return qa_db_read_one_value(qa_db_query_sub('SELECT COUNT(*) FROM ^blobs WHERE content IS NOT NULL')); return qa_db_read_one_value(qa_db_query_sub('SELECT COUNT(*) FROM ^blobs WHERE content IS NOT NULL'));
} }
function qa_db_get_next_blob_in_db($startblobid) function qa_db_get_next_blob_in_db($startblobid)
/*
Return the id, content and format of the first blob whose content is stored in the database starting from $startblobid
*/
{ {
return qa_db_read_one_assoc(qa_db_query_sub( return qa_db_read_one_assoc(qa_db_query_sub(
'SELECT blobid, content, format FROM ^blobs WHERE blobid>=# AND content IS NOT NULL', 'SELECT blobid, content, format FROM ^blobs WHERE blobid>=# AND content IS NOT NULL',
...@@ -394,12 +401,20 @@ ...@@ -394,12 +401,20 @@
), true); ), true);
} }
function qa_db_count_blobs_on_disk() function qa_db_count_blobs_on_disk()
/*
Return the number of blobs whose content is stored on disk, rather than in the database
*/
{ {
return qa_db_read_one_value(qa_db_query_sub('SELECT COUNT(*) FROM ^blobs WHERE content IS NULL')); return qa_db_read_one_value(qa_db_query_sub('SELECT COUNT(*) FROM ^blobs WHERE content IS NULL'));
} }
function qa_db_get_next_blob_on_disk($startblobid) function qa_db_get_next_blob_on_disk($startblobid)
/*
Return the id and format of the first blob whose content is stored on disk starting from $startblobid
*/
{ {
return qa_db_read_one_assoc(qa_db_query_sub( return qa_db_read_one_assoc(qa_db_query_sub(
'SELECT blobid, format FROM ^blobs WHERE blobid>=# AND content IS NULL', 'SELECT blobid, format FROM ^blobs WHERE blobid>=# AND content IS NULL',
......
...@@ -1057,6 +1057,10 @@ ...@@ -1057,6 +1057,10 @@
qa_db_add_selectspec_opost($selectspec, 'aposts'); qa_db_add_selectspec_opost($selectspec, 'aposts');
$selectspec['columns']['oupvotes']='aposts.upvotes';
$selectspec['columns']['odownvotes']='aposts.downvotes';
$selectspec['columns']['onetvotes']='aposts.netvotes';
$selectspec['source'].=" JOIN ^posts AS aposts ON ^posts.postid=aposts.parentid". $selectspec['source'].=" JOIN ^posts AS aposts ON ^posts.postid=aposts.parentid".
" JOIN (SELECT postid FROM ^posts WHERE ". " JOIN (SELECT postid FROM ^posts WHERE ".
" userid=".(QA_FINAL_EXTERNAL_USERS ? "$" : "(SELECT userid FROM ^users WHERE handle=$ LIMIT 1)"). " userid=".(QA_FINAL_EXTERNAL_USERS ? "$" : "(SELECT userid FROM ^users WHERE handle=$ LIMIT 1)").
...@@ -1170,7 +1174,7 @@ ...@@ -1170,7 +1174,7 @@
'^users.userid', 'passsalt', 'passcheck' => 'HEX(passcheck)', 'email', 'level', 'emailcode', 'handle', '^users.userid', 'passsalt', 'passcheck' => 'HEX(passcheck)', 'email', 'level', 'emailcode', 'handle',
'created' => 'UNIX_TIMESTAMP(created)', 'sessioncode', 'sessionsource', 'flags', 'loggedin' => 'UNIX_TIMESTAMP(loggedin)', 'created' => 'UNIX_TIMESTAMP(created)', 'sessioncode', 'sessionsource', 'flags', 'loggedin' => 'UNIX_TIMESTAMP(loggedin)',
'loginip' => 'INET_NTOA(loginip)', 'written' => 'UNIX_TIMESTAMP(written)', 'writeip' => 'INET_NTOA(writeip)', 'loginip' => 'INET_NTOA(loginip)', 'written' => 'UNIX_TIMESTAMP(written)', 'writeip' => 'INET_NTOA(writeip)',
'avatarblobid', 'avatarwidth', 'avatarheight', 'points', 'avatarblobid', 'avatarwidth', 'avatarheight', 'points', 'wallposts',
), ),
'source' => '^users LEFT JOIN ^userpoints ON ^userpoints.userid=^users.userid WHERE ^users.'.($isuserid ? 'userid' : 'handle').'=$', 'source' => '^users LEFT JOIN ^userpoints ON ^userpoints.userid=^users.userid WHERE ^users.'.($isuserid ? 'userid' : 'handle').'=$',
...@@ -1296,7 +1300,7 @@ ...@@ -1296,7 +1300,7 @@
} }
function qa_db_recent_messages_selectspec($fromidentifier, $fromisuserid, $toidentifier, $toisuserid, $count=null) function qa_db_recent_messages_selectspec($fromidentifier, $fromisuserid, $toidentifier, $toisuserid, $count=null, $start=0)
/* /*
If $fromidentifier is not null, return the selectspec to get recent private messages which have been sent from If $fromidentifier is not null, return the selectspec to get recent private messages which have been sent from
the user identified by $fromidentifier+$fromisuserid to the user identified by $toidentifier+$toisuserid (see the user identified by $fromidentifier+$fromisuserid to the user identified by $toidentifier+$toisuserid (see
...@@ -1316,9 +1320,9 @@ ...@@ -1316,9 +1320,9 @@
'source' => '^messages LEFT JOIN ^users ON fromuserid=^users.userid WHERE '.(isset($fromidentifier) 'source' => '^messages LEFT JOIN ^users ON fromuserid=^users.userid WHERE '.(isset($fromidentifier)
? ('fromuserid='.($fromisuserid ? "$" : "(SELECT userid FROM ^users WHERE handle=$ LIMIT 1)")." AND type='PRIVATE'") ? ('fromuserid='.($fromisuserid ? "$" : "(SELECT userid FROM ^users WHERE handle=$ LIMIT 1)")." AND type='PRIVATE'")
: "type='PUBLIC'" : "type='PUBLIC'"
).' AND touserid='.($toisuserid ? "$" : "(SELECT userid FROM ^users WHERE handle=$ LIMIT 1)").' ORDER BY ^messages.created DESC LIMIT #', ).' AND touserid='.($toisuserid ? "$" : "(SELECT userid FROM ^users WHERE handle=$ LIMIT 1)").' ORDER BY ^messages.created DESC LIMIT #,#',
'arguments' => isset($fromidentifier) ? array($fromidentifier, $toidentifier, $count) : array($toidentifier, $count), 'arguments' => isset($fromidentifier) ? array($fromidentifier, $toidentifier, $start, $count) : array($toidentifier, $start, $count),
'arraykey' => 'messageid', 'arraykey' => 'messageid',
'sortdesc' => 'created', 'sortdesc' => 'created',
); );
...@@ -1431,6 +1435,10 @@ ...@@ -1431,6 +1435,10 @@
function qa_db_user_favorite_non_qs_selectspec($userid) function qa_db_user_favorite_non_qs_selectspec($userid)
/*
Return the selectspec to retrieve information about all a user's favorited items except the questions. Depending on
the type of item, the array for each item will contain a userid, category backpath or tag word.
*/
{ {
require_once QA_INCLUDE_DIR.'qa-app-updates.php'; require_once QA_INCLUDE_DIR.'qa-app-updates.php';
...@@ -1497,6 +1505,9 @@ ...@@ -1497,6 +1505,9 @@
function qa_db_user_limits_selectspec($userid) function qa_db_user_limits_selectspec($userid)
/*
Return the selectspec to retrieve all of the per-hour activity limits for user $userid
*/
{ {
return array( return array(
'columns' => array('action', 'period', 'count'), 'columns' => array('action', 'period', 'count'),
...@@ -1508,6 +1519,9 @@ ...@@ -1508,6 +1519,9 @@
function qa_db_ip_limits_selectspec($ip) function qa_db_ip_limits_selectspec($ip)
/*
Return the selectspec to retrieve all of the per-hour activity limits for ip address $ip
*/
{ {
return array( return array(
'columns' => array('action', 'period', 'count'), 'columns' => array('action', 'period', 'count'),
...@@ -1519,6 +1533,11 @@ ...@@ -1519,6 +1533,11 @@
function qa_db_user_levels_selectspec($identifier, $isuserid=QA_FINAL_EXTERNAL_USERS, $full=false) function qa_db_user_levels_selectspec($identifier, $isuserid=QA_FINAL_EXTERNAL_USERS, $full=false)
/*
Return the selectspec to retrieve all of the context specific (currently per-categpry) levels for the user identified by
$identifier, which is treated as a userid if $isuserid is true, otherwise as a handle. Set $full to true to obtain extra
information about these contexts (currently, categories).
*/
{ {
require_once QA_INCLUDE_DIR.'qa-app-updates.php'; require_once QA_INCLUDE_DIR.'qa-app-updates.php';
......
...@@ -287,6 +287,10 @@ ...@@ -287,6 +287,10 @@
function qa_db_user_levels_set($userid, $userlevels) function qa_db_user_levels_set($userid, $userlevels)
/*
Reset the full set of context-specific (currently, per category) user levels for user $userid to $userlevels, where
$userlevels is an array of arrays, the inner arrays containing items 'entitytype', 'entityid' and 'level'.
*/
{ {
qa_db_query_sub( qa_db_query_sub(
'DELETE FROM ^userlevels WHERE userid=$', 'DELETE FROM ^userlevels WHERE userid=$',
...@@ -314,6 +318,9 @@ ...@@ -314,6 +318,9 @@
function qa_db_uapprovecount_update() function qa_db_uapprovecount_update()
/*
Update the cached count of the number of users who are awaiting approval after registration
*/
{ {
if ( qa_should_update_counts() && !QA_FINAL_EXTERNAL_USERS ) if ( qa_should_update_counts() && !QA_FINAL_EXTERNAL_USERS )
qa_db_query_sub( qa_db_query_sub(
......
...@@ -133,6 +133,9 @@ ...@@ -133,6 +133,9 @@
function qa_db_uservoteflag_posts_get($postids) function qa_db_uservoteflag_posts_get($postids)
/*
Return information about all the non-zero votes and/or flags on the posts in postids, including user handles for internal user management
*/
{ {
if (QA_FINAL_EXTERNAL_USERS) if (QA_FINAL_EXTERNAL_USERS)
return qa_db_read_all_assoc(qa_db_query_sub( return qa_db_read_all_assoc(qa_db_query_sub(
......
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
$qa_db_fail_handler($type, $errno, $error, $query); $qa_db_fail_handler($type, $errno, $error, $query);
else { else {
echo '<HR><FONT COLOR="red">Database '.htmlspecialchars($type.' error '.$errno).'<P>'.nl2br(htmlspecialchars($error."\n\n".$query)); echo '<hr><font color="red">Database '.htmlspecialchars($type.' error '.$errno).'<p>'.nl2br(htmlspecialchars($error."\n\n".$query));
qa_exit('error'); qa_exit('error');
} }
} }
...@@ -403,6 +403,9 @@ ...@@ -403,6 +403,9 @@
function qa_db_list_tables() function qa_db_list_tables()
/*
Return an array of the names of all tables in the Q2A database
*/
{ {
return qa_db_read_all_values(qa_db_query_raw('SHOW TABLES')); return qa_db_read_all_values(qa_db_query_raw('SHOW TABLES'));
} }
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
{ {
return array( return array(
'type' => 'textarea', 'type' => 'textarea',
'tags' => 'NAME="'.$fieldname.'" ID="'.$fieldname.'"', 'tags' => 'name="'.$fieldname.'" id="'.$fieldname.'"',
'value' => qa_html($content), 'value' => qa_html($content),
'rows' => $rows, 'rows' => $rows,
); );
......
...@@ -69,9 +69,12 @@ ...@@ -69,9 +69,12 @@
break; break;
case 'u_message': case 'u_message':
case 'u_wall_post':
qa_limits_increment($userid, QA_LIMIT_MESSAGES); qa_limits_increment($userid, QA_LIMIT_MESSAGES);
break; break;
case 'u_wall_post':
qa_limits_increment($userid, QA_LIMIT_WALL_POSTS);
break;
} }
$writeactions=array( $writeactions=array(
......
...@@ -124,8 +124,8 @@ ...@@ -124,8 +124,8 @@
{ {
$publicusername=$logged_in_user['publicusername']; $publicusername=$logged_in_user['publicusername'];
return '<A HREF="'.htmlspecialchars($relative_url_prefix.'user/'.urlencode($publicusername)). return '<a href="'.htmlspecialchars($relative_url_prefix.'user/'.urlencode($publicusername)).
'" CLASS="qa-user-link">'.htmlspecialchars($publicusername).'</A>'; '" class="qa-user-link">'.htmlspecialchars($publicusername).'</a>';
} }
...@@ -141,8 +141,8 @@ ...@@ -141,8 +141,8 @@
$usershtml[$userid]=htmlspecialchars($publicusername); $usershtml[$userid]=htmlspecialchars($publicusername);
if ($should_include_link) if ($should_include_link)
$usershtml[$userid]='<A HREF="'.htmlspecialchars($relative_url_prefix.'user/'.urlencode($publicusername)). $usershtml[$userid]='<a href="'.htmlspecialchars($relative_url_prefix.'user/'.urlencode($publicusername)).
'" CLASS="qa-user-link">'.$usershtml[$userid].'</A>'; '" class="qa-user-link">'.$usershtml[$userid].'</a>';
} }
return $usershtml; return $usershtml;
......
...@@ -288,7 +288,7 @@ ...@@ -288,7 +288,7 @@
$lines=array(); $lines=array();
$lines[]='<?xml version="1.0" encoding="UTF-8"?>'; $lines[]='<?xml version="1.0" encoding="utf-8"?>';
$lines[]='<rss version="2.0">'; $lines[]='<rss version="2.0">';
$lines[]='<channel>'; $lines[]='<channel>';
......
...@@ -37,16 +37,16 @@ ...@@ -37,16 +37,16 @@
// Output start of HTML early, so we can see a nicely-formatted list of database queries when upgrading // Output start of HTML early, so we can see a nicely-formatted list of database queries when upgrading
?> ?>
<HTML> <html>
<HEAD> <head>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8">
<STYLE type="text/css"> <style type="text/css">
body,input {font-size:16px; font-family:Verdana, Arial, Helvetica, sans-serif;} body,input {font-size:16px; font-family:Verdana, Arial, Helvetica, sans-serif;}
body {text-align:center; width:640px; margin:64px auto;} body {text-align:center; width:640px; margin:64px auto;}
table {margin: 16px auto;} table {margin: 16px auto;}
</STYLE> </style>
</HEAD> </head>
<BODY> <body>
<?php <?php
...@@ -198,7 +198,7 @@ ...@@ -198,7 +198,7 @@
if (QA_FINAL_EXTERNAL_USERS) { if (QA_FINAL_EXTERNAL_USERS) {
if (defined('QA_FINAL_WORDPRESS_INTEGRATE_PATH')) if (defined('QA_FINAL_WORDPRESS_INTEGRATE_PATH'))
$errorhtml.="\n\nWhen you click below, your Question2Answer site will be set up to integrate with the users of your WordPress site <A HREF=\"".qa_html(get_option('home'))."\" TARGET=\"_blank\">".qa_html(get_option('blogname'))."</A>. Please consult the online documentation for more information."; $errorhtml.="\n\nWhen you click below, your Question2Answer site will be set up to integrate with the users of your WordPress site <a href=\"".qa_html(get_option('home'))."\" target=\"_blank\">".qa_html(get_option('blogname'))."</a>. Please consult the online documentation for more information.";
else else
$errorhtml.="\n\nWhen you click below, your Question2Answer site will be set up to integrate with your existing user database and management. Users will be referenced with database column type ".qa_html(qa_get_mysql_user_column_type()).". Please consult the online documentation for more information."; $errorhtml.="\n\nWhen you click below, your Question2Answer site will be set up to integrate with your existing user database and management. Users will be referenced with database column type ".qa_html(qa_get_mysql_user_column_type()).". Please consult the online documentation for more information.";
...@@ -275,49 +275,49 @@ ...@@ -275,49 +275,49 @@
if (empty($success)) if (empty($success))
$success='Your Question2Answer database has been checked with no problems.'; $success='Your Question2Answer database has been checked with no problems.';
$suggest='<A HREF="'.qa_path_html('admin', null, null, QA_URL_FORMAT_SAFEST).'">Go to admin center</A>'; $suggest='<a href="'.qa_path_html('admin', null, null, QA_URL_FORMAT_SAFEST).'">Go to admin center</a>';
} }
?> ?>
<FORM METHOD="POST" ACTION="<?php echo qa_path_html('install', null, null, QA_URL_FORMAT_SAFEST)?>"> <form method="post" action="<?php echo qa_path_html('install', null, null, QA_URL_FORMAT_SAFEST)?>">
<?php <?php
if (strlen($success)) if (strlen($success))
echo '<P><FONT COLOR="#006600">'.nl2br(qa_html($success)).'</FONT></P>'; // green echo '<p><font color="#006600">'.nl2br(qa_html($success)).'</font></p>'; // green
if (strlen($errorhtml)) if (strlen($errorhtml))
echo '<P><FONT COLOR="#990000">'.nl2br($errorhtml).'</FONT></P>'; // red echo '<p><font color="#990000">'.nl2br($errorhtml).'</font></p>'; // red
if (strlen($suggest)) if (strlen($suggest))
echo '<P>'.$suggest.'</P>'; echo '<p>'.$suggest.'</p>';
// Very simple general form display logic (we don't use theme since it depends on tons of DB options) // Very simple general form display logic (we don't use theme since it depends on tons of DB options)
if (count($fields)) { if (count($fields)) {
echo '<TABLE>'; echo '<table>';
foreach ($fields as $name => $prompt) { foreach ($fields as $name => $prompt) {
echo '<TR><TD>'.qa_html($prompt).'</TD><TD><INPUT TYPE="text" SIZE="24" NAME="'.qa_html($name).'" VALUE="'.qa_html(@${'in'.$name}).'"></TD>'; echo '<tr><td>'.qa_html($prompt).'</td><td><input type="text" size="24" name="'.qa_html($name).'" value="'.qa_html(@${'in'.$name}).'"></td>';
if (isset($fielderrors[$name])) if (isset($fielderrors[$name]))
echo '<TD><FONT COLOR="#990000"><SMALL>'.qa_html($fielderrors[$name]).'</SMALL></FONT></TD>'; echo '<td><font color="#990000"><small>'.qa_html($fielderrors[$name]).'</small></font></td>';
echo '</TR>'; echo '</tr>';
} }
echo '</TABLE>'; echo '</table>';
} }
foreach ($buttons as $name => $value) foreach ($buttons as $name => $value)
echo '<INPUT TYPE="submit" NAME="'.qa_html($name).'" VALUE="'.qa_html($value).'">'; echo '<input type="submit" name="'.qa_html($name).'" value="'.qa_html($value).'">';
foreach ($hidden as $name => $value) foreach ($hidden as $name => $value)
echo '<INPUT TYPE="hidden" NAME="'.qa_html($name).'" VALUE="'.qa_html($value).'">'; echo '<input type="hidden" name="'.qa_html($name).'" value="'.qa_html($value).'">';
qa_db_disconnect(); qa_db_disconnect();
?> ?>
</FORM> </form>
</BODY> </body>
</HTML> </html>
\ No newline at end of file \ No newline at end of file
...@@ -148,8 +148,8 @@ ...@@ -148,8 +148,8 @@
'recent_activity_title' => 'Recent activity', 'recent_activity_title' => 'Recent activity',
'recent_as_in_x' => 'Recently answered questions in ^', 'recent_as_in_x' => 'Recently answered questions in ^',
'recent_as_title' => 'Recently answered questions', 'recent_as_title' => 'Recently answered questions',
'recent_cs_in_x' => 'Recently added comments in ^', 'recent_cs_in_x' => 'Recently commented questions in ^',
'recent_cs_title' => 'Recently added comments', 'recent_cs_title' => 'Recently commented questions',
'recent_qs_as_in_x' => 'Recent questions and answers in ^', 'recent_qs_as_in_x' => 'Recent questions and answers in ^',
'recent_qs_as_title' => 'Recent questions and answers', 'recent_qs_as_title' => 'Recent questions and answers',
'recent_qs_in_x' => 'Recent questions in ^', 'recent_qs_in_x' => 'Recent questions in ^',
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
'message_empty' => 'Please enter your message to send to this user', 'message_empty' => 'Please enter your message to send to this user',
'message_explanation' => 'This will be sent as a notification from ^. Your email address will not be revealed unless you include it in the message.', 'message_explanation' => 'This will be sent as a notification from ^. Your email address will not be revealed unless you include it in the message.',
'message_for_x' => 'Your message for ^:', 'message_for_x' => 'Your message for ^:',
'message_limit' => 'Too many private messages sent - please try again in an hour', 'message_limit' => 'You cannot send more private messages this hour',
'message_must_login' => 'Please ^1log in^2 or ^3register^4 to send private messages.', 'message_must_login' => 'Please ^1log in^2 or ^3register^4 to send private messages.',
'message_recent_history' => 'Recent correspondence with ^', 'message_recent_history' => 'Recent correspondence with ^',
'message_sent' => 'Your private message below was sent', 'message_sent' => 'Your private message below was sent',
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
'nav_user_activity' => 'Recent activity', 'nav_user_activity' => 'Recent activity',
'nav_user_as' => 'All answers', 'nav_user_as' => 'All answers',
'nav_user_qs' => 'All questions', 'nav_user_qs' => 'All questions',
'nav_user_wall' => 'Wall',
'no_activity_from_x' => 'No activity from ^', 'no_activity_from_x' => 'No activity from ^',
'no_favorite_categories' => 'No favorite categories', 'no_favorite_categories' => 'No favorite categories',
'no_favorite_qs' => 'No favorite questions', 'no_favorite_qs' => 'No favorite questions',
......
...@@ -172,6 +172,7 @@ ...@@ -172,6 +172,7 @@
'page_size_tags' => 'Length of Tags page:', 'page_size_tags' => 'Length of Tags page:',
'page_size_una_qs' => 'Length of Unanswered page:', 'page_size_una_qs' => 'Length of Unanswered page:',
'page_size_users' => 'Length of Users page:', 'page_size_users' => 'Length of Users page:',
'page_size_wall' => 'Wall posts per page:',
'pages_prev_next' => 'Links to previous/next pages:', 'pages_prev_next' => 'Links to previous/next pages:',
'permit_admins' => 'Administrators', 'permit_admins' => 'Administrators',
'permit_all' => 'Anybody', 'permit_all' => 'Anybody',
...@@ -235,7 +236,7 @@ ...@@ -235,7 +236,7 @@
'show_custom_footer' => 'Custom HTML at bottom of every page:', 'show_custom_footer' => 'Custom HTML at bottom of every page:',
'show_custom_header' => 'Custom HTML at top of every page:', 'show_custom_header' => 'Custom HTML at top of every page:',
'show_custom_home' => 'Custom content in home page instead of Q&A', 'show_custom_home' => 'Custom content in home page instead of Q&A',
'show_custom_in_head' => 'Custom HTML in <HEAD> section of every page:', 'show_custom_in_head' => 'Custom HTML in <head> section of every page:',
'show_custom_register' => 'Custom message on register form - HTML allowed:', 'show_custom_register' => 'Custom message on register form - HTML allowed:',
'show_custom_sidebar' => 'Custom HTML in sidebar box on every page:', 'show_custom_sidebar' => 'Custom HTML in sidebar box on every page:',
'show_custom_sidepanel' => 'Custom HTML in side panel on every page:', 'show_custom_sidepanel' => 'Custom HTML in side panel on every page:',
...@@ -243,7 +244,7 @@ ...@@ -243,7 +244,7 @@
'show_fewer_cs_count' => 'If partially hidden, show most recent:', 'show_fewer_cs_count' => 'If partially hidden, show most recent:',
'show_fewer_cs_from' => 'Partially hide comments if more than:', 'show_fewer_cs_from' => 'Partially hide comments if more than:',
'show_full_date_days' => 'Show full date after:', 'show_full_date_days' => 'Show full date after:',
'show_home_description' => 'Include <META> description for home page:', 'show_home_description' => 'Include <meta> description for home page:',
'show_if_no_as' => 'If no answers', 'show_if_no_as' => 'If no answers',
'show_message_history' => 'Store and display private message history:', 'show_message_history' => 'Store and display private message history:',
'show_never' => 'Never', 'show_never' => 'Never',
......
...@@ -30,14 +30,13 @@ ...@@ -30,14 +30,13 @@
'1_up_vote' => '1 up vote', '1_up_vote' => '1 up vote',
'1_with_best_chosen' => ' (1 with best answer chosen)', '1_with_best_chosen' => ' (1 with best answer chosen)',
'activity_by_x' => 'Activity by ^', 'activity_by_x' => 'Activity by ^',
'answers' => 'Answers:',
'answers_by_x' => 'Answers by ^', 'answers_by_x' => 'Answers by ^',
'answers' => 'Answers:',
'bonus_points' => 'Bonus points:', 'bonus_points' => 'Bonus points:',
'comments' => 'Comments:', 'comments' => 'Comments:',
'delete_wall_post_popup' => 'Delete this wall post', 'delete_wall_post_popup' => 'Delete this wall post',
'extra_privileges' => 'Extra privileges:', 'extra_privileges' => 'Extra privileges:',
'gave_out' => 'Gave out:', 'gave_out' => 'Gave out:',
'wall_for_x' => 'Wall for ^',
'my_account_title' => 'My account details', 'my_account_title' => 'My account details',
'no_answers_by_x' => 'No answers by ^', 'no_answers_by_x' => 'No answers by ^',
'no_posts_by_x' => 'No posts by ^', 'no_posts_by_x' => 'No posts by ^',
...@@ -64,15 +63,15 @@ ...@@ -64,15 +63,15 @@
'permit_vote_a' => 'Voting on answers', 'permit_vote_a' => 'Voting on answers',
'permit_vote_down' => 'Voting posts down', 'permit_vote_down' => 'Voting posts down',
'permit_vote_q' => 'Voting on questions', 'permit_vote_q' => 'Voting on questions',
'post_wall_button' => 'Add wall post',
'post_wall_blocked' => 'This user has disallowed new posts on their wall', 'post_wall_blocked' => 'This user has disallowed new posts on their wall',
'post_wall_button' => 'Add wall post',
'post_wall_empty' => 'Please enter something to post on this wall', 'post_wall_empty' => 'Please enter something to post on this wall',
'post_wall_limit' => 'Too many wall posts created - please try again in an hour', 'post_wall_limit' => 'You cannot write more wall posts this hour',
'post_wall_must_be_approved' => 'Your account must be approved to post on this wall.', 'post_wall_must_be_approved' => 'Your account must be approved to post on this wall.',
'post_wall_must_login' => 'Please ^1log in^2 or ^3register^4 to post on this wall.',
'post_wall_must_confirm' => 'Please ^5confirm your email address^6 to post on this wall.', 'post_wall_must_confirm' => 'Please ^5confirm your email address^6 to post on this wall.',
'questions' => 'Questions:', 'post_wall_must_login' => 'Please ^1log in^2 or ^3register^4 to post on this wall.',
'questions_by_x' => 'Questions by ^', 'questions_by_x' => 'Questions by ^',
'questions' => 'Questions:',
'ranked_x' => ' (ranked #^)', 'ranked_x' => ' (ranked #^)',
'received' => 'Received:', 'received' => 'Received:',
'recent_activity_by_x' => 'Recent activity by ^', 'recent_activity_by_x' => 'Recent activity by ^',
...@@ -82,6 +81,8 @@ ...@@ -82,6 +81,8 @@
'title' => 'Title:', 'title' => 'Title:',
'user_x' => 'User ^', 'user_x' => 'User ^',
'voted_on' => 'Voted on:', 'voted_on' => 'Voted on:',
'wall_for_x' => 'Wall for ^',
'wall_view_more' => 'View more wall posts...',
'x_chosen_as_best' => ' (^ chosen as best)', 'x_chosen_as_best' => ' (^ chosen as best)',
'x_down_votes' => '^ down votes', 'x_down_votes' => '^ down votes',
'x_up_votes' => '^ up votes', 'x_up_votes' => '^ up votes',
......
...@@ -37,9 +37,10 @@ ...@@ -37,9 +37,10 @@
'avatar_none' => 'None', 'avatar_none' => 'None',
'block_user_button' => 'Block User', 'block_user_button' => 'Block User',
'blocked_users' => 'Blocked users', 'blocked_users' => 'Blocked users',
'category_level_add' => ' - ^1add per-category type^2', 'category_level_add' => ' - ^1add category-specific privileges^2',
'category_level_in' => 'in the category below:', 'category_level_in' => 'for the category below:',
'category_level_label' => 'Per-category type:', 'category_level_label' => 'Upgraded to:',
'category_level_none' => 'No upgrade',
'change_email_link' => ' - ^1change email^2', 'change_email_link' => ' - ^1change email^2',
'change_password' => 'Change Password', 'change_password' => 'Change Password',
'confirm_complete' => 'Thank you - your email address has been confirmed', 'confirm_complete' => 'Thank you - your email address has been confirmed',
......
...@@ -152,7 +152,7 @@ ...@@ -152,7 +152,7 @@
function vote_count($post) function vote_count($post)
{ {
$votersflaggers=$this->get_post_voters_flaggers($post['raw'], $post['raw']['postid']); $votersflaggers=$this->get_post_voters_flaggers($post['raw'], @$post['vote_opostid'] ? $post['raw']['opostid'] : $post['raw']['postid']);
$tooltip=''; $tooltip='';
...@@ -172,12 +172,12 @@ ...@@ -172,12 +172,12 @@
} }
if (strlen($tooltip)) if (strlen($tooltip))
$this->output('<SPAN TITLE="'.$tooltip.'">'); $this->output('<span title="'.$tooltip.'">');
qa_html_theme_base::vote_count($post); qa_html_theme_base::vote_count($post);
if (strlen($tooltip)) if (strlen($tooltip))
$this->output('</SPAN>'); $this->output('</span>');
} }
...@@ -199,12 +199,12 @@ ...@@ -199,12 +199,12 @@
} }
if (strlen($tooltip)) if (strlen($tooltip))
$this->output('<SPAN TITLE="&#9873; '.$tooltip.'">'); $this->output('<span title="&#9873; '.$tooltip.'">');
qa_html_theme_base::post_meta_flags($post, $class); qa_html_theme_base::post_meta_flags($post, $class);
if (strlen($tooltip)) if (strlen($tooltip))
$this->output('</SPAN>'); $this->output('</span>');
} }
} }
......
...@@ -203,7 +203,7 @@ ...@@ -203,7 +203,7 @@
$qa_content['error']=@$errors['page']; $qa_content['error']=@$errors['page'];
$qa_content['form_profile']=array( $qa_content['form_profile']=array(
'tags' => 'ENCTYPE="multipart/form-data" METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'enctype="multipart/form-data" method="post" action="'.qa_self_html().'"',
'style' => 'wide', 'style' => 'wide',
...@@ -222,7 +222,7 @@ ...@@ -222,7 +222,7 @@
'handle' => array( 'handle' => array(
'label' => qa_lang_html('users/handle_label'), 'label' => qa_lang_html('users/handle_label'),
'tags' => 'NAME="handle"', 'tags' => 'name="handle"',
'value' => qa_html(isset($inhandle) ? $inhandle : $useraccount['handle']), 'value' => qa_html(isset($inhandle) ? $inhandle : $useraccount['handle']),
'error' => qa_html(@$errors['handle']), 'error' => qa_html(@$errors['handle']),
'type' => $changehandle ? 'text' : 'static', 'type' => $changehandle ? 'text' : 'static',
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
'email' => array( 'email' => array(
'label' => qa_lang_html('users/email_label'), 'label' => qa_lang_html('users/email_label'),
'tags' => 'NAME="email"', 'tags' => 'name="email"',
'value' => qa_html(isset($inemail) ? $inemail : $useraccount['email']), 'value' => qa_html(isset($inemail) ? $inemail : $useraccount['email']),
'error' => isset($errors['email']) ? qa_html($errors['email']) : 'error' => isset($errors['email']) ? qa_html($errors['email']) :
(($doconfirms && !$isconfirmed) ? qa_insert_login_links(qa_lang_html('users/email_please_confirm')) : null), (($doconfirms && !$isconfirmed) ? qa_insert_login_links(qa_lang_html('users/email_please_confirm')) : null),
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
'messages' => array( 'messages' => array(
'label' => qa_lang_html('users/private_messages'), 'label' => qa_lang_html('users/private_messages'),
'tags' => 'NAME="messages"', 'tags' => 'name="messages"',
'type' => 'checkbox', 'type' => 'checkbox',
'value' => !($useraccount['flags'] & QA_USER_FLAGS_NO_MESSAGES), 'value' => !($useraccount['flags'] & QA_USER_FLAGS_NO_MESSAGES),
'note' => qa_lang_html('users/private_messages_explanation'), 'note' => qa_lang_html('users/private_messages_explanation'),
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
'wall' => array( 'wall' => array(
'label' => qa_lang_html('users/wall_posts'), 'label' => qa_lang_html('users/wall_posts'),
'tags' => 'NAME="wall"', 'tags' => 'name="wall"',
'type' => 'checkbox', 'type' => 'checkbox',
'value' => !($useraccount['flags'] & QA_USER_FLAGS_NO_WALL_POSTS), 'value' => !($useraccount['flags'] & QA_USER_FLAGS_NO_WALL_POSTS),
'note' => qa_lang_html('users/wall_posts_explanation'), 'note' => qa_lang_html('users/wall_posts_explanation'),
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
'mailings' => array( 'mailings' => array(
'label' => qa_lang_html('users/mass_mailings'), 'label' => qa_lang_html('users/mass_mailings'),
'tags' => 'NAME="mailings"', 'tags' => 'name="mailings"',
'type' => 'checkbox', 'type' => 'checkbox',
'value' => !($useraccount['flags'] & QA_USER_FLAGS_NO_MAILINGS), 'value' => !($useraccount['flags'] & QA_USER_FLAGS_NO_MAILINGS),
'note' => qa_lang_html('users/mass_mailings_explanation'), 'note' => qa_lang_html('users/mass_mailings_explanation'),
...@@ -265,7 +265,7 @@ ...@@ -265,7 +265,7 @@
'buttons' => array( 'buttons' => array(
'save' => array( 'save' => array(
'tags' => 'onClick="qa_show_waiting_after(this, false);"', 'tags' => 'onclick="qa_show_waiting_after(this, false);"',
'label' => qa_lang_html('users/save_profile'), 'label' => qa_lang_html('users/save_profile'),
), ),
), ),
...@@ -295,32 +295,32 @@ ...@@ -295,32 +295,32 @@
$avataroptions=array(); $avataroptions=array();
if (qa_opt('avatar_default_show') && strlen(qa_opt('avatar_default_blobid'))) { if (qa_opt('avatar_default_show') && strlen(qa_opt('avatar_default_blobid'))) {
$avataroptions['']='<SPAN STYLE="margin:2px 0; display:inline-block;">'. $avataroptions['']='<span style="margin:2px 0; display:inline-block;">'.
qa_get_avatar_blob_html(qa_opt('avatar_default_blobid'), qa_opt('avatar_default_width'), qa_opt('avatar_default_height'), 32). qa_get_avatar_blob_html(qa_opt('avatar_default_blobid'), qa_opt('avatar_default_width'), qa_opt('avatar_default_height'), 32).
'</SPAN> '.qa_lang_html('users/avatar_default'); '</span> '.qa_lang_html('users/avatar_default');
} else } else
$avataroptions['']=qa_lang_html('users/avatar_none'); $avataroptions['']=qa_lang_html('users/avatar_none');
$avatarvalue=$avataroptions['']; $avatarvalue=$avataroptions[''];
if (qa_opt('avatar_allow_gravatar')) { if (qa_opt('avatar_allow_gravatar')) {
$avataroptions['gravatar']='<SPAN STYLE="margin:2px 0; display:inline-block;">'. $avataroptions['gravatar']='<span style="margin:2px 0; display:inline-block;">'.
qa_get_gravatar_html($useraccount['email'], 32).' '.strtr(qa_lang_html('users/avatar_gravatar'), array( qa_get_gravatar_html($useraccount['email'], 32).' '.strtr(qa_lang_html('users/avatar_gravatar'), array(
'^1' => '<A HREF="http://www.gravatar.com/" TARGET="_blank">', '^1' => '<a href="http://www.gravatar.com/" target="_blank">',
'^2' => '</A>', '^2' => '</a>',
)).'</SPAN>'; )).'</span>';
if ($useraccount['flags'] & QA_USER_FLAGS_SHOW_GRAVATAR) if ($useraccount['flags'] & QA_USER_FLAGS_SHOW_GRAVATAR)
$avatarvalue=$avataroptions['gravatar']; $avatarvalue=$avataroptions['gravatar'];
} }
if (qa_has_gd_image() && qa_opt('avatar_allow_upload')) { if (qa_has_gd_image() && qa_opt('avatar_allow_upload')) {
$avataroptions['uploaded']='<INPUT NAME="file" TYPE="file">'; $avataroptions['uploaded']='<input name="file" type="file">';
if (isset($useraccount['avatarblobid'])) if (isset($useraccount['avatarblobid']))
$avataroptions['uploaded']='<SPAN STYLE="margin:2px 0; display:inline-block;">'. $avataroptions['uploaded']='<span style="margin:2px 0; display:inline-block;">'.
qa_get_avatar_blob_html($useraccount['avatarblobid'], $useraccount['avatarwidth'], $useraccount['avatarheight'], 32). qa_get_avatar_blob_html($useraccount['avatarblobid'], $useraccount['avatarwidth'], $useraccount['avatarheight'], 32).
'</SPAN>'.$avataroptions['uploaded']; '</span>'.$avataroptions['uploaded'];
if ($useraccount['flags'] & QA_USER_FLAGS_SHOW_AVATAR) if ($useraccount['flags'] & QA_USER_FLAGS_SHOW_AVATAR)
$avatarvalue=$avataroptions['uploaded']; $avatarvalue=$avataroptions['uploaded'];
...@@ -329,7 +329,7 @@ ...@@ -329,7 +329,7 @@
$qa_content['form_profile']['fields']['avatar']=array( $qa_content['form_profile']['fields']['avatar']=array(
'type' => 'select-radio', 'type' => 'select-radio',
'label' => qa_lang_html('users/avatar_label'), 'label' => qa_lang_html('users/avatar_label'),
'tags' => 'NAME="avatar"', 'tags' => 'name="avatar"',
'options' => $avataroptions, 'options' => $avataroptions,
'value' => $avatarvalue, 'value' => $avatarvalue,
'error' => qa_html(@$errors['avatar']), 'error' => qa_html(@$errors['avatar']),
...@@ -352,7 +352,7 @@ ...@@ -352,7 +352,7 @@
$qa_content['form_profile']['fields'][$userfield['title']]=array( $qa_content['form_profile']['fields'][$userfield['title']]=array(
'label' => qa_html($label), 'label' => qa_html($label),
'tags' => 'NAME="field_'.$userfield['fieldid'].'"', 'tags' => 'name="field_'.$userfield['fieldid'].'"',
'value' => qa_html($value), 'value' => qa_html($value),
'error' => qa_html(@$errors[$userfield['fieldid']]), 'error' => qa_html(@$errors[$userfield['fieldid']]),
'rows' => ($userfield['flags'] & QA_FIELD_FLAGS_MULTI_LINE) ? 8 : null, 'rows' => ($userfield['flags'] & QA_FIELD_FLAGS_MULTI_LINE) ? 8 : null,
...@@ -370,7 +370,7 @@ ...@@ -370,7 +370,7 @@
// Change password form // Change password form
$qa_content['form_password']=array( $qa_content['form_password']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'style' => 'wide', 'style' => 'wide',
...@@ -379,7 +379,7 @@ ...@@ -379,7 +379,7 @@
'fields' => array( 'fields' => array(
'old' => array( 'old' => array(
'label' => qa_lang_html('users/old_password'), 'label' => qa_lang_html('users/old_password'),
'tags' => 'NAME="oldpassword"', 'tags' => 'name="oldpassword"',
'value' => qa_html(@$inoldpassword), 'value' => qa_html(@$inoldpassword),
'type' => 'password', 'type' => 'password',
'error' => qa_html(@$errors['oldpassword']), 'error' => qa_html(@$errors['oldpassword']),
...@@ -387,14 +387,14 @@ ...@@ -387,14 +387,14 @@
'new_1' => array( 'new_1' => array(
'label' => qa_lang_html('users/new_password_1'), 'label' => qa_lang_html('users/new_password_1'),
'tags' => 'NAME="newpassword1"', 'tags' => 'name="newpassword1"',
'type' => 'password', 'type' => 'password',
'error' => qa_html(@$errors['password']), 'error' => qa_html(@$errors['password']),
), ),
'new_2' => array( 'new_2' => array(
'label' => qa_lang_html('users/new_password_2'), 'label' => qa_lang_html('users/new_password_2'),
'tags' => 'NAME="newpassword2"', 'tags' => 'name="newpassword2"',
'type' => 'password', 'type' => 'password',
'error' => qa_html(@$errors['newpassword2']), 'error' => qa_html(@$errors['newpassword2']),
), ),
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
$qa_content['message_list']=array( $qa_content['message_list']=array(
'form' => array( 'form' => array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'hidden' => array( 'hidden' => array(
'code' => qa_get_form_security_code('admin/click'), 'code' => qa_get_form_security_code('admin/click'),
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
foreach ($users as $user) { foreach ($users as $user) {
$message=array(); $message=array();
$message['tags']='ID="p'.qa_html($user['userid']).'"'; // use p prefix for qa_admin_click() in qa-admin.js $message['tags']='id="p'.qa_html($user['userid']).'"'; // use p prefix for qa_admin_click() in qa-admin.js
$message['content']=qa_lang_html('users/registered_label').' '. $message['content']=qa_lang_html('users/registered_label').' '.
strtr(qa_lang_html('users/x_ago_from_y'), array( strtr(qa_lang_html('users/x_ago_from_y'), array(
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
$htmlemail=qa_html($user['email']); $htmlemail=qa_html($user['email']);
$message['content'].=qa_lang_html('users/email_label').' <A HREF="mailto:'.$htmlemail.'">'.$htmlemail.'</A>'; $message['content'].=qa_lang_html('users/email_label').' <a href="mailto:'.$htmlemail.'">'.$htmlemail.'</a>';
foreach ($userfields as $userfield) foreach ($userfields as $userfield)
if (strlen(@$user['profile'][$userfield['title']])) if (strlen(@$user['profile'][$userfield['title']]))
...@@ -109,12 +109,12 @@ ...@@ -109,12 +109,12 @@
'buttons' => array( 'buttons' => array(
'approve' => array( 'approve' => array(
'tags' => 'NAME="admin_'.$user['userid'].'_userapprove" onclick="return qa_admin_click(this);"', 'tags' => 'name="admin_'.$user['userid'].'_userapprove" onclick="return qa_admin_click(this);"',
'label' => qa_lang_html('question/approve_button'), 'label' => qa_lang_html('question/approve_button'),
), ),
'block' => array( 'block' => array(
'tags' => 'NAME="admin_'.$user['userid'].'_userblock" onclick="return qa_admin_click(this);"', 'tags' => 'name="admin_'.$user['userid'].'_userblock" onclick="return qa_admin_click(this);"',
'label' => qa_lang_html('admin/block_button'), 'label' => qa_lang_html('admin/block_button'),
), ),
), ),
......
...@@ -247,7 +247,7 @@ ...@@ -247,7 +247,7 @@
if ($setmissing) { if ($setmissing) {
$qa_content['form']=array( $qa_content['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_path_html(qa_request()).'"', 'tags' => 'method="post" action="'.qa_path_html(qa_request()).'"',
'style' => 'tall', 'style' => 'tall',
...@@ -266,7 +266,7 @@ ...@@ -266,7 +266,7 @@
), ),
'cancel' => array( 'cancel' => array(
'tags' => 'NAME="docancel"', 'tags' => 'name="docancel"',
'label' => qa_lang_html('main/cancel_button'), 'label' => qa_lang_html('main/cancel_button'),
), ),
), ),
...@@ -286,7 +286,7 @@ ...@@ -286,7 +286,7 @@
} elseif (isset($editcategory)) { } elseif (isset($editcategory)) {
$qa_content['form']=array( $qa_content['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_path_html(qa_request()).'"', 'tags' => 'method="post" action="'.qa_path_html(qa_request()).'"',
'style' => 'tall', 'style' => 'tall',
...@@ -295,7 +295,7 @@ ...@@ -295,7 +295,7 @@
'fields' => array( 'fields' => array(
'name' => array( 'name' => array(
'id' => 'name_display', 'id' => 'name_display',
'tags' => 'NAME="name" ID="name"', 'tags' => 'name="name" id="name"',
'label' => qa_lang_html(count($categories) ? 'admin/category_name' : 'admin/category_name_first'), 'label' => qa_lang_html(count($categories) ? 'admin/category_name' : 'admin/category_name_first'),
'value' => qa_html(isset($inname) ? $inname : @$editcategory['title']), 'value' => qa_html(isset($inname) ? $inname : @$editcategory['title']),
'error' => qa_html(@$errors['name']), 'error' => qa_html(@$errors['name']),
...@@ -309,7 +309,7 @@ ...@@ -309,7 +309,7 @@
'slug' => array( 'slug' => array(
'id' => 'slug_display', 'id' => 'slug_display',
'tags' => 'NAME="slug"', 'tags' => 'name="slug"',
'label' => qa_lang_html('admin/category_slug'), 'label' => qa_lang_html('admin/category_slug'),
'value' => qa_html(isset($inslug) ? $inslug : @$editcategory['tags']), 'value' => qa_html(isset($inslug) ? $inslug : @$editcategory['tags']),
'error' => qa_html(@$errors['slug']), 'error' => qa_html(@$errors['slug']),
...@@ -317,7 +317,7 @@ ...@@ -317,7 +317,7 @@
'content' => array( 'content' => array(
'id' => 'content_display', 'id' => 'content_display',
'tags' => 'NAME="content"', 'tags' => 'name="content"',
'label' => qa_lang_html('admin/category_description'), 'label' => qa_lang_html('admin/category_description'),
'value' => qa_html(isset($incontent) ? $incontent : @$editcategory['content']), 'value' => qa_html(isset($incontent) ? $incontent : @$editcategory['content']),
'error' => qa_html(@$errors['content']), 'error' => qa_html(@$errors['content']),
...@@ -331,7 +331,7 @@ ...@@ -331,7 +331,7 @@
), ),
'cancel' => array( 'cancel' => array(
'tags' => 'NAME="docancel"', 'tags' => 'name="docancel"',
'label' => qa_lang_html('main/cancel_button'), 'label' => qa_lang_html('main/cancel_button'),
), ),
), ),
...@@ -374,17 +374,17 @@ ...@@ -374,17 +374,17 @@
} else { } else {
$qa_content['form']['fields']['delete']=array( $qa_content['form']['fields']['delete']=array(
'tags' => 'NAME="dodelete" ID="dodelete"', 'tags' => 'name="dodelete" id="dodelete"',
'label' => 'label' =>
'<SPAN ID="reassign_shown">'.qa_lang_html('admin/delete_category_reassign').'</SPAN>'. '<span id="reassign_shown">'.qa_lang_html('admin/delete_category_reassign').'</span>'.
'<SPAN ID="reassign_hidden" STYLE="display:none;">'.qa_lang_html('admin/delete_category').'</SPAN>', '<span id="reassign_hidden" style="display:none;">'.qa_lang_html('admin/delete_category').'</span>',
'value' => 0, 'value' => 0,
'type' => 'checkbox', 'type' => 'checkbox',
); );
$qa_content['form']['fields']['reassign']=array( $qa_content['form']['fields']['reassign']=array(
'id' => 'reassign_display', 'id' => 'reassign_display',
'tags' => 'NAME="reassign"', 'tags' => 'name="reassign"',
); );
qa_set_up_category_field($qa_content, $qa_content['form']['fields']['reassign'], 'reassign', qa_set_up_category_field($qa_content, $qa_content['form']['fields']['reassign'], 'reassign',
...@@ -394,11 +394,11 @@ ...@@ -394,11 +394,11 @@
$qa_content['form']['fields']['questions']=array( $qa_content['form']['fields']['questions']=array(
'label' => qa_lang_html('admin/total_qs'), 'label' => qa_lang_html('admin/total_qs'),
'type' => 'static', 'type' => 'static',
'value' => '<A HREF="'.qa_path_html('questions/'.qa_category_path_request($categories, $editcategory['categoryid'])).'">'. 'value' => '<a href="'.qa_path_html('questions/'.qa_category_path_request($categories, $editcategory['categoryid'])).'">'.
( ($editcategory['qcount']==1) ( ($editcategory['qcount']==1)
? qa_lang_html_sub('main/1_question', '1', '1') ? qa_lang_html_sub('main/1_question', '1', '1')
: qa_lang_html_sub('main/x_questions', number_format($editcategory['qcount'])) : qa_lang_html_sub('main/x_questions', number_format($editcategory['qcount']))
).'</A>', ).'</a>',
); );
if ($hassubcategory && !qa_opt('allow_no_sub_category')) { if ($hassubcategory && !qa_opt('allow_no_sub_category')) {
...@@ -408,8 +408,8 @@ ...@@ -408,8 +408,8 @@
$qa_content['form']['fields']['questions']['error']= $qa_content['form']['fields']['questions']['error']=
strtr(qa_lang_html('admin/category_no_sub_error'), array( strtr(qa_lang_html('admin/category_no_sub_error'), array(
'^q' => number_format($nosubcount), '^q' => number_format($nosubcount),
'^1' => '<A HREF="'.qa_path_html(qa_request(), array('edit' => $editcategory['categoryid'], 'missing' => 1)).'">', '^1' => '<a href="'.qa_path_html(qa_request(), array('edit' => $editcategory['categoryid'], 'missing' => 1)).'">',
'^2' => '</A>', '^2' => '</a>',
)); ));
} }
...@@ -445,13 +445,13 @@ ...@@ -445,13 +445,13 @@
); );
$qa_content['form']['fields']['parent']['value']= $qa_content['form']['fields']['parent']['value']=
'<A HREF="'.qa_path_html(qa_request(), array('edit' => @$editcategory['parentid'])).'">'. '<a href="'.qa_path_html(qa_request(), array('edit' => @$editcategory['parentid'])).'">'.
$qa_content['form']['fields']['parent']['value'].'</A>'; $qa_content['form']['fields']['parent']['value'].'</a>';
if (isset($editcategory['categoryid'])) if (isset($editcategory['categoryid']))
$qa_content['form']['fields']['parent']['value'].=' - '. $qa_content['form']['fields']['parent']['value'].=' - '.
'<A HREF="'.qa_path_html(qa_request(), array('edit' => $editcategory['categoryid'], 'setparent' => 1)). '<a href="'.qa_path_html(qa_request(), array('edit' => $editcategory['categoryid'], 'setparent' => 1)).
'" STYLE="white-space: nowrap;"><SPAN>'.qa_lang_html('admin/category_move_parent').'</A>'; '" style="white-space: nowrap;">'.qa_lang_html('admin/category_move_parent').'</a>';
} }
$positionoptions=array(); $positionoptions=array();
...@@ -484,7 +484,7 @@ ...@@ -484,7 +484,7 @@
$qa_content['form']['fields']['position']=array( $qa_content['form']['fields']['position']=array(
'id' => 'position_display', 'id' => 'position_display',
'tags' => 'NAME="position"', 'tags' => 'name="position"',
'label' => qa_lang_html('admin/position'), 'label' => qa_lang_html('admin/position'),
'type' => 'select', 'type' => 'select',
'options' => $positionoptions, 'options' => $positionoptions,
...@@ -500,14 +500,14 @@ ...@@ -500,14 +500,14 @@
foreach ($categories as $category) foreach ($categories as $category)
if (!strcmp($category['parentid'], $editcategory['categoryid'])) if (!strcmp($category['parentid'], $editcategory['categoryid']))
$childrenhtml.=(strlen($childrenhtml) ? ', ' : ''). $childrenhtml.=(strlen($childrenhtml) ? ', ' : '').
'<A HREF="'.qa_path_html(qa_request(), array('edit' => $category['categoryid'])).'">'.qa_html($category['title']).'</A>'. '<a href="'.qa_path_html(qa_request(), array('edit' => $category['categoryid'])).'">'.qa_html($category['title']).'</a>'.
' ('.$category['qcount'].')'; ' ('.$category['qcount'].')';
if (!strlen($childrenhtml)) if (!strlen($childrenhtml))
$childrenhtml=qa_lang_html('admin/category_no_subs'); $childrenhtml=qa_lang_html('admin/category_no_subs');
$childrenhtml.=' - <A HREF="'.qa_path_html(qa_request(), array('addsub' => $editcategory['categoryid'])). $childrenhtml.=' - <a href="'.qa_path_html(qa_request(), array('addsub' => $editcategory['categoryid'])).
'" STYLE="white-space: nowrap;"><B>'.qa_lang_html('admin/category_add_sub').'</B></A>'; '" style="white-space: nowrap;"><b>'.qa_lang_html('admin/category_add_sub').'</b></a>';
$qa_content['form']['fields']['children']=array( $qa_content['form']['fields']['children']=array(
'id' => 'children_display', 'id' => 'children_display',
...@@ -524,7 +524,7 @@ ...@@ -524,7 +524,7 @@
} else { } else {
$qa_content['form']=array( $qa_content['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_path_html(qa_request()).'"', 'tags' => 'method="post" action="'.qa_path_html(qa_request()).'"',
'ok' => $savedoptions ? qa_lang_html('admin/options_saved') : null, 'ok' => $savedoptions ? qa_lang_html('admin/options_saved') : null,
...@@ -539,12 +539,12 @@ ...@@ -539,12 +539,12 @@
'buttons' => array( 'buttons' => array(
'save' => array( 'save' => array(
'tags' => 'NAME="dosaveoptions"', 'tags' => 'name="dosaveoptions"',
'label' => qa_lang_html('main/save_button'), 'label' => qa_lang_html('main/save_button'),
), ),
'add' => array( 'add' => array(
'tags' => 'NAME="doaddcategory"', 'tags' => 'name="doaddcategory"',
'label' => qa_lang_html('admin/add_category_button'), 'label' => qa_lang_html('admin/add_category_button'),
), ),
), ),
...@@ -561,8 +561,8 @@ ...@@ -561,8 +561,8 @@
foreach ($categories as $category) foreach ($categories as $category)
if (!isset($category['parentid'])) if (!isset($category['parentid']))
$navcategoryhtml.='<A HREF="'.qa_path_html('admin/categories', array('edit' => $category['categoryid'])).'">'. $navcategoryhtml.='<a href="'.qa_path_html('admin/categories', array('edit' => $category['categoryid'])).'">'.
qa_html($category['title']).'</A> - '.qa_lang_html_sub('main/x_questions', $category['qcount']).'<BR/>'; qa_html($category['title']).'</a> - '.qa_lang_html_sub('main/x_questions', $category['qcount']).'<br/>';
$qa_content['form']['fields']['nav']=array( $qa_content['form']['fields']['nav']=array(
'label' => qa_lang_html('admin/top_level_categories'), 'label' => qa_lang_html('admin/top_level_categories'),
...@@ -572,7 +572,7 @@ ...@@ -572,7 +572,7 @@
$qa_content['form']['fields']['allow_no_category']=array( $qa_content['form']['fields']['allow_no_category']=array(
'label' => qa_lang_html('options/allow_no_category'), 'label' => qa_lang_html('options/allow_no_category'),
'tags' => 'NAME="option_allow_no_category"', 'tags' => 'name="option_allow_no_category"',
'type' => 'checkbox', 'type' => 'checkbox',
'value' => qa_opt('allow_no_category'), 'value' => qa_opt('allow_no_category'),
); );
...@@ -584,14 +584,14 @@ ...@@ -584,14 +584,14 @@
$qa_content['form']['fields']['allow_no_category']['error']= $qa_content['form']['fields']['allow_no_category']['error']=
strtr(qa_lang_html('admin/category_none_error'), array( strtr(qa_lang_html('admin/category_none_error'), array(
'^q' => number_format($nocatcount), '^q' => number_format($nocatcount),
'^1' => '<A HREF="'.qa_path_html(qa_request(), array('missing' => 1)).'">', '^1' => '<a href="'.qa_path_html(qa_request(), array('missing' => 1)).'">',
'^2' => '</A>', '^2' => '</a>',
)); ));
} }
$qa_content['form']['fields']['allow_no_sub_category']=array( $qa_content['form']['fields']['allow_no_sub_category']=array(
'label' => qa_lang_html('options/allow_no_sub_category'), 'label' => qa_lang_html('options/allow_no_sub_category'),
'tags' => 'NAME="option_allow_no_sub_category"', 'tags' => 'name="option_allow_no_sub_category"',
'type' => 'checkbox', 'type' => 'checkbox',
'value' => qa_opt('allow_no_sub_category'), 'value' => qa_opt('allow_no_sub_category'),
); );
...@@ -601,7 +601,7 @@ ...@@ -601,7 +601,7 @@
} }
if (qa_get('recalc')) { if (qa_get('recalc')) {
$qa_content['form']['ok']='<SPAN ID="recalc_ok">'.qa_lang_html('admin/recalc_categories').'</SPAN>'; $qa_content['form']['ok']='<span id="recalc_ok">'.qa_lang_html('admin/recalc_categories').'</span>';
$qa_content['script_rel'][]='qa-content/qa-admin.js?'.QA_VERSION; $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_var']['qa_warning_recalc']=qa_lang('admin/stop_recalc_warning');
......
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
$qa_content['q_list']=array( $qa_content['q_list']=array(
'form' => array( 'form' => array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'hidden' => array( 'hidden' => array(
'code' => qa_get_form_security_code('admin/click'), 'code' => qa_get_form_security_code('admin/click'),
...@@ -99,6 +99,7 @@ ...@@ -99,6 +99,7 @@
$htmloptions['voteview']=false; $htmloptions['voteview']=false;
$htmloptions['tagsview']=($question['obasetype']=='Q'); $htmloptions['tagsview']=($question['obasetype']=='Q');
$htmloptions['answersview']=false; $htmloptions['answersview']=false;
$htmloptions['viewsview']=false;
$htmloptions['contentview']=true; $htmloptions['contentview']=true;
$htmloptions['flagsview']=true; $htmloptions['flagsview']=true;
$htmloptions['elementid']=$elementid; $htmloptions['elementid']=$elementid;
...@@ -113,12 +114,12 @@ ...@@ -113,12 +114,12 @@
'buttons' => array( 'buttons' => array(
'clearflags' => array( 'clearflags' => array(
'tags' => 'NAME="admin_'.$postid.'_clearflags" onclick="return qa_admin_click(this);"', 'tags' => 'name="admin_'.$postid.'_clearflags" onclick="return qa_admin_click(this);"',
'label' => qa_lang_html('question/clear_flags_button'), 'label' => qa_lang_html('question/clear_flags_button'),
), ),
'hide' => array( 'hide' => array(
'tags' => 'NAME="admin_'.$postid.'_hide" onclick="return qa_admin_click(this);"', 'tags' => 'name="admin_'.$postid.'_hide" onclick="return qa_admin_click(this);"',
'label' => qa_lang_html('question/hide_button'), 'label' => qa_lang_html('question/hide_button'),
), ),
), ),
......
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
$qa_content['q_list']=array( $qa_content['q_list']=array(
'form' => array( 'form' => array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'hidden' => array( 'hidden' => array(
'code' => qa_get_form_security_code('admin/click'), 'code' => qa_get_form_security_code('admin/click'),
...@@ -111,6 +111,7 @@ ...@@ -111,6 +111,7 @@
$htmloptions['voteview']=false; $htmloptions['voteview']=false;
$htmloptions['tagsview']=!isset($question['opostid']); $htmloptions['tagsview']=!isset($question['opostid']);
$htmloptions['answersview']=false; $htmloptions['answersview']=false;
$htmloptions['viewsview']=false;
$htmloptions['updateview']=false; $htmloptions['updateview']=false;
$htmloptions['contentview']=true; $htmloptions['contentview']=true;
$htmloptions['flagsview']=true; $htmloptions['flagsview']=true;
...@@ -130,13 +131,13 @@ ...@@ -130,13 +131,13 @@
if (!qa_user_post_permit_error('permit_hide_show', $question)) if (!qa_user_post_permit_error('permit_hide_show', $question))
$buttons['reshow']=array( $buttons['reshow']=array(
'tags' => 'NAME="admin_'.qa_html($qhiddenpostid[$key]).'_reshow" onclick="return qa_admin_click(this);"', 'tags' => 'name="admin_'.qa_html($qhiddenpostid[$key]).'_reshow" onclick="return qa_admin_click(this);"',
'label' => qa_lang_html('question/reshow_button'), 'label' => qa_lang_html('question/reshow_button'),
); );
if ((!qa_user_post_permit_error('permit_delete_hidden', $question)) && !$dependcounts[$qhiddenpostid[$key]]) if ((!qa_user_post_permit_error('permit_delete_hidden', $question)) && !$dependcounts[$qhiddenpostid[$key]])
$buttons['delete']=array( $buttons['delete']=array(
'tags' => 'NAME="admin_'.qa_html($qhiddenpostid[$key]).'_delete" onclick="return qa_admin_click(this);"', 'tags' => 'name="admin_'.qa_html($qhiddenpostid[$key]).'_delete" onclick="return qa_admin_click(this);"',
'label' => qa_lang_html('question/delete_button'), 'label' => qa_lang_html('question/delete_button'),
); );
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
$qa_content['q_list']=array( $qa_content['q_list']=array(
'form' => array( 'form' => array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'hidden' => array( 'hidden' => array(
'code' => qa_get_form_security_code('admin/click'), 'code' => qa_get_form_security_code('admin/click'),
...@@ -102,6 +102,7 @@ ...@@ -102,6 +102,7 @@
$htmloptions['voteview']=false; $htmloptions['voteview']=false;
$htmloptions['tagsview']=!isset($question['opostid']); $htmloptions['tagsview']=!isset($question['opostid']);
$htmloptions['answersview']=false; $htmloptions['answersview']=false;
$htmloptions['viewsview']=false;
$htmloptions['contentview']=true; $htmloptions['contentview']=true;
$htmloptions['elementid']=$elementid; $htmloptions['elementid']=$elementid;
...@@ -115,12 +116,12 @@ ...@@ -115,12 +116,12 @@
'buttons' => array( 'buttons' => array(
'approve' => array( 'approve' => array(
'tags' => 'NAME="admin_'.$postid.'_approve" onclick="return qa_admin_click(this);"', 'tags' => 'name="admin_'.$postid.'_approve" onclick="return qa_admin_click(this);"',
'label' => qa_lang_html('question/approve_button'), 'label' => qa_lang_html('question/approve_button'),
), ),
'reject' => array( 'reject' => array(
'tags' => 'NAME="admin_'.$postid.'_reject" onclick="return qa_admin_click(this);"', 'tags' => 'name="admin_'.$postid.'_reject" onclick="return qa_admin_click(this);"',
'label' => qa_lang_html('question/reject_button'), 'label' => qa_lang_html('question/reject_button'),
), ),
), ),
......
...@@ -340,20 +340,20 @@ ...@@ -340,20 +340,20 @@
$permitvalue=@$permitoptions[isset($inpermit) ? $inpermit : $editpage['permit']]; $permitvalue=@$permitoptions[isset($inpermit) ? $inpermit : $editpage['permit']];
$qa_content['form']=array( $qa_content['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_path_html(qa_request()).'"', 'tags' => 'method="post" action="'.qa_path_html(qa_request()).'"',
'style' => 'tall', 'style' => 'tall',
'fields' => array( 'fields' => array(
'name' => array( 'name' => array(
'tags' => 'NAME="name" ID="name"', 'tags' => 'name="name" id="name"',
'label' => qa_lang_html($isexternal ? 'admin/link_name' : 'admin/page_name'), 'label' => qa_lang_html($isexternal ? 'admin/link_name' : 'admin/page_name'),
'value' => qa_html(isset($inname) ? $inname : @$editpage['title']), 'value' => qa_html(isset($inname) ? $inname : @$editpage['title']),
'error' => qa_html(@$errors['name']), 'error' => qa_html(@$errors['name']),
), ),
'delete' => array( 'delete' => array(
'tags' => 'NAME="dodelete" ID="dodelete"', 'tags' => 'name="dodelete" id="dodelete"',
'label' => qa_lang_html($isexternal ? 'admin/delete_link' : 'admin/delete_page'), 'label' => qa_lang_html($isexternal ? 'admin/delete_link' : 'admin/delete_page'),
'value' => 0, 'value' => 0,
'type' => 'checkbox', 'type' => 'checkbox',
...@@ -361,7 +361,7 @@ ...@@ -361,7 +361,7 @@
'position' => array( 'position' => array(
'id' => 'position_display', 'id' => 'position_display',
'tags' => 'NAME="position"', 'tags' => 'name="position"',
'label' => qa_lang_html('admin/position'), 'label' => qa_lang_html('admin/position'),
'type' => 'select', 'type' => 'select',
'options' => $positionoptions, 'options' => $positionoptions,
...@@ -370,7 +370,7 @@ ...@@ -370,7 +370,7 @@
'permit' => array( 'permit' => array(
'id' => 'permit_display', 'id' => 'permit_display',
'tags' => 'NAME="permit"', 'tags' => 'name="permit"',
'label' => qa_lang_html('admin/permit_to_view'), 'label' => qa_lang_html('admin/permit_to_view'),
'type' => 'select', 'type' => 'select',
'options' => $permitoptions, 'options' => $permitoptions,
...@@ -379,7 +379,7 @@ ...@@ -379,7 +379,7 @@
'slug' => array( 'slug' => array(
'id' => 'slug_display', 'id' => 'slug_display',
'tags' => 'NAME="slug"', 'tags' => 'name="slug"',
'label' => qa_lang_html('admin/page_slug'), 'label' => qa_lang_html('admin/page_slug'),
'value' => qa_html(isset($inslug) ? $inslug : @$editpage['tags']), 'value' => qa_html(isset($inslug) ? $inslug : @$editpage['tags']),
'error' => qa_html(@$errors['slug']), 'error' => qa_html(@$errors['slug']),
...@@ -387,7 +387,7 @@ ...@@ -387,7 +387,7 @@
'url' => array( 'url' => array(
'id' => 'url_display', 'id' => 'url_display',
'tags' => 'NAME="url"', 'tags' => 'name="url"',
'label' => qa_lang_html('admin/link_url'), 'label' => qa_lang_html('admin/link_url'),
'value' => qa_html(isset($inurl) ? $inurl : @$editpage['tags']), 'value' => qa_html(isset($inurl) ? $inurl : @$editpage['tags']),
'error' => qa_html(@$errors['url']), 'error' => qa_html(@$errors['url']),
...@@ -395,7 +395,7 @@ ...@@ -395,7 +395,7 @@
'newwindow' => array( 'newwindow' => array(
'id' => 'newwindow_display', 'id' => 'newwindow_display',
'tags' => 'NAME="newwindow"', 'tags' => 'name="newwindow"',
'label' => qa_lang_html('admin/link_new_window'), 'label' => qa_lang_html('admin/link_new_window'),
'value' => (isset($innewwindow) ? $innewwindow : (@$editpage['flags'] & QA_PAGE_FLAGS_NEW_WINDOW)) ? 1 : 0, 'value' => (isset($innewwindow) ? $innewwindow : (@$editpage['flags'] & QA_PAGE_FLAGS_NEW_WINDOW)) ? 1 : 0,
'type' => 'checkbox', 'type' => 'checkbox',
...@@ -403,7 +403,7 @@ ...@@ -403,7 +403,7 @@
'heading' => array( 'heading' => array(
'id' => 'heading_display', 'id' => 'heading_display',
'tags' => 'NAME="heading"', 'tags' => 'name="heading"',
'label' => qa_lang_html('admin/page_heading'), 'label' => qa_lang_html('admin/page_heading'),
'value' => qa_html(isset($inheading) ? $inheading : @$editpage['heading']), 'value' => qa_html(isset($inheading) ? $inheading : @$editpage['heading']),
'error' => qa_html(@$errors['heading']), 'error' => qa_html(@$errors['heading']),
...@@ -411,7 +411,7 @@ ...@@ -411,7 +411,7 @@
'content' => array( 'content' => array(
'id' => 'content_display', 'id' => 'content_display',
'tags' => 'NAME="content"', 'tags' => 'name="content"',
'label' => qa_lang_html('admin/page_content_html'), 'label' => qa_lang_html('admin/page_content_html'),
'value' => qa_html(isset($incontent) ? $incontent : @$editpage['content']), 'value' => qa_html(isset($incontent) ? $incontent : @$editpage['content']),
'error' => qa_html(@$errors['content']), 'error' => qa_html(@$errors['content']),
...@@ -425,7 +425,7 @@ ...@@ -425,7 +425,7 @@
), ),
'cancel' => array( 'cancel' => array(
'tags' => 'NAME="docancel"', 'tags' => 'name="docancel"',
'label' => qa_lang_html('main/cancel_button'), 'label' => qa_lang_html('main/cancel_button'),
), ),
), ),
...@@ -469,7 +469,7 @@ ...@@ -469,7 +469,7 @@
// List of standard navigation links // List of standard navigation links
$qa_content['form']=array( $qa_content['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'style' => 'tall', 'style' => 'tall',
...@@ -477,17 +477,17 @@ ...@@ -477,17 +477,17 @@
'buttons' => array( 'buttons' => array(
'save' => array( 'save' => array(
'tags' => 'NAME="dosaveoptions"', 'tags' => 'name="dosaveoptions"',
'label' => qa_lang_html('main/save_button'), 'label' => qa_lang_html('main/save_button'),
), ),
'addpage' => array( 'addpage' => array(
'tags' => 'NAME="doaddpage"', 'tags' => 'name="doaddpage"',
'label' => qa_lang_html('admin/add_page_button'), 'label' => qa_lang_html('admin/add_page_button'),
), ),
'addlink' => array( 'addlink' => array(
'tags' => 'NAME="doaddlink"', 'tags' => 'name="doaddlink"',
'label' => qa_lang_html('admin/add_link_button'), 'label' => qa_lang_html('admin/add_link_button'),
), ),
), ),
...@@ -505,8 +505,8 @@ ...@@ -505,8 +505,8 @@
foreach ($navoptions as $optionname => $langkey) { foreach ($navoptions as $optionname => $langkey) {
$qa_content['form']['fields'][$optionname]=array( $qa_content['form']['fields'][$optionname]=array(
'label' => '<A HREF="'.qa_path_html($navpaths[$optionname]).'">'.qa_lang_html($langkey).'</A>', 'label' => '<a href="'.qa_path_html($navpaths[$optionname]).'">'.qa_lang_html($langkey).'</a>',
'tags' => 'NAME="option_'.$optionname.'"', 'tags' => 'name="option_'.$optionname.'"',
'type' => 'checkbox', 'type' => 'checkbox',
'value' => qa_opt($optionname), 'value' => qa_opt($optionname),
); );
...@@ -526,19 +526,19 @@ ...@@ -526,19 +526,19 @@
$suggestrequests=$trypage->suggest_requests(); $suggestrequests=$trypage->suggest_requests();
foreach ($suggestrequests as $suggestrequest) { foreach ($suggestrequests as $suggestrequest) {
$listhtml.='<LI><B><A HREF="'.qa_path_html($suggestrequest['request']).'">'.qa_html($suggestrequest['title']).'</A></B>'; $listhtml.='<li><b><a href="'.qa_path_html($suggestrequest['request']).'">'.qa_html($suggestrequest['title']).'</a></b>';
$listhtml.=qa_lang_html_sub('admin/plugin_module', qa_html($tryname)); $listhtml.=qa_lang_html_sub('admin/plugin_module', qa_html($tryname));
$listhtml.=strtr(qa_lang_html('admin/add_link_link'), array( $listhtml.=strtr(qa_lang_html('admin/add_link_link'), array(
'^1' => '<A HREF="'.qa_path_html(qa_request(), array('doaddlink' => 1, 'text' => $suggestrequest['title'], 'url' => $suggestrequest['request'], 'nav' => @$suggestrequest['nav'])).'">', '^1' => '<a href="'.qa_path_html(qa_request(), array('doaddlink' => 1, 'text' => $suggestrequest['title'], 'url' => $suggestrequest['request'], 'nav' => @$suggestrequest['nav'])).'">',
'^2' => '</A>', '^2' => '</a>',
)); ));
if (method_exists($trypage, 'admin_form')) if (method_exists($trypage, 'admin_form'))
$listhtml.=' - <A HREF="'.qa_admin_module_options_path('page', $tryname).'">'.qa_lang_html('admin/options').'</A>'; $listhtml.=' - <a href="'.qa_admin_module_options_path('page', $tryname).'">'.qa_lang_html('admin/options').'</a>';
$listhtml.='</LI>'; $listhtml.='</li>';
} }
} }
...@@ -546,7 +546,7 @@ ...@@ -546,7 +546,7 @@
$qa_content['form']['fields']['plugins']=array( $qa_content['form']['fields']['plugins']=array(
'label' => qa_lang_html('admin/plugin_pages_explanation'), 'label' => qa_lang_html('admin/plugin_pages_explanation'),
'type' => 'custom', 'type' => 'custom',
'html' => '<UL STYLE="margin-bottom:0;">'.$listhtml.'</UL>', 'html' => '<ul style="margin-bottom:0;">'.$listhtml.'</ul>',
); );
// List of custom pages or links // List of custom pages or links
...@@ -554,20 +554,20 @@ ...@@ -554,20 +554,20 @@
$listhtml=''; $listhtml='';
foreach ($pages as $page) { foreach ($pages as $page) {
$listhtml.='<LI><B><A HREF="'.qa_custom_page_url($page).'">'.qa_html($page['title']).'</A></B>'; $listhtml.='<li><b><a href="'.qa_custom_page_url($page).'">'.qa_html($page['title']).'</a></b>';
$listhtml.=strtr(qa_lang_html(($page['flags'] & QA_PAGE_FLAGS_EXTERNAL) ? 'admin/edit_link' : 'admin/edit_page'), array( $listhtml.=strtr(qa_lang_html(($page['flags'] & QA_PAGE_FLAGS_EXTERNAL) ? 'admin/edit_link' : 'admin/edit_page'), array(
'^1' => '<A HREF="'.qa_path_html('admin/pages', array('edit' => $page['pageid'])).'">', '^1' => '<a href="'.qa_path_html('admin/pages', array('edit' => $page['pageid'])).'">',
'^2' => '</A>', '^2' => '</a>',
)); ));
$listhtml.='</LI>'; $listhtml.='</li>';
} }
$qa_content['form']['fields']['pages']=array( $qa_content['form']['fields']['pages']=array(
'label' => strlen($listhtml) ? qa_lang_html('admin/click_name_edit') : qa_lang_html('admin/pages_explanation'), 'label' => strlen($listhtml) ? qa_lang_html('admin/click_name_edit') : qa_lang_html('admin/pages_explanation'),
'type' => 'custom', 'type' => 'custom',
'html' => strlen($listhtml) ? '<UL STYLE="margin-bottom:0;">'.$listhtml.'</UL>' : null, 'html' => strlen($listhtml) ? '<ul style="margin-bottom:0;">'.$listhtml.'</ul>' : null,
); );
} }
......
...@@ -88,8 +88,8 @@ ...@@ -88,8 +88,8 @@
$qa_content['error']=strtr(qa_lang_html('admin/module_x_database_init'), array( $qa_content['error']=strtr(qa_lang_html('admin/module_x_database_init'), array(
'^1' => qa_html($name), '^1' => qa_html($name),
'^2' => qa_html($type), '^2' => qa_html($type),
'^3' => '<A HREF="'.qa_path_html('install').'">', '^3' => '<a href="'.qa_path_html('install').'">',
'^4' => '</A>', '^4' => '</a>',
)); ));
} }
} }
...@@ -129,9 +129,9 @@ ...@@ -129,9 +129,9 @@
$namehtml=qa_lang_html('admin/unnamed_plugin'); $namehtml=qa_lang_html('admin/unnamed_plugin');
if (strlen(@$metadata['uri'])) if (strlen(@$metadata['uri']))
$namehtml='<A HREF="'.qa_html($metadata['uri']).'">'.$namehtml.'</A>'; $namehtml='<a href="'.qa_html($metadata['uri']).'">'.$namehtml.'</a>';
$namehtml='<B>'.$namehtml.'</B>'; $namehtml='<b>'.$namehtml.'</b>';
if (strlen(@$metadata['version'])) if (strlen(@$metadata['version']))
$namehtml.=' v'.qa_html($metadata['version']); $namehtml.=' v'.qa_html($metadata['version']);
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
$authorhtml=qa_html($metadata['author']); $authorhtml=qa_html($metadata['author']);
if (strlen(@$metadata['author_uri'])) if (strlen(@$metadata['author_uri']))
$authorhtml='<A HREF="'.qa_html($metadata['author_uri']).'">'.$authorhtml.'</A>'; $authorhtml='<a href="'.qa_html($metadata['author_uri']).'">'.$authorhtml.'</a>';
$authorhtml=qa_lang_html_sub('main/by_x', $authorhtml); $authorhtml=qa_lang_html_sub('main/by_x', $authorhtml);
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
if (strlen(@$metadata['version']) && strlen(@$metadata['update'])) { if (strlen(@$metadata['version']) && strlen(@$metadata['update'])) {
$elementid='version_check_'.md5($plugindirectory); $elementid='version_check_'.md5($plugindirectory);
$updatehtml='(<SPAN ID="'.$elementid.'">...</SPAN>)'; $updatehtml='(<span id="'.$elementid.'">...</span>)';
$qa_content['script_onloads'][]=array( $qa_content['script_onloads'][]=array(
"qa_version_check(".qa_js($metadata['update']).", 'Plugin Version', ".qa_js($metadata['version'], true).", 'Plugin URI', ".qa_js($elementid).");" "qa_version_check(".qa_js($metadata['update']).", 'Plugin Version', ".qa_js($metadata['version'], true).", 'Plugin URI', ".qa_js($elementid).");"
...@@ -165,22 +165,22 @@ ...@@ -165,22 +165,22 @@
$deschtml=''; $deschtml='';
if (isset($pluginoptionmodules[$plugindirectory]) && !$showthisform) if (isset($pluginoptionmodules[$plugindirectory]) && !$showthisform)
$deschtml.=(strlen($deschtml) ? ' - ' : '').'<A HREF="'. $deschtml.=(strlen($deschtml) ? ' - ' : '').'<a href="'.
qa_admin_plugin_options_path($plugindirectory).'">'.qa_lang_html('admin/options').'</A>'; qa_admin_plugin_options_path($plugindirectory).'">'.qa_lang_html('admin/options').'</a>';
$pluginhtml=$namehtml.' '.$authorhtml.' '.$updatehtml.'<BR>'.$deschtml.(strlen($deschtml) ? '<BR>' : ''). $pluginhtml=$namehtml.' '.$authorhtml.' '.$updatehtml.'<br>'.$deschtml.(strlen($deschtml) ? '<br>' : '').
'<SMALL STYLE="color:#666">'.qa_html($plugindirectory).'</SMALL>'; '<small style="color:#666">'.qa_html($plugindirectory).'</small>';
if (qa_qa_version_below(@$metadata['min_q2a'])) if (qa_qa_version_below(@$metadata['min_q2a']))
$pluginhtml='<STRIKE STYLE="color:#999">'.$pluginhtml.'</STRIKE><BR><SPAN STYLE="color:#f00">'. $pluginhtml='<strike style="color:#999">'.$pluginhtml.'</strike><br><span style="color:#f00">'.
qa_lang_html_sub('admin/requires_q2a_version', qa_html($metadata['min_q2a'])).'</SPAN>'; qa_lang_html_sub('admin/requires_q2a_version', qa_html($metadata['min_q2a'])).'</span>';
elseif (qa_php_version_below(@$metadata['min_php'])) elseif (qa_php_version_below(@$metadata['min_php']))
$pluginhtml='<STRIKE STYLE="color:#999">'.$pluginhtml.'</STRIKE><BR><SPAN STYLE="color:#f00">'. $pluginhtml='<strike style="color:#999">'.$pluginhtml.'</strike><br><span style="color:#f00">'.
qa_lang_html_sub('admin/requires_php_version', qa_html($metadata['min_php'])).'</SPAN>'; qa_lang_html_sub('admin/requires_php_version', qa_html($metadata['min_php'])).'</span>';
$qa_content['form_plugin_'.$pluginindex]=array( $qa_content['form_plugin_'.$pluginindex]=array(
'tags' => 'ID="'.qa_html($hash).'"', 'tags' => 'id="'.qa_html($hash).'"',
'style' => 'tall', 'style' => 'tall',
'fields' => array( 'fields' => array(
array( array(
...@@ -200,14 +200,16 @@ ...@@ -200,14 +200,16 @@
$form=$module->admin_form($qa_content); $form=$module->admin_form($qa_content);
if (!isset($form['tags'])) if (!isset($form['tags']))
$form['tags']='METHOD="POST" ACTION="'.qa_admin_plugin_options_path($plugindirectory).'"'; $form['tags']='method="post" action="'.qa_admin_plugin_options_path($plugindirectory).'"';
if (!isset($form['style'])) if (!isset($form['style']))
$form['style']='tall'; $form['style']='tall';
$form['boxed']=true;
$form['hidden']['qa_form_security_code']=qa_get_form_security_code('admin/plugins'); $form['hidden']['qa_form_security_code']=qa_get_form_security_code('admin/plugins');
$qa_content['form_'.$type.'_'.$name]=$form; $qa_content['form_plugin_options']=$form;
} }
} }
......
...@@ -85,13 +85,13 @@ ...@@ -85,13 +85,13 @@
$qa_content['error']=$securityexpired ? qa_lang_html('admin/form_security_expired') : qa_admin_page_error(); $qa_content['error']=$securityexpired ? qa_lang_html('admin/form_security_expired') : qa_admin_page_error();
$qa_content['form']=array( $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;"', 'tags' => 'method="post" action="'.qa_self_html().'" name="points_form" onsubmit="document.forms.points_form.has_js.value=1; return true;"',
'style' => 'wide', 'style' => 'wide',
'buttons' => array( 'buttons' => array(
'saverecalc' => array( 'saverecalc' => array(
'tags' => 'ID="dosaverecalc"', 'tags' => 'id="dosaverecalc"',
'label' => qa_lang_html('admin/save_recalc_button'), 'label' => qa_lang_html('admin/save_recalc_button'),
), ),
), ),
...@@ -108,13 +108,13 @@ ...@@ -108,13 +108,13 @@
$qa_content['form']['ok']=qa_lang_html('admin/points_defaults_shown'); $qa_content['form']['ok']=qa_lang_html('admin/points_defaults_shown');
$qa_content['form']['buttons']['cancel']=array( $qa_content['form']['buttons']['cancel']=array(
'tags' => 'NAME="docancel"', 'tags' => 'name="docancel"',
'label' => qa_lang_html('main/cancel_button'), 'label' => qa_lang_html('main/cancel_button'),
); );
} else { } else {
if ($recalculate) { if ($recalculate) {
$qa_content['form']['ok']='<SPAN ID="recalc_ok"></SPAN>'; $qa_content['form']['ok']='<span id="recalc_ok"></span>';
$qa_content['script_rel'][]='qa-content/qa-admin.js?'.QA_VERSION; $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_var']['qa_warning_recalc']=qa_lang('admin/stop_recalc_warning');
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
} }
$qa_content['form']['buttons']['showdefaults']=array( $qa_content['form']['buttons']['showdefaults']=array(
'tags' => 'NAME="doshowdefaults"', 'tags' => 'name="doshowdefaults"',
'label' => qa_lang_html('admin/show_defaults_button'), 'label' => qa_lang_html('admin/show_defaults_button'),
); );
} }
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
foreach ($optionnames as $optionname) { foreach ($optionnames as $optionname) {
$optionfield=array( $optionfield=array(
'label' => qa_lang_html('options/'.$optionname), 'label' => qa_lang_html('options/'.$optionname),
'tags' => 'NAME="option_'.$optionname.'"', 'tags' => 'name="option_'.$optionname.'"',
'value' => qa_html($options[$optionname]), 'value' => qa_html($options[$optionname]),
'type' => 'number', 'type' => 'number',
'note' => qa_lang_html('admin/points'), 'note' => qa_lang_html('admin/points'),
...@@ -165,11 +165,11 @@ ...@@ -165,11 +165,11 @@
break; break;
default: default:
$prefix='<SPAN STYLE="visibility:hidden;">+</SPAN>'; // for even alignment $prefix='<span style="visibility:hidden;">+</span>'; // for even alignment
break; break;
} }
$optionfield['prefix']='<SPAN STYLE="width:1em; display:inline-block; display:-moz-inline-stack;">'.$prefix.'</SPAN>'; $optionfield['prefix']='<span style="width:1em; display:inline-block; display:-moz-inline-stack;">'.$prefix.'</span>';
$qa_content['form']['fields'][$optionname]=$optionfield; $qa_content['form']['fields'][$optionname]=$optionfield;
} }
......
...@@ -66,12 +66,12 @@ ...@@ -66,12 +66,12 @@
if ($recalcnow) { if ($recalcnow) {
?> ?>
<HTML> <html>
<HEAD> <head>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8">
</HEAD> </head>
<BODY> <body>
<TT> <tt>
<?php <?php
...@@ -83,18 +83,18 @@ ...@@ -83,18 +83,18 @@
while ( qa_recalc_perform_step($state) && (time()<$stoptime) ) while ( qa_recalc_perform_step($state) && (time()<$stoptime) )
; ;
echo qa_html(qa_recalc_get_message($state)).str_repeat(' ', 1024)."<BR>\n"; echo qa_html(qa_recalc_get_message($state)).str_repeat(' ', 1024)."<br>\n";
flush(); flush();
sleep(1); // ... then rest for one sleep(1); // ... then rest for one
} }
?> ?>
</TT> </tt>
<A HREF="<?php echo qa_path_html('admin/stats')?>"><?php echo qa_lang_html('admin/admin_title').' - '.qa_lang_html('admin/stats_title')?></A> <a href="<?php echo qa_path_html('admin/stats')?>"><?php echo qa_lang_html('admin/admin_title').' - '.qa_lang_html('admin/stats_title')?></a>
</BODY> </body>
</HTML> </html>
<?php <?php
qa_exit(); qa_exit();
...@@ -106,13 +106,13 @@ ...@@ -106,13 +106,13 @@
$qa_content['error']=qa_lang_html('misc/form_security_again'); $qa_content['error']=qa_lang_html('misc/form_security_again');
$qa_content['form']=array( $qa_content['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'style' => 'wide', 'style' => 'wide',
'buttons' => array( 'buttons' => array(
'recalc' => array( 'recalc' => array(
'tags' => 'NAME="'.qa_html($state).'"', 'tags' => 'name="'.qa_html($state).'"',
'label' => qa_lang_html('misc/form_security_again'), 'label' => qa_lang_html('misc/form_security_again'),
), ),
), ),
......
...@@ -77,8 +77,8 @@ ...@@ -77,8 +77,8 @@
'q2a_latest' => array( 'q2a_latest' => array(
'label' => qa_lang_html('admin/q2a_latest_version'), 'label' => qa_lang_html('admin/q2a_latest_version'),
'type' => 'custom', 'type' => 'custom',
'html' => '<IFRAME SRC="http://www.question2answer.org/question2answer-latest.php?version='.urlencode(QA_VERSION).'&language='.urlencode(qa_opt('site_language')). 'html' => '<iframe src="http://www.question2answer.org/question2answer-latest.php?version='.urlencode(QA_VERSION).'&language='.urlencode(qa_opt('site_language')).
'" WIDTH="100" HEIGHT="16" STYLE="vertical-align:middle; border:0; background:transparent;" allowTransparency="true" SCROLLING="no" FRAMEBORDER="0"></IFRAME>', '" width="100" height="16" style="vertical-align:middle; border:0; background:transparent;" allowTransparency="true" scrolling="no" frameborder="0"></iframe>',
), ),
'break0' => array( 'break0' => array(
...@@ -202,7 +202,7 @@ ...@@ -202,7 +202,7 @@
$qa_content['form']['fields'][$index]['type']='static'; $qa_content['form']['fields'][$index]['type']='static';
$qa_content['form_2']=array( $qa_content['form_2']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_path_html('admin/recalc').'"', 'tags' => 'method="post" action="'.qa_path_html('admin/recalc').'"',
'title' => qa_lang_html('admin/database_cleanup'), 'title' => qa_lang_html('admin/database_cleanup'),
...@@ -211,38 +211,38 @@ ...@@ -211,38 +211,38 @@
'buttons' => array( 'buttons' => array(
'recount_posts' => array( 'recount_posts' => array(
'label' => qa_lang_html('admin/recount_posts'), 'label' => qa_lang_html('admin/recount_posts'),
'tags' => 'NAME="dorecountposts" onClick="return qa_recalc_click(this.name, this, '.qa_js(qa_lang('admin/recount_posts_stop')).', \'recount_posts_note\');"', 'tags' => 'name="dorecountposts" onclick="return qa_recalc_click(this.name, this, '.qa_js(qa_lang('admin/recount_posts_stop')).', \'recount_posts_note\');"',
'note' => '<SPAN ID="recount_posts_note">'.qa_lang_html('admin/recount_posts_note').'</SPAN>', 'note' => '<span id="recount_posts_note">'.qa_lang_html('admin/recount_posts_note').'</span>',
), ),
'reindex_content' => array( 'reindex_content' => array(
'label' => qa_lang_html('admin/reindex_content'), 'label' => qa_lang_html('admin/reindex_content'),
'tags' => 'NAME="doreindexcontent" onClick="return qa_recalc_click(this.name, this, '.qa_js(qa_lang('admin/reindex_content_stop')).', \'reindex_content_note\');"', 'tags' => 'name="doreindexcontent" onclick="return qa_recalc_click(this.name, this, '.qa_js(qa_lang('admin/reindex_content_stop')).', \'reindex_content_note\');"',
'note' => '<SPAN ID="reindex_content_note">'.qa_lang_html('admin/reindex_content_note').'</SPAN>', 'note' => '<span id="reindex_content_note">'.qa_lang_html('admin/reindex_content_note').'</span>',
), ),
'recalc_points' => array( 'recalc_points' => array(
'label' => qa_lang_html('admin/recalc_points'), 'label' => qa_lang_html('admin/recalc_points'),
'tags' => 'NAME="dorecalcpoints" onClick="return qa_recalc_click(this.name, this, '.qa_js(qa_lang('admin/recalc_stop')).', \'recalc_points_note\');"', 'tags' => 'name="dorecalcpoints" onclick="return qa_recalc_click(this.name, this, '.qa_js(qa_lang('admin/recalc_stop')).', \'recalc_points_note\');"',
'note' => '<SPAN ID="recalc_points_note">'.qa_lang_html('admin/recalc_points_note').'</SPAN>', 'note' => '<span id="recalc_points_note">'.qa_lang_html('admin/recalc_points_note').'</span>',
), ),
'refill_events' => array( 'refill_events' => array(
'label' => qa_lang_html('admin/refill_events'), 'label' => qa_lang_html('admin/refill_events'),
'tags' => 'NAME="dorefillevents" onClick="return qa_recalc_click(this.name, this, '.qa_js(qa_lang('admin/recalc_stop')).', \'refill_events_note\');"', 'tags' => 'name="dorefillevents" onclick="return qa_recalc_click(this.name, this, '.qa_js(qa_lang('admin/recalc_stop')).', \'refill_events_note\');"',
'note' => '<SPAN ID="refill_events_note">'.qa_lang_html('admin/refill_events_note').'</SPAN>', 'note' => '<span id="refill_events_note">'.qa_lang_html('admin/refill_events_note').'</span>',
), ),
'recalc_categories' => array( 'recalc_categories' => array(
'label' => qa_lang_html('admin/recalc_categories'), 'label' => qa_lang_html('admin/recalc_categories'),
'tags' => 'NAME="dorecalccategories" onClick="return qa_recalc_click(this.name, this, '.qa_js(qa_lang('admin/recalc_stop')).', \'recalc_categories_note\');"', 'tags' => 'name="dorecalccategories" onclick="return qa_recalc_click(this.name, this, '.qa_js(qa_lang('admin/recalc_stop')).', \'recalc_categories_note\');"',
'note' => '<SPAN ID="recalc_categories_note">'.qa_lang_html('admin/recalc_categories_note').'</SPAN>', 'note' => '<span id="recalc_categories_note">'.qa_lang_html('admin/recalc_categories_note').'</span>',
), ),
'delete_hidden' => array( 'delete_hidden' => array(
'label' => qa_lang_html('admin/delete_hidden'), 'label' => qa_lang_html('admin/delete_hidden'),
'tags' => 'NAME="dodeletehidden" onClick="return qa_recalc_click(this.name, this, '.qa_js(qa_lang('admin/delete_stop')).', \'delete_hidden_note\');"', 'tags' => 'name="dodeletehidden" onclick="return qa_recalc_click(this.name, this, '.qa_js(qa_lang('admin/delete_stop')).', \'delete_hidden_note\');"',
'note' => '<SPAN ID="delete_hidden_note">'.qa_lang_html('admin/delete_hidden_note').'</SPAN>', 'note' => '<span id="delete_hidden_note">'.qa_lang_html('admin/delete_hidden_note').'</span>',
), ),
), ),
...@@ -258,15 +258,15 @@ ...@@ -258,15 +258,15 @@
if (qa_db_has_blobs_in_db()) if (qa_db_has_blobs_in_db())
$qa_content['form_2']['buttons']['blobs_to_disk']=array( $qa_content['form_2']['buttons']['blobs_to_disk']=array(
'label' => qa_lang_html('admin/blobs_to_disk'), 'label' => qa_lang_html('admin/blobs_to_disk'),
'tags' => 'NAME="doblobstodisk" onClick="return qa_recalc_click(this.name, this, '.qa_js(qa_lang('admin/blobs_stop')).', \'blobs_to_disk_note\');"', 'tags' => 'name="doblobstodisk" onclick="return qa_recalc_click(this.name, this, '.qa_js(qa_lang('admin/blobs_stop')).', \'blobs_to_disk_note\');"',
'note' => '<SPAN ID="blobs_to_disk_note">'.qa_lang_html('admin/blobs_to_disk_note').'</SPAN>', 'note' => '<span id="blobs_to_disk_note">'.qa_lang_html('admin/blobs_to_disk_note').'</span>',
); );
if (qa_db_has_blobs_on_disk()) if (qa_db_has_blobs_on_disk())
$qa_content['form_2']['buttons']['blobs_to_db']=array( $qa_content['form_2']['buttons']['blobs_to_db']=array(
'label' => qa_lang_html('admin/blobs_to_db'), 'label' => qa_lang_html('admin/blobs_to_db'),
'tags' => 'NAME="doblobstodb" onClick="return qa_recalc_click(this.name, this, '.qa_js(qa_lang('admin/blobs_stop')).', \'blobs_to_db_note\');"', 'tags' => 'name="doblobstodb" onclick="return qa_recalc_click(this.name, this, '.qa_js(qa_lang('admin/blobs_stop')).', \'blobs_to_db_note\');"',
'note' => '<SPAN ID="blobs_to_db_note">'.qa_lang_html('admin/blobs_to_db_note').'</SPAN>', 'note' => '<span id="blobs_to_db_note">'.qa_lang_html('admin/blobs_to_db_note').'</span>',
); );
} }
......
...@@ -170,20 +170,20 @@ ...@@ -170,20 +170,20 @@
$permitvalue=@$permitoptions[isset($inpermit) ? $inpermit : $editfield['permit']]; $permitvalue=@$permitoptions[isset($inpermit) ? $inpermit : $editfield['permit']];
$qa_content['form']=array( $qa_content['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_path_html(qa_request()).'"', 'tags' => 'method="post" action="'.qa_path_html(qa_request()).'"',
'style' => 'tall', 'style' => 'tall',
'fields' => array( 'fields' => array(
'name' => array( 'name' => array(
'tags' => 'NAME="name" ID="name"', 'tags' => 'name="name" id="name"',
'label' => qa_lang_html('admin/field_name'), 'label' => qa_lang_html('admin/field_name'),
'value' => qa_html(isset($inname) ? $inname : qa_user_userfield_label($editfield)), 'value' => qa_html(isset($inname) ? $inname : qa_user_userfield_label($editfield)),
'error' => qa_html(@$errors['name']), 'error' => qa_html(@$errors['name']),
), ),
'delete' => array( 'delete' => array(
'tags' => 'NAME="dodelete" ID="dodelete"', 'tags' => 'name="dodelete" id="dodelete"',
'label' => qa_lang_html('admin/delete_field'), 'label' => qa_lang_html('admin/delete_field'),
'value' => 0, 'value' => 0,
'type' => 'checkbox', 'type' => 'checkbox',
...@@ -191,7 +191,7 @@ ...@@ -191,7 +191,7 @@
'type' => array( 'type' => array(
'id' => 'type_display', 'id' => 'type_display',
'tags' => 'NAME="type"', 'tags' => 'name="type"',
'label' => qa_lang_html('admin/field_type'), 'label' => qa_lang_html('admin/field_type'),
'type' => 'select', 'type' => 'select',
'options' => $typeoptions, 'options' => $typeoptions,
...@@ -200,7 +200,7 @@ ...@@ -200,7 +200,7 @@
'permit' => array( 'permit' => array(
'id' => 'permit_display', 'id' => 'permit_display',
'tags' => 'NAME="permit"', 'tags' => 'name="permit"',
'label' => qa_lang_html('admin/permit_to_view'), 'label' => qa_lang_html('admin/permit_to_view'),
'type' => 'select', 'type' => 'select',
'options' => $permitoptions, 'options' => $permitoptions,
...@@ -209,7 +209,7 @@ ...@@ -209,7 +209,7 @@
'position' => array( 'position' => array(
'id' => 'position_display', 'id' => 'position_display',
'tags' => 'NAME="position"', 'tags' => 'name="position"',
'label' => qa_lang_html('admin/position'), 'label' => qa_lang_html('admin/position'),
'type' => 'select', 'type' => 'select',
'options' => $positionoptions, 'options' => $positionoptions,
...@@ -218,7 +218,7 @@ ...@@ -218,7 +218,7 @@
'onregister' => array( 'onregister' => array(
'id' => 'register_display', 'id' => 'register_display',
'tags' => 'NAME="onregister"', 'tags' => 'name="onregister"',
'label' => qa_lang_html('admin/show_on_register_form'), 'label' => qa_lang_html('admin/show_on_register_form'),
'type' => 'checkbox', 'type' => 'checkbox',
'value' => isset($inonregister) ? $inonregister : (@$editfield['flags']&QA_FIELD_FLAGS_ON_REGISTER), 'value' => isset($inonregister) ? $inonregister : (@$editfield['flags']&QA_FIELD_FLAGS_ON_REGISTER),
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
), ),
'cancel' => array( 'cancel' => array(
'tags' => 'NAME="docancel"', 'tags' => 'name="docancel"',
'label' => qa_lang_html('main/cancel_button'), 'label' => qa_lang_html('main/cancel_button'),
), ),
), ),
...@@ -248,6 +248,7 @@ ...@@ -248,6 +248,7 @@
'type_display' => '!dodelete', 'type_display' => '!dodelete',
'position_display' => '!dodelete', 'position_display' => '!dodelete',
'register_display' => '!dodelete', 'register_display' => '!dodelete',
'permit_display' => '!dodelete',
)); ));
else else
unset($qa_content['form']['fields']['delete']); unset($qa_content['form']['fields']['delete']);
......
...@@ -122,20 +122,20 @@ ...@@ -122,20 +122,20 @@
$qa_content['error']=$securityexpired ? qa_lang_html('admin/form_security_expired') : qa_admin_page_error(); $qa_content['error']=$securityexpired ? qa_lang_html('admin/form_security_expired') : qa_admin_page_error();
$qa_content['form']=array( $qa_content['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_path_html(qa_request()).'"', 'tags' => 'method="post" action="'.qa_path_html(qa_request()).'"',
'style' => 'tall', 'style' => 'tall',
'fields' => array( 'fields' => array(
'title' => array( 'title' => array(
'tags' => 'NAME="title" ID="title"', 'tags' => 'name="title" id="title"',
'label' => qa_lang_html('admin/user_title'), 'label' => qa_lang_html('admin/user_title'),
'value' => qa_html(isset($intitle) ? $intitle : @$pointstitle[$oldpoints]), 'value' => qa_html(isset($intitle) ? $intitle : @$pointstitle[$oldpoints]),
'error' => qa_html(@$errors['title']), 'error' => qa_html(@$errors['title']),
), ),
'delete' => array( 'delete' => array(
'tags' => 'NAME="dodelete" ID="dodelete"', 'tags' => 'name="dodelete" id="dodelete"',
'label' => qa_lang_html('admin/delete_title'), 'label' => qa_lang_html('admin/delete_title'),
'value' => 0, 'value' => 0,
'type' => 'checkbox', 'type' => 'checkbox',
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
'points' => array( 'points' => array(
'id' => 'points_display', 'id' => 'points_display',
'tags' => 'NAME="points"', 'tags' => 'name="points"',
'label' => qa_lang_html('admin/points_required'), 'label' => qa_lang_html('admin/points_required'),
'type' => 'number', 'type' => 'number',
'value' => qa_html(isset($inpoints) ? $inpoints : @$oldpoints), 'value' => qa_html(isset($inpoints) ? $inpoints : @$oldpoints),
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
), ),
'cancel' => array( 'cancel' => array(
'tags' => 'NAME="docancel"', 'tags' => 'name="docancel"',
'label' => qa_lang_html('main/cancel_button'), 'label' => qa_lang_html('main/cancel_button'),
), ),
), ),
......
...@@ -227,7 +227,7 @@ ...@@ -227,7 +227,7 @@
$positionvalue=@$positionoptions[$editwidget['place'].$editwidget['position']]; $positionvalue=@$positionoptions[$editwidget['place'].$editwidget['position']];
$qa_content['form']=array( $qa_content['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_path_html(qa_request()).'"', 'tags' => 'method="post" action="'.qa_path_html(qa_request()).'"',
'style' => 'tall', 'style' => 'tall',
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
'position' => array( 'position' => array(
'id' => 'position_display', 'id' => 'position_display',
'tags' => 'NAME="position"', 'tags' => 'name="position"',
'label' => qa_lang_html('admin/position'), 'label' => qa_lang_html('admin/position'),
'type' => 'select', 'type' => 'select',
'options' => $positionoptions, 'options' => $positionoptions,
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
), ),
'delete' => array( 'delete' => array(
'tags' => 'NAME="dodelete" ID="dodelete"', 'tags' => 'name="dodelete" id="dodelete"',
'label' => qa_lang_html('admin/delete_widget_position'), 'label' => qa_lang_html('admin/delete_widget_position'),
'value' => 0, 'value' => 0,
'type' => 'checkbox', 'type' => 'checkbox',
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
'id' => 'all_display', 'id' => 'all_display',
'label' => qa_lang_html('admin/widget_all_pages'), 'label' => qa_lang_html('admin/widget_all_pages'),
'type' => 'checkbox', 'type' => 'checkbox',
'tags' => 'NAME="template_all" ID="template_all"', 'tags' => 'name="template_all" id="template_all"',
'value' => is_numeric(strpos(','.@$editwidget['tags'].',', ',all,')), 'value' => is_numeric(strpos(','.@$editwidget['tags'].',', ',all,')),
), ),
...@@ -276,7 +276,7 @@ ...@@ -276,7 +276,7 @@
), ),
'cancel' => array( 'cancel' => array(
'tags' => 'NAME="docancel"', 'tags' => 'name="docancel"',
'label' => qa_lang_html('main/cancel_button'), 'label' => qa_lang_html('main/cancel_button'),
), ),
), ),
...@@ -291,9 +291,9 @@ ...@@ -291,9 +291,9 @@
foreach ($templateoptions as $template => $optionhtml) foreach ($templateoptions as $template => $optionhtml)
$qa_content['form']['fields']['templates']['html'].= $qa_content['form']['fields']['templates']['html'].=
'<INPUT TYPE="checkbox" NAME="template_'.qa_html($template).'"'. '<input type="checkbox" name="template_'.qa_html($template).'"'.
(is_numeric(strpos(','.@$editwidget['tags'].',', ','.$template.',')) ? ' CHECKED' : ''). (is_numeric(strpos(','.@$editwidget['tags'].',', ','.$template.',')) ? ' checked' : '').
'/> '.$optionhtml.'<BR/>'; '/> '.$optionhtml.'<br/>';
if (isset($editwidget['widgetid'])) if (isset($editwidget['widgetid']))
qa_set_display_rules($qa_content, array( qa_set_display_rules($qa_content, array(
......
...@@ -170,7 +170,7 @@ ...@@ -170,7 +170,7 @@
$custom=qa_opt('show_custom_ask') ? trim(qa_opt('custom_ask')) : ''; $custom=qa_opt('show_custom_ask') ? trim(qa_opt('custom_ask')) : '';
$qa_content['form']=array( $qa_content['form']=array(
'tags' => 'NAME="ask" METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'name="ask" method="post" action="'.qa_self_html().'"',
'style' => 'tall', 'style' => 'tall',
...@@ -182,14 +182,14 @@ ...@@ -182,14 +182,14 @@
'title' => array( 'title' => array(
'label' => qa_lang_html('question/q_title_label'), 'label' => qa_lang_html('question/q_title_label'),
'tags' => 'NAME="title" ID="title" AUTOCOMPLETE="off"', 'tags' => 'name="title" id="title" autocomplete="off"',
'value' => qa_html(@$in['title']), 'value' => qa_html(@$in['title']),
'error' => qa_html(@$errors['title']), 'error' => qa_html(@$errors['title']),
), ),
'similar' => array( 'similar' => array(
'type' => 'custom', 'type' => 'custom',
'html' => '<SPAN ID="similar"></SPAN>', 'html' => '<span id="similar"></span>',
), ),
'content' => $field, 'content' => $field,
...@@ -197,7 +197,7 @@ ...@@ -197,7 +197,7 @@
'buttons' => array( 'buttons' => array(
'ask' => array( 'ask' => array(
'tags' => 'onClick="qa_show_waiting_after(this, false); '. 'tags' => 'onclick="qa_show_waiting_after(this, false); '.
(method_exists($editor, 'update_script') ? $editor->update_script('content') : '').'"', (method_exists($editor, 'update_script') ? $editor->update_script('content') : '').'"',
'label' => qa_lang_html('question/ask_button'), 'label' => qa_lang_html('question/ask_button'),
), ),
...@@ -215,7 +215,7 @@ ...@@ -215,7 +215,7 @@
if (qa_opt('do_ask_check_qs') || qa_opt('do_example_tags')) { 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['script_rel'][]='qa-content/qa-ask.js?'.QA_VERSION;
$qa_content['form']['fields']['title']['tags'].=' onChange="qa_title_change(this.value);"'; $qa_content['form']['fields']['title']['tags'].=' onchange="qa_title_change(this.value);"';
if (strlen(@$in['title'])) if (strlen(@$in['title']))
$qa_content['script_onloads'][]='qa_title_change('.qa_js($in['title']).');'; $qa_content['script_onloads'][]='qa_title_change('.qa_js($in['title']).');';
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
if (qa_opt('extra_field_active')) { if (qa_opt('extra_field_active')) {
$field=array( $field=array(
'label' => qa_html(qa_opt('extra_field_prompt')), 'label' => qa_html(qa_opt('extra_field_prompt')),
'tags' => 'NAME="extra"', 'tags' => 'name="extra"',
'value' => qa_html(@$in['extra']), 'value' => qa_html(@$in['extra']),
'error' => qa_html(@$errors['extra']), 'error' => qa_html(@$errors['extra']),
); );
......
...@@ -71,10 +71,10 @@ ...@@ -71,10 +71,10 @@
$navigation[$key]['note']=''; $navigation[$key]['note']='';
$navigation[$key]['note'].= $navigation[$key]['note'].=
' - <A HREF="'.qa_path_html('questions/'.implode('/', array_reverse(explode('/', $category['backpath'])))).'">'.( ($category['qcount']==1) ' - <a href="'.qa_path_html('questions/'.implode('/', array_reverse(explode('/', $category['backpath'])))).'">'.( ($category['qcount']==1)
? qa_lang_html_sub('main/1_question', '1', '1') ? qa_lang_html_sub('main/1_question', '1', '1')
: qa_lang_html_sub('main/x_questions', number_format($category['qcount'])) : qa_lang_html_sub('main/x_questions', number_format($category['qcount']))
).'</A>'; ).'</a>';
if (strlen($category['content'])) if (strlen($category['content']))
$navigation[$key]['note'].=qa_html(' - '.$category['content']); $navigation[$key]['note'].=qa_html(' - '.$category['content']);
......
...@@ -101,8 +101,8 @@ ...@@ -101,8 +101,8 @@
qa_lang_html('users/log_in_to_access'), qa_lang_html('users/log_in_to_access'),
array( array(
'^1' => '<A HREF="'.qa_path_html('login', array('e' => $inhandle)).'">', '^1' => '<a href="'.qa_path_html('login', array('e' => $inhandle)).'">',
'^2' => '</A>', '^2' => '</a>',
) )
); );
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
$email=qa_get_logged_in_email(); $email=qa_get_logged_in_email();
$qa_content['form']=array( $qa_content['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_path_html('confirm').'"', 'tags' => 'method="post" action="'.qa_path_html('confirm').'"',
'style' => 'tall', 'style' => 'tall',
...@@ -123,8 +123,8 @@ ...@@ -123,8 +123,8 @@
'email' => array( 'email' => array(
'label' => qa_lang_html('users/email_label'), 'label' => qa_lang_html('users/email_label'),
'value' => qa_html($email).strtr(qa_lang_html('users/change_email_link'), array( 'value' => qa_html($email).strtr(qa_lang_html('users/change_email_link'), array(
'^1' => '<A HREF="'.qa_path_html('account').'">', '^1' => '<a href="'.qa_path_html('account').'">',
'^2' => '</A>', '^2' => '</a>',
)), )),
'type' => 'static', 'type' => 'static',
), ),
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,7 @@
'buttons' => array( 'buttons' => array(
'send' => array( 'send' => array(
'tags' => 'NAME="dosendconfirm"', 'tags' => 'name="dosendconfirm"',
'label' => qa_lang_html('users/send_confirm_button'), 'label' => qa_lang_html('users/send_confirm_button'),
), ),
), ),
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
if (count($questions)) { if (count($questions)) {
$qa_content['q_list']['form']=array( $qa_content['q_list']['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'hidden' => array( 'hidden' => array(
'code' => qa_get_form_security_code('vote'), 'code' => qa_get_form_security_code('vote'),
...@@ -136,11 +136,11 @@ ...@@ -136,11 +136,11 @@
'label' => qa_html($category['title']), 'label' => qa_html($category['title']),
'state' => 'open', 'state' => 'open',
'favorited' => true, 'favorited' => true,
'note' => ' - <A HREF="'.qa_path_html('questions/'.implode('/', array_reverse(explode('/', $category['backpath'])))).'">'. 'note' => ' - <a href="'.qa_path_html('questions/'.implode('/', array_reverse(explode('/', $category['backpath'])))).'">'.
( ($category['qcount']==1) ( ($category['qcount']==1)
? qa_lang_html_sub('main/1_question', '1', '1') ? qa_lang_html_sub('main/1_question', '1', '1')
: qa_lang_html_sub('main/x_questions', number_format($category['qcount'])) : qa_lang_html_sub('main/x_questions', number_format($category['qcount']))
).'</A>'. ).'</a>'.
(strlen($category['content']) ? qa_html(' - '.$category['content']) : ''), (strlen($category['content']) ? qa_html(' - '.$category['content']) : ''),
); );
} }
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
// Sub navigation for account pages and suggestion // Sub navigation for account pages and suggestion
$qa_content['suggest_next']=qa_lang_html_sub('misc/suggest_favorites_add', '<SPAN CLASS="qa-favorite-image">&nbsp;</SPAN>'); $qa_content['suggest_next']=qa_lang_html_sub('misc/suggest_favorites_add', '<span class="qa-favorite-image">&nbsp;</span>');
if (!QA_FINAL_EXTERNAL_USERS) if (!QA_FINAL_EXTERNAL_USERS)
$qa_content['navigation']['sub']=qa_account_sub_navigation(); $qa_content['navigation']['sub']=qa_account_sub_navigation();
......
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
$qa_content['error']=@$pageerror; $qa_content['error']=@$pageerror;
$qa_content['form']=array( $qa_content['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'style' => 'tall', 'style' => 'tall',
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
'message' => array( 'message' => array(
'type' => $feedbacksent ? 'static' : '', 'type' => $feedbacksent ? 'static' : '',
'label' => qa_lang_html_sub('misc/feedback_message', qa_opt('site_title')), 'label' => qa_lang_html_sub('misc/feedback_message', qa_opt('site_title')),
'tags' => 'NAME="message" ID="message"', 'tags' => 'name="message" id="message"',
'value' => qa_html(@$inmessage), 'value' => qa_html(@$inmessage),
'rows' => 8, 'rows' => 8,
'error' => qa_html(@$errors['message']), 'error' => qa_html(@$errors['message']),
...@@ -143,14 +143,14 @@ ...@@ -143,14 +143,14 @@
'name' => array( 'name' => array(
'type' => $feedbacksent ? 'static' : '', 'type' => $feedbacksent ? 'static' : '',
'label' => qa_lang_html('misc/feedback_name'), 'label' => qa_lang_html('misc/feedback_name'),
'tags' => 'NAME="name"', 'tags' => 'name="name"',
'value' => qa_html(isset($inname) ? $inname : @$userprofile['name']), 'value' => qa_html(isset($inname) ? $inname : @$userprofile['name']),
), ),
'email' => array( 'email' => array(
'type' => $feedbacksent ? 'static' : '', 'type' => $feedbacksent ? 'static' : '',
'label' => qa_lang_html('misc/feedback_email'), 'label' => qa_lang_html('misc/feedback_email'),
'tags' => 'NAME="email"', 'tags' => 'name="email"',
'value' => qa_html(isset($inemail) ? $inemail : qa_get_logged_in_email()), 'value' => qa_html(isset($inemail) ? $inemail : qa_get_logged_in_email()),
'note' => $feedbacksent ? null : qa_opt('email_privacy'), 'note' => $feedbacksent ? null : qa_opt('email_privacy'),
), ),
......
...@@ -89,14 +89,14 @@ ...@@ -89,14 +89,14 @@
$qa_content['error']=@$errors['page']; $qa_content['error']=@$errors['page'];
$qa_content['form']=array( $qa_content['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'style' => 'tall', 'style' => 'tall',
'fields' => array( 'fields' => array(
'email_handle' => array( 'email_handle' => array(
'label' => qa_lang_html('users/email_handle_label'), 'label' => qa_lang_html('users/email_handle_label'),
'tags' => 'NAME="emailhandle" ID="emailhandle"', 'tags' => 'name="emailhandle" id="emailhandle"',
'value' => qa_html(@$inemailhandle), 'value' => qa_html(@$inemailhandle),
'error' => qa_html(@$errors['emailhandle']), 'error' => qa_html(@$errors['emailhandle']),
'note' => qa_lang_html('users/send_reset_note'), 'note' => qa_lang_html('users/send_reset_note'),
......
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
$qa_content['error']=@$pageerror; $qa_content['error']=@$pageerror;
$qa_content['form']=array( $qa_content['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'style' => 'wide', 'style' => 'wide',
...@@ -175,19 +175,19 @@ ...@@ -175,19 +175,19 @@
); );
$qa_content['form']['buttons']['unblock']=array( $qa_content['form']['buttons']['unblock']=array(
'tags' => 'NAME="dounblock"', 'tags' => 'name="dounblock"',
'label' => qa_lang_html('misc/unblock_ip_button'), 'label' => qa_lang_html('misc/unblock_ip_button'),
); );
if (count($questions) && !qa_user_maximum_permit_error('permit_hide_show')) if (count($questions) && !qa_user_maximum_permit_error('permit_hide_show'))
$qa_content['form']['buttons']['hideall']=array( $qa_content['form']['buttons']['hideall']=array(
'tags' => 'NAME="dohideall" onClick="qa_show_waiting_after(this, false);"', 'tags' => 'name="dohideall" onclick="qa_show_waiting_after(this, false);"',
'label' => qa_lang_html('misc/hide_all_ip_button'), 'label' => qa_lang_html('misc/hide_all_ip_button'),
); );
} else } else
$qa_content['form']['buttons']['block']=array( $qa_content['form']['buttons']['block']=array(
'tags' => 'NAME="doblock"', 'tags' => 'name="doblock"',
'label' => qa_lang_html('misc/block_ip_button'), 'label' => qa_lang_html('misc/block_ip_button'),
); );
} }
...@@ -204,6 +204,7 @@ ...@@ -204,6 +204,7 @@
$htmloptions['voteview']=false; $htmloptions['voteview']=false;
$htmloptions['ipview']=false; $htmloptions['ipview']=false;
$htmloptions['answersview']=false; $htmloptions['answersview']=false;
$htmloptions['viewsview']=false;
$htmloptions['updateview']=false; $htmloptions['updateview']=false;
$htmlfields=qa_any_to_q_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, $htmloptions); $htmlfields=qa_any_to_q_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, $htmloptions);
......
...@@ -113,10 +113,10 @@ ...@@ -113,10 +113,10 @@
else else
$forgotpath=qa_path('forgot', array('e' => $inemailhandle)); $forgotpath=qa_path('forgot', array('e' => $inemailhandle));
$forgothtml='<A HREF="'.qa_html($forgotpath).'">'.qa_lang_html('users/forgot_link').'</A>'; $forgothtml='<a href="'.qa_html($forgotpath).'">'.qa_lang_html('users/forgot_link').'</a>';
$qa_content['form']=array( $qa_content['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'style' => 'tall', 'style' => 'tall',
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
'fields' => array( 'fields' => array(
'email_handle' => array( 'email_handle' => array(
'label' => qa_opt('allow_login_email_only') ? qa_lang_html('users/email_label') : qa_lang_html('users/email_handle_label'), '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"', 'tags' => 'name="emailhandle" id="emailhandle"',
'value' => qa_html(@$inemailhandle), 'value' => qa_html(@$inemailhandle),
'error' => qa_html(@$errors['emailhandle']), 'error' => qa_html(@$errors['emailhandle']),
), ),
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
'password' => array( 'password' => array(
'type' => 'password', 'type' => 'password',
'label' => qa_lang_html('users/password_label'), 'label' => qa_lang_html('users/password_label'),
'tags' => 'NAME="password" ID="password"', 'tags' => 'name="password" id="password"',
'value' => qa_html(@$inpassword), 'value' => qa_html(@$inpassword),
'error' => empty($errors['password']) ? '' : (qa_html(@$errors['password']).' - '.$forgothtml), 'error' => empty($errors['password']) ? '' : (qa_html(@$errors['password']).' - '.$forgothtml),
'note' => $passwordsent ? qa_lang_html('users/password_sent') : $forgothtml, 'note' => $passwordsent ? qa_lang_html('users/password_sent') : $forgothtml,
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
'remember' => array( 'remember' => array(
'type' => 'checkbox', 'type' => 'checkbox',
'label' => qa_lang_html('users/remember_label'), 'label' => qa_lang_html('users/remember_label'),
'tags' => 'NAME="remember"', 'tags' => 'name="remember"',
'value' => @$inremember ? true : false, 'value' => @$inremember ? true : false,
), ),
), ),
...@@ -167,7 +167,7 @@ ...@@ -167,7 +167,7 @@
$html=ob_get_clean(); $html=ob_get_clean();
if (strlen($html)) if (strlen($html))
@$qa_content['custom'].='<BR>'.$html.'<BR>'; @$qa_content['custom'].='<br>'.$html.'<br>';
} }
$qa_content['focusid']=(isset($inemailhandle) && !isset($errors['emailhandle'])) ? 'password' : 'emailhandle'; $qa_content['focusid']=(isset($inemailhandle) && !isset($errors['emailhandle'])) ? 'password' : 'emailhandle';
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
require_once QA_INCLUDE_DIR.'qa-db-selects.php'; require_once QA_INCLUDE_DIR.'qa-db-selects.php';
require_once QA_INCLUDE_DIR.'qa-app-users.php'; require_once QA_INCLUDE_DIR.'qa-app-users.php';
require_once QA_INCLUDE_DIR.'qa-app-format.php'; require_once QA_INCLUDE_DIR.'qa-app-format.php';
require_once QA_INCLUDE_DIR.'qa-app-limits.php';
$handle=qa_request_part(1); $handle=qa_request_part(1);
$loginuserid=qa_get_logged_in_userid(); $loginuserid=qa_get_logged_in_userid();
...@@ -67,14 +68,7 @@ ...@@ -67,14 +68,7 @@
return include QA_INCLUDE_DIR.'qa-page-not-found.php'; return include QA_INCLUDE_DIR.'qa-page-not-found.php';
// Process sending a message to user // Check that we have permission and haven't reached the limit
$messagesent=(qa_get_state()=='message-sent');
if (qa_post_text('domessage')) {
require_once QA_INCLUDE_DIR.'qa-app-limits.php';
// Check that we haven't been blocked on volume
$errorhtml=null; $errorhtml=null;
...@@ -98,8 +92,11 @@ ...@@ -98,8 +92,11 @@
} }
// Proceed... // Process sending a message to user
$messagesent=(qa_get_state()=='message-sent');
if (qa_post_text('domessage')) {
$inmessage=qa_post_text('message'); $inmessage=qa_post_text('message');
if (!qa_check_form_security_code('message-'.$handle, qa_post_text('code'))) if (!qa_check_form_security_code('message-'.$handle, qa_post_text('code')))
...@@ -163,7 +160,7 @@ ...@@ -163,7 +160,7 @@
$qa_content['error']=@$pageerror; $qa_content['error']=@$pageerror;
$qa_content['form_message']=array( $qa_content['form_message']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'style' => 'tall', 'style' => 'tall',
...@@ -171,7 +168,7 @@ ...@@ -171,7 +168,7 @@
'message' => array( 'message' => array(
'type' => $messagesent ? 'static' : '', 'type' => $messagesent ? 'static' : '',
'label' => qa_lang_html_sub('misc/message_for_x', qa_get_one_user_html($handle, false)), 'label' => qa_lang_html_sub('misc/message_for_x', qa_get_one_user_html($handle, false)),
'tags' => 'NAME="message" ID="message"', 'tags' => 'name="message" id="message"',
'value' => qa_html(@$inmessage, $messagesent), 'value' => qa_html(@$inmessage, $messagesent),
'rows' => 8, 'rows' => 8,
'note' => qa_lang_html_sub('misc/message_explanation', qa_html(qa_opt('site_title'))), 'note' => qa_lang_html_sub('misc/message_explanation', qa_html(qa_opt('site_title'))),
...@@ -181,7 +178,7 @@ ...@@ -181,7 +178,7 @@
'buttons' => array( 'buttons' => array(
'send' => array( 'send' => array(
'tags' => 'onClick="qa_show_waiting_after(this, false);"', 'tags' => 'onclick="qa_show_waiting_after(this, false);"',
'label' => qa_lang_html('main/send_button'), 'label' => qa_lang_html('main/send_button'),
), ),
), ),
...@@ -224,7 +221,7 @@ ...@@ -224,7 +221,7 @@
$options=qa_message_html_defaults(); $options=qa_message_html_defaults();
foreach ($showmessages as $message) foreach ($showmessages as $message)
$qa_content['message_list']['messages'][]=qa_message_html_fields($message, $loginuserid, $options); $qa_content['message_list']['messages'][]=qa_message_html_fields($message, $options);
} }
} }
......
...@@ -310,7 +310,7 @@ ...@@ -310,7 +310,7 @@
*/ */
{ {
$form=array( $form=array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'style' => 'tall', 'style' => 'tall',
...@@ -318,7 +318,7 @@ ...@@ -318,7 +318,7 @@
'title' => array( 'title' => array(
'type' => $question['editable'] ? 'text' : 'static', 'type' => $question['editable'] ? 'text' : 'static',
'label' => qa_lang_html('question/q_title_label'), 'label' => qa_lang_html('question/q_title_label'),
'tags' => 'NAME="q_title"', 'tags' => 'name="q_title"',
'value' => qa_html(($question['editable'] && isset($in['title'])) ? $in['title'] : $question['title']), 'value' => qa_html(($question['editable'] && isset($in['title'])) ? $in['title'] : $question['title']),
'error' => qa_html(@$errors['title']), 'error' => qa_html(@$errors['title']),
), ),
...@@ -335,7 +335,7 @@ ...@@ -335,7 +335,7 @@
'extra' => array( 'extra' => array(
'label' => qa_html(qa_opt('extra_field_prompt')), 'label' => qa_html(qa_opt('extra_field_prompt')),
'tags' => 'NAME="q_extra"', 'tags' => 'name="q_extra"',
'value' => qa_html(isset($in['extra']) ? $in['extra'] : $question['extra']), 'value' => qa_html(isset($in['extra']) ? $in['extra'] : $question['extra']),
'error' => qa_html(@$errors['extra']), 'error' => qa_html(@$errors['extra']),
), ),
...@@ -348,12 +348,12 @@ ...@@ -348,12 +348,12 @@
'buttons' => array( 'buttons' => array(
'save' => array( 'save' => array(
'tags' => 'onClick="qa_show_waiting_after(this, false);"', 'tags' => 'onclick="qa_show_waiting_after(this, false);"',
'label' => qa_lang_html('main/save_button'), 'label' => qa_lang_html('main/save_button'),
), ),
'cancel' => array( 'cancel' => array(
'tags' => 'NAME="docancel"', 'tags' => 'name="docancel"',
'label' => qa_lang_html('main/cancel_button'), 'label' => qa_lang_html('main/cancel_button'),
), ),
), ),
...@@ -375,7 +375,7 @@ ...@@ -375,7 +375,7 @@
qa_editor_load_field($editor, $qa_content, $content, $format, 'q_content', 12, true)); qa_editor_load_field($editor, $qa_content, $content, $format, 'q_content', 12, true));
if (method_exists($editor, 'update_script')) if (method_exists($editor, 'update_script'))
$form['buttons']['save']['tags']='onClick="qa_show_waiting_after(this, false); '.$editor->update_script('q_content').'"'; $form['buttons']['save']['tags']='onclick="qa_show_waiting_after(this, false); '.$editor->update_script('q_content').'"';
$form['hidden']['q_editor']=qa_html($editorname); $form['hidden']['q_editor']=qa_html($editorname);
...@@ -411,7 +411,7 @@ ...@@ -411,7 +411,7 @@
$form['fields']['silent']=array( $form['fields']['silent']=array(
'type' => 'checkbox', 'type' => 'checkbox',
'label' => qa_lang_html('question/save_silent_label'), 'label' => qa_lang_html('question/save_silent_label'),
'tags' => 'NAME="q_silent"', 'tags' => 'name="q_silent"',
'value' => qa_html(@$in['silent']), 'value' => qa_html(@$in['silent']),
); );
...@@ -527,7 +527,7 @@ ...@@ -527,7 +527,7 @@
*/ */
{ {
$form=array( $form=array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'id' => $id, 'id' => $id,
...@@ -538,17 +538,17 @@ ...@@ -538,17 +538,17 @@
'fields' => array( 'fields' => array(
'duplicate' => array( 'duplicate' => array(
'type' => 'checkbox', 'type' => 'checkbox',
'tags' => 'NAME="q_close_duplicate" ID="q_close_duplicate" onchange="document.getElementById(\'q_close_details\').focus();"', 'tags' => 'name="q_close_duplicate" id="q_close_duplicate" onchange="document.getElementById(\'q_close_details\').focus();"',
'label' => qa_lang_html('question/close_duplicate'), 'label' => qa_lang_html('question/close_duplicate'),
'value' => @$in['duplicate'], 'value' => @$in['duplicate'],
), ),
'details' => array( 'details' => array(
'tags' => 'NAME="q_close_details" ID="q_close_details"', 'tags' => 'name="q_close_details" id="q_close_details"',
'label' => 'label' =>
'<SPAN ID="close_label_duplicate">'.qa_lang_html('question/close_original_title').' </SPAN>'. '<span id="close_label_duplicate">'.qa_lang_html('question/close_original_title').' </span>'.
'<SPAN ID="close_label_other">'.qa_lang_html('question/close_reason_title').'</SPAN>', '<span id="close_label_other">'.qa_lang_html('question/close_reason_title').'</span>',
'note' => '<SPAN ID="close_note_duplicate" STYLE="display:none;">'.qa_lang_html('question/close_original_note').'</SPAN>', 'note' => '<span id="close_note_duplicate" style="display:none;">'.qa_lang_html('question/close_original_note').'</span>',
'value' => @$in['details'], 'value' => @$in['details'],
'error' => qa_html(@$errors['details']), 'error' => qa_html(@$errors['details']),
), ),
...@@ -556,12 +556,12 @@ ...@@ -556,12 +556,12 @@
'buttons' => array( 'buttons' => array(
'close' => array( 'close' => array(
'tags' => 'onClick="qa_show_waiting_after(this, false);"', 'tags' => 'onclick="qa_show_waiting_after(this, false);"',
'label' => qa_lang_html('question/close_form_button'), 'label' => qa_lang_html('question/close_form_button'),
), ),
'cancel' => array( 'cancel' => array(
'tags' => 'NAME="docancel"', 'tags' => 'name="docancel"',
'label' => qa_lang_html('main/cancel_button'), 'label' => qa_lang_html('main/cancel_button'),
), ),
), ),
...@@ -658,7 +658,7 @@ ...@@ -658,7 +658,7 @@
$hascomments=true; $hascomments=true;
$form=array( $form=array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'id' => $id, 'id' => $id,
...@@ -677,13 +677,13 @@ ...@@ -677,13 +677,13 @@
'buttons' => array( 'buttons' => array(
'save' => array( 'save' => array(
'tags' => 'onClick="qa_show_waiting_after(this, false); '. 'tags' => 'onclick="qa_show_waiting_after(this, false); '.
(method_exists($editor, 'update_script') ? $editor->update_script($prefix.'content') : '').'"', (method_exists($editor, 'update_script') ? $editor->update_script($prefix.'content') : '').'"',
'label' => qa_lang_html('main/save_button'), 'label' => qa_lang_html('main/save_button'),
), ),
'cancel' => array( 'cancel' => array(
'tags' => 'NAME="docancel"', 'tags' => 'name="docancel"',
'label' => qa_lang_html('main/cancel_button'), 'label' => qa_lang_html('main/cancel_button'),
), ),
), ),
...@@ -719,15 +719,15 @@ ...@@ -719,15 +719,15 @@
if (count($commentonoptions)) { if (count($commentonoptions)) {
$form['fields']['tocomment']=array( $form['fields']['tocomment']=array(
'tags' => 'NAME="'.$prefix.'dotoc" ID="'.$prefix.'dotoc"', 'tags' => 'name="'.$prefix.'dotoc" id="'.$prefix.'dotoc"',
'label' => '<SPAN ID="'.$prefix.'toshown">'.qa_lang_html('question/a_convert_to_c_on').'</SPAN>'. 'label' => '<span id="'.$prefix.'toshown">'.qa_lang_html('question/a_convert_to_c_on').'</span>'.
'<SPAN ID="'.$prefix.'tohidden" STYLE="display:none;">'.qa_lang_html('question/a_convert_to_c').'</SPAN>', '<span id="'.$prefix.'tohidden" style="display:none;">'.qa_lang_html('question/a_convert_to_c').'</span>',
'type' => 'checkbox', 'type' => 'checkbox',
'tight' => true, 'tight' => true,
); );
$form['fields']['commenton']=array( $form['fields']['commenton']=array(
'tags' => 'NAME="'.$prefix.'commenton"', 'tags' => 'name="'.$prefix.'commenton"',
'id' => $prefix.'commenton', 'id' => $prefix.'commenton',
'type' => 'select', 'type' => 'select',
'note' => qa_lang_html($hascomments ? 'question/a_convert_warn_cs' : 'question/a_convert_warn'), 'note' => qa_lang_html($hascomments ? 'question/a_convert_warn_cs' : 'question/a_convert_warn'),
...@@ -757,7 +757,7 @@ ...@@ -757,7 +757,7 @@
$form['fields']['silent']=array( $form['fields']['silent']=array(
'type' => 'checkbox', 'type' => 'checkbox',
'label' => qa_lang_html('question/save_silent_label'), 'label' => qa_lang_html('question/save_silent_label'),
'tags' => 'NAME="'.$prefix.'silent"', 'tags' => 'name="'.$prefix.'silent"',
'value' => qa_html(@$in['silent']), 'value' => qa_html(@$in['silent']),
); );
...@@ -911,7 +911,7 @@ ...@@ -911,7 +911,7 @@
$editor=qa_load_editor($content, $format, $editorname); $editor=qa_load_editor($content, $format, $editorname);
$form=array( $form=array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'id' => $id, 'id' => $id,
...@@ -930,13 +930,13 @@ ...@@ -930,13 +930,13 @@
'buttons' => array( 'buttons' => array(
'save' => array( 'save' => array(
'tags' => 'onClick="qa_show_waiting_after(this, false); '. 'tags' => 'onclick="qa_show_waiting_after(this, false); '.
(method_exists($editor, 'update_script') ? $editor->update_script($prefix.'content') : '').'"', (method_exists($editor, 'update_script') ? $editor->update_script($prefix.'content') : '').'"',
'label' => qa_lang_html('main/save_button'), 'label' => qa_lang_html('main/save_button'),
), ),
'cancel' => array( 'cancel' => array(
'tags' => 'NAME="docancel"', 'tags' => 'name="docancel"',
'label' => qa_lang_html('main/cancel_button'), 'label' => qa_lang_html('main/cancel_button'),
), ),
), ),
...@@ -961,7 +961,7 @@ ...@@ -961,7 +961,7 @@
$form['fields']['silent']=array( $form['fields']['silent']=array(
'type' => 'checkbox', 'type' => 'checkbox',
'label' => qa_lang_html('question/save_silent_label'), 'label' => qa_lang_html('question/save_silent_label'),
'tags' => 'NAME="'.$prefix.'silent"', 'tags' => 'name="'.$prefix.'silent"',
'value' => qa_html(@$in['silent']), 'value' => qa_html(@$in['silent']),
); );
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
if ( (qa_clicked('q_doreshow') && $question['reshowable']) || (qa_clicked('q_doapprove') && $question['moderatable']) ) if ( (qa_clicked('q_doreshow') && $question['reshowable']) || (qa_clicked('q_doapprove') && $question['moderatable']) )
if (qa_page_q_click_check_form_code($question, $error)) { if (qa_page_q_click_check_form_code($question, $error)) {
if ($question['moderatable'] || $question['reshowimmed']) { if ($question['moderatable'] || $question['reshowimmed']) {
$status=QA_STATUS_NORMAL; $status=QA_POST_STATUS_NORMAL;
} else { } else {
$in=qa_page_q_prepare_post_for_filters($question); $in=qa_page_q_prepare_post_for_filters($question);
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
$in['queued']=$tempin; // only preserve queued status in loop $in['queued']=$tempin; // only preserve queued status in loop
} }
$status=$in['queued'] ? QA_STATUS_QUEUED : QA_STATUS_NORMAL; $status=$in['queued'] ? QA_POST_STATUS_QUEUED : QA_POST_STATUS_NORMAL;
} }
qa_question_set_status($question, $status, $userid, $handle, $cookieid, $answers, $commentsfollows, $closepost); qa_question_set_status($question, $status, $userid, $handle, $cookieid, $answers, $commentsfollows, $closepost);
...@@ -152,7 +152,7 @@ ...@@ -152,7 +152,7 @@
if ( (qa_clicked($prefix.'doreshow') && $answer['reshowable']) || (qa_clicked($prefix.'doapprove') && $answer['moderatable']) ) if ( (qa_clicked($prefix.'doreshow') && $answer['reshowable']) || (qa_clicked($prefix.'doapprove') && $answer['moderatable']) )
if (qa_page_q_click_check_form_code($answer, $error)) { if (qa_page_q_click_check_form_code($answer, $error)) {
if ($answer['moderatable'] || $answer['reshowimmed']) { if ($answer['moderatable'] || $answer['reshowimmed']) {
$status=QA_STATUS_NORMAL; $status=QA_POST_STATUS_NORMAL;
} else { } else {
$in=qa_page_q_prepare_post_for_filters($answer); $in=qa_page_q_prepare_post_for_filters($answer);
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
$in['queued']=$tempin; // only preserve queued status in loop $in['queued']=$tempin; // only preserve queued status in loop
} }
$status=$in['queued'] ? QA_STATUS_QUEUED : QA_STATUS_NORMAL; $status=$in['queued'] ? QA_POST_STATUS_QUEUED : QA_POST_STATUS_NORMAL;
} }
qa_answer_set_status($answer, $status, $userid, $handle, $cookieid, $question, $commentsfollows); qa_answer_set_status($answer, $status, $userid, $handle, $cookieid, $question, $commentsfollows);
...@@ -237,7 +237,7 @@ ...@@ -237,7 +237,7 @@
if ( (qa_clicked($prefix.'doreshow') && $comment['reshowable']) || (qa_clicked($prefix.'doapprove') && $comment['moderatable']) ) if ( (qa_clicked($prefix.'doreshow') && $comment['reshowable']) || (qa_clicked($prefix.'doapprove') && $comment['moderatable']) )
if (qa_page_q_click_check_form_code($parent, $error)) { if (qa_page_q_click_check_form_code($parent, $error)) {
if ($comment['moderatable'] || $comment['reshowimmed']) { if ($comment['moderatable'] || $comment['reshowimmed']) {
$status=QA_STATUS_NORMAL; $status=QA_POST_STATUS_NORMAL;
} else { } else {
$in=qa_page_q_prepare_post_for_filters($comment); $in=qa_page_q_prepare_post_for_filters($comment);
...@@ -249,7 +249,7 @@ ...@@ -249,7 +249,7 @@
$in['queued']=$tempin; // only preserve queued status in loop $in['queued']=$tempin; // only preserve queued status in loop
} }
$status=$in['queued'] ? QA_STATUS_QUEUED : QA_STATUS_NORMAL; $status=$in['queued'] ? QA_POST_STATUS_QUEUED : QA_POST_STATUS_NORMAL;
} }
qa_comment_set_status($comment, $status, $userid, $handle, $cookieid, $question, $parent); qa_comment_set_status($comment, $status, $userid, $handle, $cookieid, $question, $parent);
...@@ -301,6 +301,10 @@ ...@@ -301,6 +301,10 @@
function qa_page_q_click_check_form_code($post, &$error) function qa_page_q_click_check_form_code($post, &$error)
/*
Check the form security (anti-CSRF protection) for one of the buttons shown for post $post. Return true if the
security passed, otherwise return false and set an error message in $error
*/
{ {
$result=qa_check_form_security_code('buttons-'.$post['postid'], qa_post_text('code')); $result=qa_check_form_security_code('buttons-'.$post['postid'], qa_post_text('code'));
...@@ -431,6 +435,9 @@ ...@@ -431,6 +435,9 @@
function qa_page_q_prepare_post_for_filters($post) function qa_page_q_prepare_post_for_filters($post)
/*
Return the array of information to be passed to filter modules for the post in $post (from the database)
*/
{ {
$in=array( $in=array(
'content' => $post['content'], 'content' => $post['content'],
......
...@@ -278,7 +278,7 @@ ...@@ -278,7 +278,7 @@
// Prepare content for existing answers (could be added to by Ajax) // Prepare content for existing answers (could be added to by Ajax)
$qa_content['a_list']=array( $qa_content['a_list']=array(
'tags' => 'ID="a_list"', 'tags' => 'id="a_list"',
'as' => array(), 'as' => array(),
); );
...@@ -380,14 +380,14 @@ ...@@ -380,14 +380,14 @@
} }
if ($question['basetype']=='Q') { if ($question['basetype']=='Q') {
$qa_content['a_list']['title_tags']='ID="a_list_title"'; $qa_content['a_list']['title_tags']='id="a_list_title"';
if ($countfortitle==1) if ($countfortitle==1)
$qa_content['a_list']['title']=qa_lang_html('question/1_answer_title'); $qa_content['a_list']['title']=qa_lang_html('question/1_answer_title');
elseif ($countfortitle>0) elseif ($countfortitle>0)
$qa_content['a_list']['title']=qa_lang_html_sub('question/x_answers_title', $countfortitle); $qa_content['a_list']['title']=qa_lang_html_sub('question/x_answers_title', $countfortitle);
else else
$qa_content['a_list']['title_tags'].=' STYLE="display:none;" '; $qa_content['a_list']['title_tags'].=' style="display:none;" ';
} }
if (!$formrequested) if (!$formrequested)
......
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
$custom=qa_opt('show_custom_register') ? trim(qa_opt('custom_register')) : ''; $custom=qa_opt('show_custom_register') ? trim(qa_opt('custom_register')) : '';
$qa_content['form']=array( $qa_content['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'style' => 'tall', 'style' => 'tall',
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
'handle' => array( 'handle' => array(
'label' => qa_lang_html('users/handle_label'), 'label' => qa_lang_html('users/handle_label'),
'tags' => 'NAME="handle" ID="handle"', 'tags' => 'name="handle" id="handle"',
'value' => qa_html(@$inhandle), 'value' => qa_html(@$inhandle),
'error' => qa_html(@$errors['handle']), 'error' => qa_html(@$errors['handle']),
), ),
...@@ -155,14 +155,14 @@ ...@@ -155,14 +155,14 @@
'password' => array( 'password' => array(
'type' => 'password', 'type' => 'password',
'label' => qa_lang_html('users/password_label'), 'label' => qa_lang_html('users/password_label'),
'tags' => 'NAME="password" ID="password"', 'tags' => 'name="password" id="password"',
'value' => qa_html(@$inpassword), 'value' => qa_html(@$inpassword),
'error' => qa_html(@$errors['password']), 'error' => qa_html(@$errors['password']),
), ),
'email' => array( 'email' => array(
'label' => qa_lang_html('users/email_label'), 'label' => qa_lang_html('users/email_label'),
'tags' => 'NAME="email" ID="email"', 'tags' => 'name="email" id="email"',
'value' => qa_html(@$inemail), 'value' => qa_html(@$inemail),
'note' => qa_opt('email_privacy'), 'note' => qa_opt('email_privacy'),
'error' => qa_html(@$errors['email']), 'error' => qa_html(@$errors['email']),
...@@ -171,7 +171,7 @@ ...@@ -171,7 +171,7 @@
'buttons' => array( 'buttons' => array(
'register' => array( 'register' => array(
'tags' => 'onClick="qa_show_waiting_after(this, false);"', 'tags' => 'onclick="qa_show_waiting_after(this, false);"',
'label' => qa_lang_html('users/register_button'), 'label' => qa_lang_html('users/register_button'),
), ),
), ),
...@@ -194,7 +194,7 @@ ...@@ -194,7 +194,7 @@
$qa_content['form']['fields'][$userfield['title']]=array( $qa_content['form']['fields'][$userfield['title']]=array(
'label' => qa_html($label), 'label' => qa_html($label),
'tags' => 'NAME="field_'.$userfield['fieldid'].'"', 'tags' => 'name="field_'.$userfield['fieldid'].'"',
'value' => qa_html($value), 'value' => qa_html($value),
'error' => qa_html(@$errors[$userfield['fieldid']]), 'error' => qa_html(@$errors[$userfield['fieldid']]),
'rows' => ($userfield['flags'] & QA_FIELD_FLAGS_MULTI_LINE) ? 8 : null, 'rows' => ($userfield['flags'] & QA_FIELD_FLAGS_MULTI_LINE) ? 8 : null,
...@@ -212,7 +212,7 @@ ...@@ -212,7 +212,7 @@
$html=ob_get_clean(); $html=ob_get_clean();
if (strlen($html)) if (strlen($html))
@$qa_content['custom'].='<BR>'.$html.'<BR>'; @$qa_content['custom'].='<br>'.$html.'<br>';
} }
$qa_content['focusid']=isset($errors['handle']) ? 'handle' $qa_content['focusid']=isset($errors['handle']) ? 'handle'
......
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
$forgotpath=qa_path('forgot', array('e' => $inemailhandle)); $forgotpath=qa_path('forgot', array('e' => $inemailhandle));
$qa_content['form']=array( $qa_content['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'style' => 'tall', 'style' => 'tall',
...@@ -105,18 +105,18 @@ ...@@ -105,18 +105,18 @@
'fields' => array( 'fields' => array(
'email_handle' => array( 'email_handle' => array(
'label' => qa_opt('allow_login_email_only') ? qa_lang_html('users/email_label') : qa_lang_html('users/email_handle_label'), '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"', 'tags' => 'name="emailhandle" id="emailhandle"',
'value' => qa_html(@$inemailhandle), 'value' => qa_html(@$inemailhandle),
'error' => qa_html(@$errors['emailhandle']), 'error' => qa_html(@$errors['emailhandle']),
), ),
'code' => array( 'code' => array(
'label' => qa_lang_html('users/reset_code_label'), 'label' => qa_lang_html('users/reset_code_label'),
'tags' => 'NAME="code" ID="code"', 'tags' => 'name="code" id="code"',
'value' => qa_html(@$incode), 'value' => qa_html(@$incode),
'error' => qa_html(@$errors['code']), 'error' => qa_html(@$errors['code']),
'note' => qa_lang_html('users/reset_code_emailed').' - '. 'note' => qa_lang_html('users/reset_code_emailed').' - '.
'<A HREF="'.qa_html($forgotpath).'">'.qa_lang_html('users/reset_code_another').'</A>', '<a href="'.qa_html($forgotpath).'">'.qa_lang_html('users/reset_code_another').'</a>',
), ),
), ),
......
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
$qa_content['title']=qa_lang_html_sub('main/no_results_for_x', qa_html($inquery)); $qa_content['title']=qa_lang_html_sub('main/no_results_for_x', qa_html($inquery));
$qa_content['q_list']['form']=array( $qa_content['q_list']['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'hidden' => array( 'hidden' => array(
'code' => qa_get_form_security_code('vote'), 'code' => qa_get_form_security_code('vote'),
......
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
$qa_content['q_list']['title']=qa_lang_html('main/no_questions_found'); $qa_content['q_list']['title']=qa_lang_html('main/no_questions_found');
$qa_content['q_list']['form']=array( $qa_content['q_list']['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'hidden' => array( 'hidden' => array(
'code' => qa_get_form_security_code('vote'), 'code' => qa_get_form_security_code('vote'),
......
...@@ -37,9 +37,8 @@ ...@@ -37,9 +37,8 @@
$start=qa_get_start(); $start=qa_get_start();
$userid=qa_get_logged_in_userid(); $userid=qa_get_logged_in_userid();
list($populartags, $favoritetags)=qa_db_select_with_pending( $populartags=qa_db_select_with_pending(
qa_db_popular_tags_selectspec($start, qa_opt_if_loaded('page_size_tags')), qa_db_popular_tags_selectspec($start, qa_opt_if_loaded('page_size_tags'))
isset($userid) ? qa_db_user_favorite_tags_selectspec($userid) : null
); );
$tagcount=qa_opt('cache_tagcount'); $tagcount=qa_opt('cache_tagcount');
...@@ -59,15 +58,12 @@ ...@@ -59,15 +58,12 @@
); );
if (count($populartags)) { if (count($populartags)) {
$favoritemap=array(); $favoritemap=qa_get_favorite_non_qs_map();
if (isset($favoritetags))
foreach ($favoritetags as $wordandcount)
$favoritemap[$wordandcount['word']]=true;
$output=0; $output=0;
foreach ($populartags as $word => $count) { foreach ($populartags as $word => $count) {
$qa_content['ranking']['items'][]=array( $qa_content['ranking']['items'][]=array(
'label' => qa_tag_html($word, false, @$favoritemap[$word]), 'label' => qa_tag_html($word, false, @$favoritemap['tag'][qa_strtolower($word)]),
'count' => number_format($count), 'count' => number_format($count),
); );
......
...@@ -70,8 +70,8 @@ ...@@ -70,8 +70,8 @@
if ($unsubscribed) if ($unsubscribed)
$qa_content['error']=strtr(qa_lang_html('users/unsubscribe_complete'), array( $qa_content['error']=strtr(qa_lang_html('users/unsubscribe_complete'), array(
'^0' => qa_html(qa_opt('site_title')), '^0' => qa_html(qa_opt('site_title')),
'^1' => '<A HREF="'.qa_path_html('account').'">', '^1' => '<a href="'.qa_path_html('account').'">',
'^2' => '</A>', '^2' => '</a>',
)); ));
else else
$qa_content['error']=qa_insert_login_links(qa_lang_html('users/unsubscribe_wrong_log_in'), 'unsubscribe'); $qa_content['error']=qa_insert_login_links(qa_lang_html('users/unsubscribe_wrong_log_in'), 'unsubscribe');
......
...@@ -85,8 +85,8 @@ ...@@ -85,8 +85,8 @@
null, // prefix for links in category navigation null, // prefix for links in category navigation
null, // prefix for RSS feed paths (null to hide) null, // prefix for RSS feed paths (null to hide)
$forfavorites ? strtr(qa_lang_html('misc/suggest_update_favorites'), array( $forfavorites ? strtr(qa_lang_html('misc/suggest_update_favorites'), array(
'^1' => '<A HREF="'.qa_path_html('favorites').'">', '^1' => '<a href="'.qa_path_html('favorites').'">',
'^2' => '</A>', '^2' => '</a>',
)) : null // suggest what to do next )) : null // suggest what to do next
); );
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
File: qa-include/qa-page-user-activity.php File: qa-include/qa-page-user-activity.php
Version: See define()s at top of qa-include/qa-base.php Version: See define()s at top of qa-include/qa-base.php
Description: Controller for user profile page Description: Controller for user page showing recent activity
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
// Recent activity by this user // Recent activity by this user
$qa_content['q_list']['form']=array( $qa_content['q_list']['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'hidden' => array( 'hidden' => array(
'code' => qa_get_form_security_code('vote'), 'code' => qa_get_form_security_code('vote'),
...@@ -84,11 +84,12 @@ ...@@ -84,11 +84,12 @@
$htmldefaults=qa_post_html_defaults('Q'); $htmldefaults=qa_post_html_defaults('Q');
$htmldefaults['whoview']=false; $htmldefaults['whoview']=false;
$htmldefaults['voteview']=false;
$htmldefaults['avatarsize']=0; $htmldefaults['avatarsize']=0;
foreach ($questions as $question) foreach ($questions as $question)
$qa_content['q_list']['qs'][]=qa_any_to_q_html_fields($question, $loginuserid, qa_cookie_get(), $qa_content['q_list']['qs'][]=qa_any_to_q_html_fields($question, $loginuserid, qa_cookie_get(),
$usershtml, null, qa_post_html_options($question, $htmldefaults)); $usershtml, null, array('voteview' => false) + qa_post_html_options($question, $htmldefaults));
// Sub menu for navigation in user pages // Sub menu for navigation in user pages
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
File: qa-include/qa-page-user-answers.php File: qa-include/qa-page-user-answers.php
Version: See define()s at top of qa-include/qa-base.php Version: See define()s at top of qa-include/qa-base.php
Description: Controller for user profile page Description: Controller for user page showing all user's answers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
$pagesize=qa_opt('page_size_activity'); $pagesize=qa_opt('page_size_activity');
$count=(int)@$userpoints['aposts']; $count=(int)@$userpoints['aposts'];
$questions=array_slice(qa_any_sort_and_dedupe($questions), 0, $pagesize); $questions=array_slice($questions, 0, $pagesize);
$usershtml=qa_userids_handles_html($questions, false); $usershtml=qa_userids_handles_html($questions, false);
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
// Recent questions by this user // Recent questions by this user
$qa_content['q_list']['form']=array( $qa_content['q_list']['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'hidden' => array( 'hidden' => array(
'code' => qa_get_form_security_code('vote'), 'code' => qa_get_form_security_code('vote'),
...@@ -86,10 +86,15 @@ ...@@ -86,10 +86,15 @@
$htmldefaults=qa_post_html_defaults('Q'); $htmldefaults=qa_post_html_defaults('Q');
$htmldefaults['whoview']=false; $htmldefaults['whoview']=false;
$htmldefaults['avatarsize']=0; $htmldefaults['avatarsize']=0;
$htmldefaults['ovoteview']=true;
foreach ($questions as $question) {
$options=qa_post_html_options($question, $htmldefaults);
$options['voteview']=qa_get_vote_view('A', false, false);
foreach ($questions as $question)
$qa_content['q_list']['qs'][]=qa_other_to_q_html_fields($question, $loginuserid, qa_cookie_get(), $qa_content['q_list']['qs'][]=qa_other_to_q_html_fields($question, $loginuserid, qa_cookie_get(),
$usershtml, null, qa_post_html_options($question, $htmldefaults)); $usershtml, null, $options);
}
$qa_content['page_links']=qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next')); $qa_content['page_links']=qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'));
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
File: qa-include/qa-page-user-questions.php File: qa-include/qa-page-user-questions.php
Version: See define()s at top of qa-include/qa-base.php Version: See define()s at top of qa-include/qa-base.php
Description: Controller for user profile page Description: Controller for user page showing all user's questions
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
// Recent questions by this user // Recent questions by this user
$qa_content['q_list']['form']=array( $qa_content['q_list']['form']=array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'hidden' => array( 'hidden' => array(
'code' => qa_get_form_security_code('vote'), 'code' => qa_get_form_security_code('vote'),
......
<?php
/*
Question2Answer (c) Gideon Greenspan
http://www.question2answer.org/
File: qa-include/qa-page-user-wall.php
Version: See define()s at top of qa-include/qa-base.php
Description: Controller for user page showing all user wall posts
This program is free software; you can redistribute it and/or
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
GNU General Public License for more details.
More about this license: http://www.question2answer.org/license.php
*/
if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser
header('Location: ../');
exit;
}
require_once QA_INCLUDE_DIR.'qa-db-selects.php';
require_once QA_INCLUDE_DIR.'qa-app-messages.php';
// Check we're not using single-sign on integration, which doesn't allow walls
if (QA_FINAL_EXTERNAL_USERS)
qa_fatal_error('User accounts are handled by external code');
// $handle, $userhtml are already set by qa-page-user.php
$start=qa_get_start();
// Find the questions for this user
list($useraccount, $usermessages)=qa_db_select_with_pending(
qa_db_user_account_selectspec($handle, false),
qa_db_recent_messages_selectspec(null, null, $handle, false, qa_opt_if_loaded('page_size_wall'), $start)
);
if (!is_array($useraccount)) // check the user exists
return include QA_INCLUDE_DIR.'qa-page-not-found.php';
// Perform pagination
$pagesize=qa_opt('page_size_wall');
$count=$useraccount['wallposts'];
$usermessages=array_slice($usermessages, 0, $pagesize);
// Prepare content for theme
$qa_content=qa_content_prepare();
$qa_content['title']=qa_lang_html_sub('profile/wall_for_x', $userhtml);
$qa_content['message_list']=array('messages' => array());
foreach ($usermessages as $message)
$qa_content['message_list']['messages'][]=qa_wall_post_view($message);
$qa_content['page_links']=qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'));
// Sub menu for navigation in user pages
$qa_content['navigation']['sub']=qa_user_sub_navigation($handle, 'wall');
return $qa_content;
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
...@@ -56,6 +56,11 @@ ...@@ -56,6 +56,11 @@
// Display the appropriate page based on the request // Display the appropriate page based on the request
switch (qa_request_part(2)) { switch (qa_request_part(2)) {
case 'wall':
qa_set_template('user-wall');
$qa_content=include QA_INCLUDE_DIR.'qa-page-user-wall.php';
break;
case 'activity': case 'activity':
qa_set_template('user-activity'); qa_set_template('user-activity');
$qa_content=include QA_INCLUDE_DIR.'qa-page-user-activity.php'; $qa_content=include QA_INCLUDE_DIR.'qa-page-user-activity.php';
......
...@@ -264,8 +264,8 @@ ...@@ -264,8 +264,8 @@
if (qa_get_logged_in_level()>=QA_USER_LEVEL_ADMIN) { if (qa_get_logged_in_level()>=QA_USER_LEVEL_ADMIN) {
if (!isset($qa_content['error'])) if (!isset($qa_content['error']))
$qa_content['error']=strtr(qa_lang_html('admin/maintenance_admin_only'), array( $qa_content['error']=strtr(qa_lang_html('admin/maintenance_admin_only'), array(
'^1' => '<A HREF="'.qa_path_html('admin/general').'">', '^1' => '<a href="'.qa_path_html('admin/general').'">',
'^2' => '</A>', '^2' => '</a>',
)); ));
} else { } else {
...@@ -284,23 +284,23 @@ ...@@ -284,23 +284,23 @@
$qa_content=qa_content_prepare(); $qa_content=qa_content_prepare();
$qa_content['title']=qa_lang_html('users/confirm_title'); $qa_content['title']=qa_lang_html('users/confirm_title');
$qa_content['error']=strtr(qa_lang_html('users/confirm_required'), array( $qa_content['error']=strtr(qa_lang_html('users/confirm_required'), array(
'^1' => '<A HREF="'.qa_path_html('confirm').'">', '^1' => '<a href="'.qa_path_html('confirm').'">',
'^2' => '</A>', '^2' => '</a>',
)); ));
} elseif ( ($flags & QA_USER_FLAGS_MUST_APPROVE) && (qa_get_logged_in_level()<QA_USER_LEVEL_APPROVED) && qa_opt('moderate_users') ) { } elseif ( ($flags & QA_USER_FLAGS_MUST_APPROVE) && (qa_get_logged_in_level()<QA_USER_LEVEL_APPROVED) && qa_opt('moderate_users') ) {
$qa_content=qa_content_prepare(); $qa_content=qa_content_prepare();
$qa_content['title']=qa_lang_html('users/approve_title'); $qa_content['title']=qa_lang_html('users/approve_title');
$qa_content['error']=strtr(qa_lang_html('users/approve_required'), array( $qa_content['error']=strtr(qa_lang_html('users/approve_required'), array(
'^1' => '<A HREF="'.qa_path_html('account').'">', '^1' => '<a href="'.qa_path_html('account').'">',
'^2' => '</A>', '^2' => '</a>',
)); ));
} }
} }
// Combine various Javascript elements in $qa_content into single array for theme layer // Combine various Javascript elements in $qa_content into single array for theme layer
$script=array('<SCRIPT TYPE="text/javascript">'); $script=array('<script type="text/javascript">');
if (isset($qa_content['script_var'])) if (isset($qa_content['script_var']))
foreach ($qa_content['script_var'] as $var => $value) foreach ($qa_content['script_var'] as $var => $value)
...@@ -340,18 +340,18 @@ ...@@ -340,18 +340,18 @@
$script[]='};'; $script[]='};';
} }
$script[]='</SCRIPT>'; $script[]='</script>';
if (isset($qa_content['script_rel'])) { if (isset($qa_content['script_rel'])) {
$uniquerel=array_unique($qa_content['script_rel']); // remove any duplicates $uniquerel=array_unique($qa_content['script_rel']); // remove any duplicates
foreach ($uniquerel as $script_rel) foreach ($uniquerel as $script_rel)
$script[]='<SCRIPT SRC="'.qa_html(qa_path_to_root().$script_rel).'" TYPE="text/javascript"></SCRIPT>'; $script[]='<script src="'.qa_html(qa_path_to_root().$script_rel).'" type="text/javascript"></script>';
} }
if (isset($qa_content['script_src'])) { if (isset($qa_content['script_src'])) {
$uniquesrc=array_unique($qa_content['script_src']); // remove any duplicates $uniquesrc=array_unique($qa_content['script_src']); // remove any duplicates
foreach ($uniquesrc as $script_src) foreach ($uniquesrc as $script_src)
$script[]='<SCRIPT SRC="'.qa_html($script_src).'" TYPE="text/javascript"></SCRIPT>'; $script[]='<script src="'.qa_html($script_src).'" type="text/javascript"></script>';
} }
$qa_content['script']=$script; $qa_content['script']=$script;
...@@ -595,10 +595,10 @@ ...@@ -595,10 +595,10 @@
$qa_content['search']=array( $qa_content['search']=array(
'form_tags' => 'METHOD="GET" ACTION="'.qa_path_html('search').'"', 'form_tags' => 'method="get" action="'.qa_path_html('search').'"',
'form_extra' => qa_path_form_html('search'), 'form_extra' => qa_path_form_html('search'),
'title' => qa_lang_html('main/search_title'), 'title' => qa_lang_html('main/search_title'),
'field_tags' => 'NAME="q"', 'field_tags' => 'name="q"',
'button_label' => qa_lang_html('main/search_button'), 'button_label' => qa_lang_html('main/search_button'),
); );
...@@ -648,12 +648,12 @@ ...@@ -648,12 +648,12 @@
$logoheight=qa_opt('logo_height'); $logoheight=qa_opt('logo_height');
if ($logoshow) if ($logoshow)
$qa_content['logo']='<A HREF="'.qa_path_html('').'" CLASS="qa-logo-link" TITLE="'.qa_html(qa_opt('site_title')).'">'. $qa_content['logo']='<a href="'.qa_path_html('').'" class="qa-logo-link" title="'.qa_html(qa_opt('site_title')).'">'.
'<IMG SRC="'.qa_html(is_numeric(strpos($logourl, '://')) ? $logourl : qa_path_to_root().$logourl).'"'. '<img src="'.qa_html(is_numeric(strpos($logourl, '://')) ? $logourl : qa_path_to_root().$logourl).'"'.
($logowidth ? (' WIDTH="'.$logowidth.'"') : '').($logoheight ? (' HEIGHT="'.$logoheight.'"') : ''). ($logowidth ? (' width="'.$logowidth.'"') : '').($logoheight ? (' height="'.$logoheight.'"') : '').
' BORDER="0" ALT="'.qa_html(qa_opt('site_title')).'"/></A>'; ' border="0" alt="'.qa_html(qa_opt('site_title')).'"/></a>';
else else
$qa_content['logo']='<A HREF="'.qa_path_html('').'" CLASS="qa-logo-link">'.qa_html(qa_opt('site_title')).'</A>'; $qa_content['logo']='<a href="'.qa_path_html('').'" class="qa-logo-link">'.qa_html(qa_opt('site_title')).'</a>';
$topath=qa_get('to'); // lets user switch between login and register without losing destination page $topath=qa_get('to'); // lets user switch between login and register without losing destination page
......
...@@ -27,12 +27,12 @@ ...@@ -27,12 +27,12 @@
if (qa_gpc_to_string(@$_GET['param'])==QA_URL_TEST_STRING) { if (qa_gpc_to_string(@$_GET['param'])==QA_URL_TEST_STRING) {
require_once QA_INCLUDE_DIR.'qa-app-admin.php'; require_once QA_INCLUDE_DIR.'qa-app-admin.php';
echo '<HTML><BODY STYLE="margin:0; padding:0;">'; echo '<html><body style="margin:0; padding:0;">';
echo '<TABLE WIDTH="100%" HEIGHT="100%" CELLSPACING="0" CELLPADDING="0">'; echo '<table width="100%" height="100%" cellspacing="0" cellpadding="0">';
echo '<TR VALIGN="middle"><TD ALIGN="center" STYLE="border-style:solid; border-width:1px; background-color:#fff; '; echo '<tr valign="middle"><td align="center" style="border-style:solid; border-width:1px; background-color:#fff; ';
echo qa_admin_url_test_html(); echo qa_admin_url_test_html();
echo '/TD></TR></TABLE>'; echo '/td></tr></table>';
echo '</BODY></HTML>'; echo '</body></html>';
} }
......
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
*/ */
{ {
return sprintf( return sprintf(
"%s &ndash; <B>%.1fms</B> (%d%%) &ndash; PHP %.1fms (%d%%), MySQL %.1fms (%d%%), Other %.1fms (%d%%) &ndash; %d PHP %s, %d DB %s, %dk RAM (%d%%)", "%s &ndash; <b>%.1fms</b> (%d%%) &ndash; PHP %.1fms (%d%%), MySQL %.1fms (%d%%), Other %.1fms (%d%%) &ndash; %d PHP %s, %d DB %s, %dk RAM (%d%%)",
$stage, $usage['clock']*1000, $usage['clock']*100/$totalusage['clock'], $stage, $usage['clock']*1000, $usage['clock']*100/$totalusage['clock'],
$usage['cpu']*1000, $usage['cpu']*100/$totalusage['clock'], $usage['cpu']*1000, $usage['cpu']*100/$totalusage['clock'],
$usage['mysql']*1000, $usage['mysql']*100/$totalusage['clock'], $usage['mysql']*1000, $usage['mysql']*100/$totalusage['clock'],
...@@ -117,28 +117,28 @@ ...@@ -117,28 +117,28 @@
{ {
global $qa_usage_start, $qa_usage_stages, $qa_database_queries; global $qa_usage_start, $qa_usage_stages, $qa_database_queries;
echo '<P><BR><TABLE BGCOLOR="#CCCCCC" CELLPADDING="8" CELLSPACING="0" WIDTH="100%">'; echo '<p><br><table bgcolor="#cccccc" cellpadding="8" cellspacing="0" width="100%">';
echo '<TR><TD COLSPAN="2">'; echo '<tr><td colspan="2">';
$totaldelta=qa_usage_delta($qa_usage_start, qa_usage_get()); $totaldelta=qa_usage_delta($qa_usage_start, qa_usage_get());
echo qa_usage_line('Total', $totaldelta, $totaldelta).'<BR>'; echo qa_usage_line('Total', $totaldelta, $totaldelta).'<br>';
foreach ($qa_usage_stages as $stage => $stagedelta) foreach ($qa_usage_stages as $stage => $stagedelta)
echo '<BR>'.qa_usage_line(ucfirst($stage), $stagedelta, $totaldelta); echo '<br>'.qa_usage_line(ucfirst($stage), $stagedelta, $totaldelta);
echo '</TD></TR><TR VALIGN="bottom"><TD WIDTH="30%"><TEXTAREA COLS="40" ROWS="20" STYLE="width:100%;">'; echo '</td></tr><tr valign="bottom"><td width="30%"><textarea cols="40" rows="20" style="width:100%;">';
foreach (get_included_files() as $file) foreach (get_included_files() as $file)
echo qa_html(implode('/', array_slice(explode('/', $file), -3)))."\n"; echo qa_html(implode('/', array_slice(explode('/', $file), -3)))."\n";
echo '</TEXTAREA></TD>'; echo '</textarea></td>';
echo '<TD WIDTH="70%"><TEXTAREA COLS="40" ROWS="20" STYLE="width:100%;">'.qa_html($qa_database_queries).'</TEXTAREA></TD>'; echo '<td width="70%"><textarea cols="40" rows="20" style="width:100%;">'.qa_html($qa_database_queries).'</textarea></td>';
echo '</TR></TABLE>'; echo '</tr></table>';
} }
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
if ($format=='html') { if ($format=='html') {
$html=qa_sanitize_html($content, @$options['linksnewwindow'], false); // sanitize again for display, for extra safety, and due to new window setting $html=qa_sanitize_html($content, @$options['linksnewwindow'], false); // sanitize again for display, for extra safety, and due to new window setting
if (isset($options['blockwordspreg'])) { // filtering out blocked words inline within HTML is pretty complex, e.g. p<B>oo</B>p must be caught if (isset($options['blockwordspreg'])) { // filtering out blocked words inline within HTML is pretty complex, e.g. p<b>oo</b>p must be caught
require_once QA_INCLUDE_DIR.'qa-util-string.php'; require_once QA_INCLUDE_DIR.'qa-util-string.php';
$html=preg_replace('/<\s*('.$this->htmllineseparators.')[^A-Za-z0-9]/i', "\n\\0", $html); // tags to single new line $html=preg_replace('/<\s*('.$this->htmllineseparators.')[^A-Za-z0-9]/i', "\n\\0", $html); // tags to single new line
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
$htmlunlinkeds=array_reverse(preg_split('|<[Aa]\s+[^>]+>.*</[Aa]\s*>|', $html, -1, PREG_SPLIT_OFFSET_CAPTURE)); // start from end so we substitute correctly $htmlunlinkeds=array_reverse(preg_split('|<[Aa]\s+[^>]+>.*</[Aa]\s*>|', $html, -1, PREG_SPLIT_OFFSET_CAPTURE)); // start from end so we substitute correctly
foreach ($htmlunlinkeds as $htmlunlinked) { // and that we don't detect links inside HTML, e.g. <IMG SRC="http://..."> foreach ($htmlunlinkeds as $htmlunlinked) { // and that we don't detect links inside HTML, e.g. <img src="http://...">
$thishtmluntaggeds=array_reverse(preg_split('/<[^>]*>/', $htmlunlinked[0], -1, PREG_SPLIT_OFFSET_CAPTURE)); // again, start from end $thishtmluntaggeds=array_reverse(preg_split('/<[^>]*>/', $htmlunlinked[0], -1, PREG_SPLIT_OFFSET_CAPTURE)); // again, start from end
foreach ($thishtmluntaggeds as $thishtmluntagged) { foreach ($thishtmluntaggeds as $thishtmluntagged) {
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
function output_widget($region, $place, $themeobject, $template, $request, $qa_content) function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{ {
$themeobject->output('<DIV CLASS="qa-activity-count">'); $themeobject->output('<div class="qa-activity-count">');
$this->output_count($themeobject, qa_opt('cache_qcount'), 'main/1_question', 'main/x_questions'); $this->output_count($themeobject, qa_opt('cache_qcount'), 'main/1_question', 'main/x_questions');
$this->output_count($themeobject, qa_opt('cache_acount'), 'main/1_answer', 'main/x_answers'); $this->output_count($themeobject, qa_opt('cache_acount'), 'main/1_answer', 'main/x_answers');
...@@ -50,20 +50,20 @@ ...@@ -50,20 +50,20 @@
$this->output_count($themeobject, qa_opt('cache_userpointscount'), 'main/1_user', 'main/x_users'); $this->output_count($themeobject, qa_opt('cache_userpointscount'), 'main/1_user', 'main/x_users');
$themeobject->output('</DIV>'); $themeobject->output('</div>');
} }
function output_count($themeobject, $value, $langsingular, $langplural) function output_count($themeobject, $value, $langsingular, $langplural)
{ {
$themeobject->output('<P CLASS="qa-activity-count-item">'); $themeobject->output('<p class="qa-activity-count-item">');
if ($value==1) if ($value==1)
$themeobject->output(qa_lang_html_sub($langsingular, '<SPAN CLASS="qa-activity-count-data">1</SPAN>', '1')); $themeobject->output(qa_lang_html_sub($langsingular, '<span class="qa-activity-count-data">1</span>', '1'));
else else
$themeobject->output(qa_lang_html_sub($langplural, '<SPAN CLASS="qa-activity-count-data">'.number_format((int)$value).'</SPAN>')); $themeobject->output(qa_lang_html_sub($langplural, '<span class="qa-activity-count-data">'.number_format((int)$value).'</span>'));
$themeobject->output('</P>'); $themeobject->output('</p>');
} }
} }
......
...@@ -75,29 +75,29 @@ ...@@ -75,29 +75,29 @@
else else
$params=null; $params=null;
?> ?>
<DIV CLASS="qa-ask-box"> <div class="qa-ask-box">
<FORM METHOD="POST" ACTION="<?php echo qa_path_html('ask', $params); ?>"> <form method="post" action="<?php echo qa_path_html('ask', $params); ?>">
<TABLE CLASS="qa-form-tall-table" STYLE="width:100%"> <table class="qa-form-tall-table" style="width:100%">
<TR STYLE="vertical-align:middle;"> <tr style="vertical-align:middle;">
<TD CLASS="qa-form-tall-label" STYLE="padding:8px; white-space:nowrap; <?php echo ($region=='side') ? 'padding-bottom:0;' : 'text-align:right;'?>" WIDTH="1"> <td class="qa-form-tall-label" style="padding:8px; white-space:nowrap; <?php echo ($region=='side') ? 'padding-bottom:0;' : 'text-align:right;'?>" width="1">
<?php echo strtr(qa_lang_html('question/ask_title'), array(' ' => '&nbsp;'))?>: <?php echo strtr(qa_lang_html('question/ask_title'), array(' ' => '&nbsp;'))?>:
</TD> </td>
<?php <?php
if ($region=='side') { if ($region=='side') {
?> ?>
</TR> </tr>
<TR> <tr>
<?php <?php
} }
?> ?>
<TD CLASS="qa-form-tall-data" STYLE="padding:8px;" WIDTH="*"> <td class="qa-form-tall-data" style="padding:8px;" width="*">
<INPUT NAME="title" TYPE="text" CLASS="qa-form-tall-text" STYLE="width:95%;"> <input name="title" type="text" class="qa-form-tall-text" style="width:95%;">
</TD> </td>
</TR> </tr>
</TABLE> </table>
<INPUT TYPE="hidden" NAME="doask1" VALUE="1"> <input type="hidden" name="doask1" value="1">
</FORM> </form>
</DIV> </div>
<?php <?php
} }
......
...@@ -65,32 +65,32 @@ ...@@ -65,32 +65,32 @@
if ($region=='side') { if ($region=='side') {
$themeobject->output( $themeobject->output(
'<DIV CLASS="qa-related-qs">', '<div class="qa-related-qs">',
'<H2 STYLE="margin-top:0; padding-top:0;">', '<h2 style="margin-top:0; padding-top:0;">',
$titlehtml, $titlehtml,
'</H2>' '</h2>'
); );
$themeobject->output('<UL CLASS="qa-related-q-list">'); $themeobject->output('<ul class="qa-related-q-list">');
foreach ($questions as $question) 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('<li class="qa-related-q-item"><a href="'.qa_q_path_html($question['postid'], $question['title']).'">'.qa_html($question['title']).'</a></li>');
$themeobject->output( $themeobject->output(
'</UL>', '</ul>',
'</DIV>' '</div>'
); );
} else { } else {
$themeobject->output( $themeobject->output(
'<H2>', '<h2>',
$titlehtml, $titlehtml,
'</H2>' '</h2>'
); );
$q_list=array( $q_list=array(
'form' => array( 'form' => array(
'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
'hidden' => array( 'hidden' => array(
'code' => qa_get_form_security_code('vote'), 'code' => qa_get_form_security_code('vote'),
......
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