Commit cdee121e by Scott

Merge branch 'dev' into 1.8

parents f22e8abb 2fcf4966
...@@ -367,7 +367,7 @@ ...@@ -367,7 +367,7 @@
else else
switch ($name) { switch ($name) {
case 'site_url': case 'site_url':
$value='http://'.@$_SERVER['HTTP_HOST'].strtr(dirname($_SERVER['SCRIPT_NAME']), '\\', '/').'/'; $value='http://'.@$_SERVER['HTTP_HOST'].strtr(rtrim(dirname($_SERVER['SCRIPT_NAME']), '/'), '\\', '/').'/';
break; break;
case 'site_title': case 'site_title':
......
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
'userlevels' => array( 'userlevels' => array(
'userid' => $useridcoltype.' NOT NULL', // the user who has this level 'userid' => $useridcoltype.' NOT NULL', // the user who has this level
'entitytype' => "CHAR(1) CHARACTER SET ascii NOT NULL", // see qa-app-updates.php 'entitytype' => 'CHAR(1) CHARACTER SET ascii NOT NULL', // see qa-app-updates.php
'entityid' => 'INT UNSIGNED NOT NULL', // relevant postid / userid / tag wordid / categoryid 'entityid' => 'INT UNSIGNED NOT NULL', // relevant postid / userid / tag wordid / categoryid
'level' => 'TINYINT UNSIGNED', // if not NULL, special permission level for that user and that entity 'level' => 'TINYINT UNSIGNED', // if not NULL, special permission level for that user and that entity
'UNIQUE userid (userid, entitytype, entityid)', 'UNIQUE userid (userid, entitytype, entityid)',
...@@ -180,7 +180,7 @@ ...@@ -180,7 +180,7 @@
'userfavorites' => array( 'userfavorites' => array(
'userid' => $useridcoltype.' NOT NULL', // the user who favorited the entity 'userid' => $useridcoltype.' NOT NULL', // the user who favorited the entity
'entitytype' => "CHAR(1) CHARACTER SET ascii NOT NULL", // see qa-app-updates.php 'entitytype' => 'CHAR(1) CHARACTER SET ascii NOT NULL', // see qa-app-updates.php
'entityid' => 'INT UNSIGNED NOT NULL', // favorited postid / userid / tag wordid / categoryid 'entityid' => 'INT UNSIGNED NOT NULL', // favorited postid / userid / tag wordid / categoryid
'nouserevents' => 'TINYINT UNSIGNED NOT NULL', // do we skip writing events to the user stream? 'nouserevents' => 'TINYINT UNSIGNED NOT NULL', // do we skip writing events to the user stream?
'PRIMARY KEY (userid, entitytype, entityid)', 'PRIMARY KEY (userid, entitytype, entityid)',
...@@ -201,7 +201,7 @@ ...@@ -201,7 +201,7 @@
'userevents' => array( 'userevents' => array(
'userid' => $useridcoltype.' NOT NULL', // the user to be informed about this event in their updates 'userid' => $useridcoltype.' NOT NULL', // the user to be informed about this event in their updates
'entitytype' => "CHAR(1) CHARACTER SET ascii NOT NULL", // see qa-app-updates.php 'entitytype' => 'CHAR(1) CHARACTER SET ascii NOT NULL', // see qa-app-updates.php
'entityid' => 'INT UNSIGNED NOT NULL', // favorited source of event - see userfavorites table - 0 means not from a favorite 'entityid' => 'INT UNSIGNED NOT NULL', // favorited source of event - see userfavorites table - 0 means not from a favorite
'questionid' => 'INT UNSIGNED NOT NULL', // the affected question 'questionid' => 'INT UNSIGNED NOT NULL', // the affected question
'lastpostid' => 'INT UNSIGNED NOT NULL', // what part of question was affected 'lastpostid' => 'INT UNSIGNED NOT NULL', // what part of question was affected
...@@ -213,7 +213,7 @@ ...@@ -213,7 +213,7 @@
), ),
'sharedevents' => array( 'sharedevents' => array(
'entitytype' => "CHAR(1) CHARACTER SET ascii NOT NULL", // see qa-app-updates.php 'entitytype' => 'CHAR(1) CHARACTER SET ascii NOT NULL', // see qa-app-updates.php
'entityid' => 'INT UNSIGNED NOT NULL', // see userfavorites table 'entityid' => 'INT UNSIGNED NOT NULL', // see userfavorites table
'questionid' => 'INT UNSIGNED NOT NULL', // see userevents table 'questionid' => 'INT UNSIGNED NOT NULL', // see userevents table
'lastpostid' => 'INT UNSIGNED NOT NULL', // see userevents table 'lastpostid' => 'INT UNSIGNED NOT NULL', // see userevents table
......
...@@ -93,7 +93,8 @@ ...@@ -93,7 +93,8 @@
function qa_db_post_set_parent($postid, $parentid, $lastuserid=null, $lastip=null) function qa_db_post_set_parent($postid, $parentid, $lastuserid=null, $lastip=null)
/* /*
Set the parent in the database of $postid to $parentid, and optionally record that $lastuserid did it from $lastip (if at least one is specified) Set the parent in the database of $postid to $parentid, and optionally record that $lastuserid did it from $lastip
(if at least one is specified)
*/ */
{ {
if (isset($lastuserid) || isset($lastip)) if (isset($lastuserid) || isset($lastip))
...@@ -143,7 +144,8 @@ ...@@ -143,7 +144,8 @@
function qa_db_post_set_category($postid, $categoryid, $lastuserid=null, $lastip=null) function qa_db_post_set_category($postid, $categoryid, $lastuserid=null, $lastip=null)
/* /*
Set the (exact) category in the database of $postid to $categoryid, and optionally record that $lastuserid did it from $lastip (if at least one is specified) Set the (exact) category in the database of $postid to $categoryid, and optionally record that $lastuserid did it from
$lastip (if at least one is specified)
*/ */
{ {
if (isset($lastuserid) || isset($lastip)) if (isset($lastuserid) || isset($lastip))
...@@ -192,7 +194,7 @@ ...@@ -192,7 +194,7 @@
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. Set the last updated date of $postid to $updated, which is a unix timestamp. If updated is null, set to now.
*/ */
{ {
if (isset($updated)) if (isset($updated))
...@@ -318,7 +320,7 @@ ...@@ -318,7 +320,7 @@
function qa_db_posts_filter_q_postids($postids) function qa_db_posts_filter_q_postids($postids)
/* /*
Return the array $postids containing only those elements which are the postid of a qustion in the database Return the array $postids containing only those elements which are the postid of a question in the database
*/ */
{ {
if (count($postids)) if (count($postids))
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
function qa_db_user_get_userid_handles($userids) function qa_db_user_get_userid_handles($userids)
/* /*
Return an array mapping mapping each userid in $userids that can be found to that user's handle Return an array mapping each userid in $userids that can be found to that user's handle
*/ */
{ {
if (count($userids)) if (count($userids))
......
...@@ -86,10 +86,10 @@ ...@@ -86,10 +86,10 @@
'no_blocked_users' => 'No blocked users found', 'no_blocked_users' => 'No blocked users found',
'no_permission' => 'You do not have permission to perform this operation', 'no_permission' => 'You do not have permission to perform this operation',
'old_password' => 'Old password:', 'old_password' => 'Old password:',
'only_shown_admins' => '(only shown to admins)', 'only_shown_admins' => '(only shown to you and admins)',
'only_shown_editors' => '(only shown to editors and above)', 'only_shown_editors' => '(only shown to you, editors and above)',
'only_shown_experts' => '(only shown to experts and above)', 'only_shown_experts' => '(only shown to you, experts and above)',
'only_shown_moderators' => '(only shown to moderators and admins)', 'only_shown_moderators' => '(only shown to you, moderators and admins)',
'password_changed' => 'Password changed', 'password_changed' => 'Password changed',
'password_label' => 'Password:', 'password_label' => 'Password:',
'password_min' => 'Password must be at least ^ characters', 'password_min' => 'Password must be at least ^ characters',
......
...@@ -914,7 +914,7 @@ if ($recalchotness) { ...@@ -914,7 +914,7 @@ if ($recalchotness) {
); );
} else { // rudimentary non-Javascript version of mass mailing loop } else { // rudimentary non-Javascript version of mass mailing loop
echo '<tt>'; echo '<code>';
while (true) { while (true) {
qa_mailing_perform_step(); qa_mailing_perform_step();
...@@ -930,7 +930,7 @@ if ($recalchotness) { ...@@ -930,7 +930,7 @@ if ($recalchotness) {
sleep(1); sleep(1);
} }
echo qa_lang_html('admin/mailing_complete') . '</tt><p><a href="' . qa_path_html('admin/mailing') . '">' . qa_lang_html('admin/admin_title') . ' - ' . qa_lang_html('admin/mailing_title') . '</a>'; echo qa_lang_html('admin/mailing_complete').'</code><p><a href="'.qa_path_html('admin/mailing').'">'.qa_lang_html('admin/admin_title').' - '.qa_lang_html('admin/mailing_title').'</a>';
qa_exit(); qa_exit();
} }
......
...@@ -155,8 +155,8 @@ if (!empty($pluginfiles)) { ...@@ -155,8 +155,8 @@ if (!empty($pluginfiles)) {
$qa_content['script_onloads'][] = array( $qa_content['script_onloads'][] = array(
"qa_version_check(" . qa_js($metadata['update_uri']) . ", " . qa_js($metadata['version'], true) . ", " . qa_js($elementid) . ");" "qa_version_check(" . qa_js($metadata['update_uri']) . ", " . qa_js($metadata['version'], true) . ", " . qa_js($elementid) . ");"
); );
}
} else else
$updatehtml = ''; $updatehtml = '';
if (isset($metadata['description'])) if (isset($metadata['description']))
...@@ -164,25 +164,23 @@ if (!empty($pluginfiles)) { ...@@ -164,25 +164,23 @@ if (!empty($pluginfiles)) {
else else
$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 = '<s style="color:#999">'.$pluginhtml.'</s><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 = '<s style="color:#999">'.$pluginhtml.'</s><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(
......
...@@ -68,7 +68,7 @@ if ($recalcnow) { ...@@ -68,7 +68,7 @@ if ($recalcnow) {
<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> <code>
<?php <?php
...@@ -87,7 +87,7 @@ if ($recalcnow) { ...@@ -87,7 +87,7 @@ if ($recalcnow) {
} }
?> ?>
</tt> </code>
<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>
......
...@@ -64,13 +64,11 @@ function qa_category_nav_to_browse(&$navigation, $categories, $categoryid, $favo ...@@ -64,13 +64,11 @@ function qa_category_nav_to_browse(&$navigation, $categories, $categoryid, $favo
if (@$favoritemap[$navlink['categoryid']]) if (@$favoritemap[$navlink['categoryid']])
$navigation[$key]['favorited'] = true; $navigation[$key]['favorited'] = true;
$navigation[$key]['note'] = ''; $navigation[$key]['note'] =
' - <a href="'.qa_path_html('questions/'.implode('/', array_reverse(explode('/', $category['backpath'])))).'">'.( ($category['qcount']==1)
$navigation[$key]['note'] .=
' - <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', qa_format_number($category['qcount'], 0, true)) : 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']);
......
...@@ -91,7 +91,7 @@ $qa_content['form'] = array( ...@@ -91,7 +91,7 @@ $qa_content['form'] = array(
'fields' => array( 'fields' => array(
'email_handle' => array( 'email_handle' => array(
'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']),
......
...@@ -42,21 +42,23 @@ if (qa_clicked('doaccount')) ...@@ -42,21 +42,23 @@ if (qa_clicked('doaccount'))
// Find the user profile and questions and answers for this handle // Find the user profile and questions and answers for this handle
$loginuserid = qa_get_logged_in_userid(); $loginuserid = qa_get_logged_in_userid();
$identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle; $identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle;
list($useraccount, $userprofile, $userfields, $usermessages, $userpoints, $userlevels, $navcategories, $userrank) = qa_db_select_with_pending( list($useraccount, $userprofile, $userfields, $usermessages, $userpoints, $userlevels, $navcategories, $userrank) =
QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_account_selectspec($handle, false), qa_db_select_with_pending(
QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_profile_selectspec($handle, false), QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_account_selectspec($handle, false),
QA_FINAL_EXTERNAL_USERS ? null : qa_db_userfields_selectspec(), QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_profile_selectspec($handle, false),
QA_FINAL_EXTERNAL_USERS ? null : qa_db_recent_messages_selectspec(null, null, $handle, false, qa_opt_if_loaded('page_size_wall')), QA_FINAL_EXTERNAL_USERS ? null : qa_db_userfields_selectspec(),
qa_db_user_points_selectspec($identifier), QA_FINAL_EXTERNAL_USERS ? null : qa_db_recent_messages_selectspec(null, null, $handle, false, qa_opt_if_loaded('page_size_wall')),
qa_db_user_levels_selectspec($identifier, QA_FINAL_EXTERNAL_USERS, true), qa_db_user_points_selectspec($identifier),
qa_db_category_nav_selectspec(null, true), qa_db_user_levels_selectspec($identifier, QA_FINAL_EXTERNAL_USERS, true),
qa_db_user_rank_selectspec($identifier) qa_db_category_nav_selectspec(null, true),
); qa_db_user_rank_selectspec($identifier)
);
if (!QA_FINAL_EXTERNAL_USERS) { if (!QA_FINAL_EXTERNAL_USERS && $handle !== qa_get_logged_in_handle()) {
foreach ($userfields as $index => $userfield) { foreach ($userfields as $index => $userfield) {
if (isset($userfield['permit']) && qa_permit_value_error($userfield['permit'], $loginuserid, qa_get_logged_in_level(), qa_get_logged_in_flags())) if (isset($userfield['permit']) && qa_permit_value_error($userfield['permit'], $loginuserid, qa_get_logged_in_level(), qa_get_logged_in_flags()))
unset($userfields[$index]); // don't pay attention to user fields we're not allowed to view unset($userfields[$index]); // don't pay attention to user fields we're not allowed to view
......
...@@ -89,7 +89,7 @@ class qa_filter_basic ...@@ -89,7 +89,7 @@ class qa_filter_basic
else { else {
$tagstring = qa_tags_to_tagstring($question['tags']); $tagstring = qa_tags_to_tagstring($question['tags']);
if (qa_strlen($tagstring) > QA_DB_MAX_TAGS_LENGTH) { // for storage if (qa_strlen($tagstring) > QA_DB_MAX_TAGS_LENGTH) { // for storage
$errors['tags'] = qa_lang_sub('main/max_length_x', $maxlength); $errors['tags'] = qa_lang_sub('main/max_length_x', QA_DB_MAX_TAGS_LENGTH);
} }
} }
} }
...@@ -107,7 +107,7 @@ class qa_filter_basic ...@@ -107,7 +107,7 @@ class qa_filter_basic
public function filter_comment(&$comment, &$errors, $question, $parent, $oldcomment) public function filter_comment(&$comment, &$errors, $question, $parent, $oldcomment)
{ {
$this->validate_field_length($errors, $comment, 'content', 0, QA_DB_MAX_CONTENT_LENGTH); // for storage $this->validate_field_length($errors, $comment, 'content', 0, QA_DB_MAX_CONTENT_LENGTH); // for storage
$this->validate_field_length($errors, $comment, 'text', qa_opt('min_len_a_content'), null, 'content'); // for display $this->validate_field_length($errors, $comment, 'text', qa_opt('min_len_c_content'), null, 'content'); // for display
$this->validate_post_email($errors, $comment); $this->validate_post_email($errors, $comment);
} }
......
...@@ -738,14 +738,18 @@ ...@@ -738,14 +738,18 @@
{ {
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 style="color: red">' . qa_html($message, true) . '</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').'">'. $color = strpos(@$trace['file'], '/qa-plugin/') !== false ? 'red' : '#999';
qa_html(@$trace['function'].'() in '.basename(@$trace['file']).':'.@$trace['line']).'</font><br>'; echo sprintf(
'<code style="color: %s">%s() in %s:%s</code><br>',
$color, qa_html(@$trace['function']), basename(@$trace['file']), @$trace['line']
);
}
qa_exit('error'); qa_exit('error');
} }
......
...@@ -35,10 +35,17 @@ ...@@ -35,10 +35,17 @@
<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%;} body {
font-family: arial;
font-size: 12px;
}
code {font-size: 125%;}
.severe {color: #b83939;}
.warning {color: #d2930d;}
.includes {color: #999;}
</style> </style>
</head> </head>
<body style="font-family:arial; font-size:12px;"> <body>
<?php <?php
function get_phrase_substitutions($phrase) function get_phrase_substitutions($phrase)
...@@ -52,8 +59,8 @@ ...@@ -52,8 +59,8 @@
return $substitutions; return $substitutions;
} }
echo '<font color="#cc0000"><code>Dark red = important to review.</code></font><br>'; echo '<code class="severe">Red = important to review.</code><br>';
echo '<font color="#cc9999"><code>Light red = probably safe to ignore.</code></font>'; echo '<code class="warning">Orange = probably safe to ignore.</code>';
echo '<h1>Checking US English files in <code>qa-include</code>...</h1>'; echo '<h1>Checking US English files in <code>qa-include</code>...</h1>';
...@@ -207,14 +214,14 @@ ...@@ -207,14 +214,14 @@
function output_lang_issue($prefix, $key, $issue, $error=true) function output_lang_issue($prefix, $key, $issue, $error=true)
{ {
echo '<font color="'.($error ? '#cc0000' : '#cc9999').'"><code>'; $colorClass = $error ? 'severe' : 'warning';
echo 'qa-lang-<b>'.qa_html($prefix).'</b>.php:';
if (strlen($key)) $htmlKey = strlen($key) > 0 ? "'<strong>" . qa_html($key) . "</strong>'" : '';
echo "'<b>".qa_html($key)."</b>'";
echo '</code></font> &nbsp; '.qa_html($issue).'<br>'; echo sprintf(
'<code class="%s">qa-lang-<strong>%s</strong>.php:%s</code> &nbsp; %s<br>',
$colorClass, qa_html($prefix), $htmlKey, qa_html($issue)
);
} }
...@@ -224,7 +231,7 @@ ...@@ -224,7 +231,7 @@
$oneread=false; $oneread=false;
echo '<p style="font-size:80%; color:#999;">Reading: '; echo '<p class="includes">Reading: ';
} }
......
...@@ -108,13 +108,15 @@ ...@@ -108,13 +108,15 @@
global $qa_db_fail_handler; global $qa_db_fail_handler;
@error_log('PHP Question2Answer MySQL '.$type.' error '.$errno.': '.$error.(isset($query) ? (' - Query: '.$query) : '')); @error_log('PHP Question2Answer MySQL ' . $type . ' error ' . $errno . ': ' . $error . (isset($query) ? (' - Query: ' . $query) : ''));
if (function_exists($qa_db_fail_handler)) if (function_exists($qa_db_fail_handler))
$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 sprintf(
'<hr><div style="color: red">Database %s<p>%s</p><code>%s</code></div>',
htmlspecialchars($type . ' error ' . $errno), nl2br(htmlspecialchars($error)), nl2br(htmlspecialchars($query))
);
qa_exit('error'); qa_exit('error');
} }
} }
......
...@@ -1116,6 +1116,10 @@ class qa_html_theme_base ...@@ -1116,6 +1116,10 @@ class qa_html_theme_base
$this->form_number($field, $style); $this->form_number($field, $style);
break; break;
case 'file':
$this->form_file($field, $style);
break;
case 'select': case 'select':
$this->form_select($field, $style); $this->form_select($field, $style);
break; break;
...@@ -1270,6 +1274,11 @@ class qa_html_theme_base ...@@ -1270,6 +1274,11 @@ class qa_html_theme_base
$this->output('<input '.@$field['tags'].' type="text" value="'.@$field['value'].'" class="qa-form-'.$style.'-number"/>'); $this->output('<input '.@$field['tags'].' type="text" value="'.@$field['value'].'" class="qa-form-'.$style.'-number"/>');
} }
public function form_file($field, $style)
{
$this->output('<input '.@$field['tags'].' type="file" class="qa-form-'.$style.'-file"/>');
}
/** /**
* Output a <select> element. The $field array may contain the following keys: * Output a <select> element. The $field array may contain the following keys:
* options: (required) a key-value array containing all the options in the select. * options: (required) a key-value array containing all the options in the select.
......
...@@ -54,6 +54,8 @@ class qa_event_logger ...@@ -54,6 +54,8 @@ class qa_event_logger
} }
} }
} }
return array();
} }
......
...@@ -233,6 +233,9 @@ class qa_wysiwyg_editor ...@@ -233,6 +233,9 @@ class qa_wysiwyg_editor
); );
} }
else { else {
// convert to text
qa_load_module('viewer', '');
return array( return array(
'format' => '', 'format' => '',
'content' => $this->html_to_text($html), 'content' => $this->html_to_text($html),
......
...@@ -31,7 +31,6 @@ class qa_xml_sitemap ...@@ -31,7 +31,6 @@ class qa_xml_sitemap
case 'xml_sitemap_show_category_qs': case 'xml_sitemap_show_category_qs':
case 'xml_sitemap_show_categories': case 'xml_sitemap_show_categories':
return true; return true;
break;
} }
} }
......
...@@ -913,7 +913,7 @@ blockquote p { ...@@ -913,7 +913,7 @@ blockquote p {
.qa-q-view-content, .qa-q-view-content,
.qa-a-item-content, .qa-a-item-content,
.qa-c-item-content { .qa-c-item-content {
word-break: break-word; word-wrap: break-word;
} }
.qa-q-view-content table, .qa-a-item-content table, .qa-c-item-content table { .qa-q-view-content table, .qa-a-item-content table, .qa-c-item-content table {
...@@ -2473,7 +2473,7 @@ input[type="submit"], button { ...@@ -2473,7 +2473,7 @@ input[type="submit"], button {
background: #fff; background: #fff;
margin-bottom: 5px; margin-bottom: 5px;
} }
.qa-part-a-form:empty .qa-part-a-form:empty,
.qa-part-a-form h2 { .qa-part-a-form h2 {
margin-top: 0; margin-top: 0;
} }
......
...@@ -303,7 +303,7 @@ class qa_html_theme extends qa_html_theme_base ...@@ -303,7 +303,7 @@ class qa_html_theme extends qa_html_theme_base
$this->output_raw($this->content['sidepanel']); $this->output_raw($this->content['sidepanel']);
$this->feed(); $this->feed();
$this->widgets('side', 'bottom'); $this->widgets('side', 'bottom');
$this->output('</div>', ''); $this->output('</div> <!-- qa-sidepanel -->', '');
} }
/** /**
...@@ -318,7 +318,7 @@ class qa_html_theme extends qa_html_theme_base ...@@ -318,7 +318,7 @@ class qa_html_theme extends qa_html_theme_base
if (!empty($sidebar)) { if (!empty($sidebar)) {
$this->output('<div class="qa-sidebar ' . $this->welcome_widget_class . '">'); $this->output('<div class="qa-sidebar ' . $this->welcome_widget_class . '">');
$this->output_raw($sidebar); $this->output_raw($sidebar);
$this->output('</div>', ''); $this->output('</div> <!-- qa-sidebar -->', '');
} }
} }
} }
......
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