Commit 2089b48f by Scott

Coding style (misc)

parent c1b82ae1
......@@ -108,7 +108,7 @@
and the value should be the replacement for that standard part, e.g. 'topics'. If you edit this
file in UTF-8 encoding you can also use non-ASCII characters in these URLs.
$QA_CONST_PATH_MAP=array(
$QA_CONST_PATH_MAP = array(
'questions' => 'topics',
'categories' => 'sections',
'users' => 'contributors',
......@@ -197,7 +197,3 @@
file to override the default setting. Just make sure you know what you're doing!
*/
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
......@@ -573,7 +573,7 @@ function qa_db_missing_columns($table, $definition)
$missing = array();
foreach ($definition as $colname => $coldefn)
if ((!is_int($colname)) && !isset($keycolumns[$colname]))
if (!is_int($colname) && !isset($keycolumns[$colname]))
$missing[$colname] = $coldefn;
return $missing;
......@@ -649,7 +649,7 @@ function qa_db_check_tables()
$datamissing++;
}
if (($datacount == $datamissing) && ($datamissing == count($missing)))
if ($datacount == $datamissing && $datamissing == count($missing))
return 'non-users-missing';
}
......
......@@ -148,45 +148,45 @@ function qa_db_points_update_ifuser($userid, $columns)
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
if (qa_should_update_counts() && isset($userid)) {
require_once QA_INCLUDE_DIR.'app/options.php';
require_once QA_INCLUDE_DIR.'app/cookies.php';
require_once QA_INCLUDE_DIR . 'app/options.php';
require_once QA_INCLUDE_DIR . 'app/cookies.php';
$calculations=qa_db_points_calculations();
$calculations = qa_db_points_calculations();
if ($columns===true)
$keycolumns=$calculations;
if ($columns === true)
$keycolumns = $calculations;
elseif (empty($columns))
$keycolumns=array();
$keycolumns = array();
elseif (is_array($columns))
$keycolumns=array_flip($columns);
$keycolumns = array_flip($columns);
else
$keycolumns=array($columns => true);
$keycolumns = array($columns => true);
$insertfields='userid, ';
$insertvalues='$, ';
$insertpoints=(int)qa_opt('points_base');
$insertfields = 'userid, ';
$insertvalues = '$, ';
$insertpoints = (int)qa_opt('points_base');
$updates='';
$updatepoints=$insertpoints;
$updates = '';
$updatepoints = $insertpoints;
foreach ($calculations as $field => $calculation) {
$multiple=(int)$calculation['multiple'];
$multiple = (int)$calculation['multiple'];
if (isset($keycolumns[$field])) {
$insertfields.=$field.', ';
$insertvalues.='@_'.$field.':=(SELECT '.$calculation['formula'].'), ';
$updates.=$field.'=@_'.$field.', ';
$insertpoints.='+('.(int)$multiple.'*@_'.$field.')';
$insertfields .= $field . ', ';
$insertvalues .= '@_' . $field . ':=(SELECT ' . $calculation['formula'] . '), ';
$updates .= $field . '=@_' . $field . ', ';
$insertpoints .= '+(' . (int)$multiple . '*@_' . $field . ')';
}
$updatepoints.='+('.$multiple.'*'.(isset($keycolumns[$field]) ? '@_' : '').$field.')';
$updatepoints .= '+(' . $multiple . '*' . (isset($keycolumns[$field]) ? '@_' : '') . $field . ')';
}
$query='INSERT INTO ^userpoints ('.$insertfields.'points) VALUES ('.$insertvalues.$insertpoints.') '.
'ON DUPLICATE KEY UPDATE '.$updates.'points='.$updatepoints.'+bonus';
$query = 'INSERT INTO ^userpoints (' . $insertfields . 'points) VALUES (' . $insertvalues . $insertpoints . ') ' .
'ON DUPLICATE KEY UPDATE ' . $updates . 'points=' . $updatepoints . '+bonus';
qa_db_query_raw(str_replace('~', "='".qa_db_escape_string($userid)."'", qa_db_apply_sub($query, array($userid))));
// build like this so that a #, $ or ^ character in the $userid (if external integration) isn't substituted
qa_db_query_raw(str_replace('~', "='" . qa_db_escape_string($userid) . "'", qa_db_apply_sub($query, array($userid))));
if (qa_db_insert_on_duplicate_inserted())
qa_db_userpointscount_update();
......
......@@ -190,7 +190,7 @@ if (qa_clicked('docancel')) {
$errors['slug'] = qa_lang_sub('main/max_length_x', QA_DB_MAX_CAT_PAGE_TAGS_LENGTH);
elseif (preg_match('/[\\+\\/]/', $inslug))
$errors['slug'] = qa_lang_sub('admin/slug_bad_chars', '+ /');
elseif ((!isset($inparentid)) && qa_admin_is_slug_reserved($inslug)) // only top level is a problem
elseif (!isset($inparentid) && qa_admin_is_slug_reserved($inslug)) // only top level is a problem
$errors['slug'] = qa_lang('admin/slug_reserved');
elseif (isset($matchcategoryid) && strcmp($matchcategoryid, @$editcategory['categoryid']))
$errors['slug'] = qa_lang('admin/category_already_used');
......
......@@ -1300,7 +1300,7 @@ foreach ($showoptions as $optionname) {
foreach ($searchmodules as $modulename => $module) {
$selectoptions[qa_html($modulename)] = strlen($modulename) ? qa_html($modulename) : qa_lang_html('options/option_default');
if (($modulename == $value) && method_exists($module, 'admin_form')) {
if ($modulename == $value && method_exists($module, 'admin_form')) {
$optionfield['note'] = '<a href="' . qa_admin_module_options_path('search', $modulename) . '">' . qa_lang_html('admin/options') . '</a>';
}
}
......
......@@ -142,7 +142,7 @@ if (count($questions)) {
);
}
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]]) {
// Possible values for popup: delete_q_popup, delete_a_popup, delete_c_popup
$buttons['delete'] = array(
'tags' => 'name="admin_' . qa_html($qhiddenpostid[$key]) . '_delete" onclick="return qa_admin_click(this);"',
......
......@@ -319,7 +319,7 @@ if (isset($editpage)) {
}
}
if ((!isset($editpage['pageid'])) || $nav != @$editpage['nav']) {
if (!isset($editpage['pageid']) || $nav != @$editpage['nav']) {
$positionvalue = isset($previous) ? qa_lang_html_sub('admin/after_x_tab', qa_html($previous['title'])) : qa_lang_html($langkey);
$positionoptions[$nav . (isset($previous) ? (1 + $maxposition) : 1)] = $positionvalue;
}
......
......@@ -94,7 +94,7 @@ if ($explicitqa && (!qa_is_http_post()) && !qa_has_custom_home())
// Then, if there's a slug that matches no category, check page modules provided by plugins
if ((!$explicitqa) && $countslugs && !isset($categoryid)) {
if (!$explicitqa && $countslugs && !isset($categoryid)) {
$pagemodules = qa_load_modules_with('page', 'match_request');
$request = qa_request();
......@@ -110,7 +110,7 @@ if ((!$explicitqa) && $countslugs && !isset($categoryid)) {
// Then, check whether we are showing a custom home page
if ((!$explicitqa) && (!$countslugs) && qa_opt('show_custom_home')) {
if (!$explicitqa && !$countslugs && qa_opt('show_custom_home')) {
qa_set_template('custom');
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_html(qa_opt('custom_home_heading'));
......
......@@ -98,7 +98,7 @@ if ($question['closeable']) {
else
$formtype = 'q_close'; // keep editing if an error
} elseif (($pagestate == 'close') && qa_page_q_permit_edit($question, 'permit_close_q', $pageerror))
} elseif ($pagestate == 'close' && qa_page_q_permit_edit($question, 'permit_close_q', $pageerror))
$formtype = 'q_close';
}
......@@ -220,7 +220,7 @@ foreach ($commentsfollows as $commentid => $comment) {
$formtype = 'c_edit';
$formpostid = $commentid; // keep editing if an error
}
} elseif (($pagestate == ('edit-' . $commentid)) && qa_page_q_permit_edit($comment, 'permit_edit_c', $pageerror)) {
} elseif ($pagestate == ('edit-' . $commentid) && qa_page_q_permit_edit($comment, 'permit_edit_c', $pageerror)) {
$formtype = 'c_edit';
$formpostid = $commentid;
}
......
......@@ -468,7 +468,7 @@ function qa_page_q_add_c_submit($question, $parent, $commentsfollows, $usecaptch
$testwords = implode(' ', qa_string_to_words($in['content']));
foreach ($commentsfollows as $comment) {
if (($comment['basetype'] == 'C') && ($comment['parentid'] == $parentid) && !$comment['hidden']) {
if ($comment['basetype'] == 'C' && $comment['parentid'] == $parentid && !$comment['hidden']) {
if (implode(' ', qa_string_to_words($comment['content'])) == $testwords) {
$errors['content'] = qa_lang_html('question/duplicate_content');
break;
......
......@@ -198,10 +198,10 @@ if (qa_is_http_post() || strlen($pagestate))
$formrequested = isset($formtype);
if ((!$formrequested) && $question['answerbutton']) {
if (!$formrequested && $question['answerbutton']) {
$immedoption = qa_opt('show_a_form_immediate');
if (($immedoption == 'always') || (($immedoption == 'if_no_as') && (!$question['isbyuser']) && (!$question['acount'])))
if ($immedoption == 'always' || ($immedoption == 'if_no_as' && !$question['isbyuser'] && !$question['acount']))
$formtype = 'a_add'; // show answer form by default
}
......@@ -275,7 +275,7 @@ if ($formtype == 'a_edit') {
$jumptoanchor = 'a' . $formpostid;
} elseif (($formtype == 'a_add') || ($question['answerbutton'] && !$formrequested)) {
} elseif ($formtype == 'a_add' || ($question['answerbutton'] && !$formrequested)) {
$qa_content['a_form'] = qa_page_q_add_a_form($qa_content, 'anew', $captchareason, $question, @$anewin, @$anewerrors, $formtype == 'a_add', $formrequested);
if ($formrequested) {
......@@ -294,16 +294,16 @@ if ($formtype == 'q_close') {
$qa_content['q_view']['c_form'] = qa_page_q_close_q_form($qa_content, $question, 'close', @$closein, @$closeerrors);
$jumptoanchor = 'close';
} elseif ((($formtype == 'c_add') && ($formpostid == $questionid)) || ($question['commentbutton'] && !$formrequested)) { // ...to be added
} elseif (($formtype == 'c_add' && $formpostid == $questionid) || ($question['commentbutton'] && !$formrequested)) { // ...to be added
$qa_content['q_view']['c_form'] = qa_page_q_add_c_form($qa_content, $question, $question, 'c' . $questionid,
$captchareason, @$cnewin[$questionid], @$cnewerrors[$questionid], $formtype == 'c_add');
if (($formtype == 'c_add') && ($formpostid == $questionid)) {
if ($formtype == 'c_add' && $formpostid == $questionid) {
$jumptoanchor = 'c' . $questionid;
$commentsall = $questionid;
}
} elseif (($formtype == 'c_edit') && (@$commentsfollows[$formpostid]['parentid'] == $questionid)) { // ...being edited
} elseif ($formtype == 'c_edit' && @$commentsfollows[$formpostid]['parentid'] == $questionid) { // ...being edited
$qa_content['q_view']['c_form'] = qa_page_q_edit_c_form($qa_content, 'c' . $formpostid, $commentsfollows[$formpostid],
@$ceditin[$formpostid], @$cediterrors[$formpostid]);
......@@ -470,8 +470,3 @@ if (
return $qa_content;
/*
Omit PHP closing tag to help avoid accidental output
*/
......@@ -51,7 +51,7 @@ if (!empty($inhandle)) { // match based on code and handle provided on URL
}
}
if ((!$unsubscribed) && isset($loginuserid)) { // as a backup, also unsubscribe logged in user
if (!$unsubscribed && isset($loginuserid)) { // as a backup, also unsubscribe logged in user
qa_db_user_set_flag($loginuserid, QA_USER_FLAGS_NO_MAILINGS, true);
$unsubscribed = true;
}
......
......@@ -75,7 +75,7 @@ $loginlevel = qa_get_logged_in_level();
if (!QA_FINAL_EXTERNAL_USERS) { // if we're using integrated user management, we can know and show more
require_once QA_INCLUDE_DIR . 'app/messages.php';
if ((!is_array($userpoints)) && !is_array($useraccount))
if (!is_array($userpoints) && !is_array($useraccount))
return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
$userid = $useraccount['userid'];
......@@ -435,7 +435,7 @@ if (!QA_FINAL_EXTERNAL_USERS) {
if (qa_using_categories()) {
$catleveladd = strlen(qa_get('catleveladd')) > 0;
if ((!$catleveladd) && !count($userlevels)) {
if (!$catleveladd && !count($userlevels)) {
$qa_content['form_profile']['fields']['level']['suffix'] = strtr(qa_lang_html('users/category_level_add'), array(
'^1' => '<a href="' . qa_path_html(qa_request(), array('state' => 'edit', 'catleveladd' => 1)) . '">',
'^2' => '</a>',
......
......@@ -1843,7 +1843,7 @@ function qa_suspend_event_reports($suspend = true)
* @param array $params
* @return mixed|void
*/
function qa_report_event($event, $userid, $handle, $cookieid, $params=array())
function qa_report_event($event, $userid, $handle, $cookieid, $params = array())
{
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
......
......@@ -20,16 +20,17 @@
More about this license: http://www.question2answer.org/license.php
*/
define('QA_BASE_DIR', dirname(dirname(empty($_SERVER['SCRIPT_FILENAME']) ? __FILE__ : $_SERVER['SCRIPT_FILENAME'])).'/');
define('QA_BASE_DIR', dirname(dirname(empty($_SERVER['SCRIPT_FILENAME']) ? __FILE__ : $_SERVER['SCRIPT_FILENAME'])) . '/');
require 'qa-base.php';
require_once QA_INCLUDE_DIR.'app/users.php';
require 'qa-base.php';
require_once QA_INCLUDE_DIR . 'app/users.php';
if (qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN)
if (qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN)
qa_redirect('admin/general', null, qa_opt('site_url'));
header('Content-type: text/html; charset=utf-8');
?>
header('Content-type: text/html; charset=utf-8');
?><!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
......@@ -48,123 +49,135 @@
<body>
<?php
function get_phrase_substitutions($phrase)
{
$substitutions=array();
function get_phrase_substitutions($phrase)
{
$substitutions = array();
if (preg_match_all('/\^(([0-9]+)|([a-z_]+)|)/', $phrase, $matches))
foreach ($matches[0] as $match)
foreach ($matches[0] as $match) {
@$substitutions[$match]++;
}
return $substitutions;
}
}
echo '<code class="severe">Red = important to review.</code><br>';
echo '<code class="warning">Orange = probably safe to ignore.</code>';
echo '<code class="severe">Red = important to review.</code><br>';
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>';
$includefiles=array_merge(glob(QA_INCLUDE_DIR.'qa-*.php'), glob(QA_INCLUDE_DIR.'*/qa-*.php'), glob(QA_PLUGIN_DIR.'*/qa-*.php'));
$includefiles = array_merge(glob(QA_INCLUDE_DIR . 'qa-*.php'), glob(QA_INCLUDE_DIR . '*/qa-*.php'), glob(QA_PLUGIN_DIR . '*/qa-*.php'));
$definite=array();
$probable=array();
$possible=array();
$defined=array();
$english=array();
$backmap=array();
$substitutions=array();
$definite = array();
$probable = array();
$possible = array();
$defined = array();
$english = array();
$backmap = array();
$substitutions = array();
output_start_includes();
output_start_includes();
foreach ($includefiles as $includefile) {
$contents=file_get_contents($includefile);
foreach ($includefiles as $includefile) {
$contents = file_get_contents($includefile);
preg_match_all('/qa_lang[a-z_]*\s*\(\s*[\'\"]([a-z]+)\/([0-9a-z_]+)[\'\"]/', $contents, $matches, PREG_SET_ORDER);
foreach ($matches as $matchparts)
if ($matchparts[2]=='date_month_') { // special case for month names
for ($month=1; $month<=12; $month++)
@$definite[$matchparts[1]][$matchparts[2].$month]++;
foreach ($matches as $matchparts) {
if ($matchparts[2] == 'date_month_') { // special case for month names
for ($month = 1; $month <= 12; $month++) {
@$definite[$matchparts[1]][$matchparts[2] . $month]++;
}
} else
@$definite[$matchparts[1]][$matchparts[2]]++;
}
preg_match_all('/[\'\"]([a-z]+)\/([0-9a-z_]+)[\'\"]/', $contents, $matches, PREG_SET_ORDER);
foreach ($matches as $matchparts)
foreach ($matches as $matchparts) {
@$probable[$matchparts[1]][$matchparts[2]]++;
}
if (preg_match('|/qa-include/qa-lang-([a-z]+)\.php$|', $includefile, $matches)) { // it's a lang file
$prefix=$matches[1];
$prefix = $matches[1];
output_reading_include($includefile);
$phrases=@include $includefile;
$phrases = @include $includefile;
foreach ($phrases as $key => $value) {
@$defined[$prefix][$key]++;
$english[$prefix][$key]=$value;
$backmap[$value][]=array('prefix' => $prefix, 'key' => $key);
$substitutions[$prefix][$key]=get_phrase_substitutions($value);
$english[$prefix][$key] = $value;
$backmap[$value][] = array('prefix' => $prefix, 'key' => $key);
$substitutions[$prefix][$key] = get_phrase_substitutions($value);
}
} else { // it's a different file
preg_match_all('/[\'\"\/]([0-9a-z_]+)[\'\"]/', $contents, $matches, PREG_SET_ORDER);
foreach ($matches as $matchparts)
foreach ($matches as $matchparts) {
@$possible[$matchparts[1]]++;
}
}
}
output_finish_includes();
output_finish_includes();
foreach ($definite as $key => $valuecount)
foreach ($valuecount as $value => $count)
foreach ($definite as $key => $valuecount) {
foreach ($valuecount as $value => $count) {
if (!@$defined[$key][$value])
output_lang_issue($key, $value, 'used by '.$count.' file/s but not defined');
output_lang_issue($key, $value, 'used by ' . $count . ' file/s but not defined');
}
}
foreach ($defined as $key => $valuecount)
foreach ($valuecount as $value => $count)
if ( (!@$definite[$key][$value]) && (!@$probable[$key][$value]) && (!@$possible[$value]) )
foreach ($defined as $key => $valuecount) {
foreach ($valuecount as $value => $count) {
if (!@$definite[$key][$value] && !@$probable[$key][$value] && !@$possible[$value])
output_lang_issue($key, $value, 'defined but apparently not used');
}
}
foreach ($backmap as $phrase => $where)
if (count($where)>1)
foreach ($where as $onewhere)
output_lang_issue($onewhere['prefix'], $onewhere['key'], 'contains the shared phrase "'.$phrase.'"', false);
foreach ($backmap as $phrase => $where) {
if (count($where) > 1)
foreach ($where as $onewhere) {
output_lang_issue($onewhere['prefix'], $onewhere['key'], 'contains the shared phrase "' . $phrase . '"', false);
}
}
require_once QA_INCLUDE_DIR.'app/admin.php';
require_once QA_INCLUDE_DIR . 'app/admin.php';
$languages=qa_admin_language_options();
unset($languages['']);
$languages = qa_admin_language_options();
unset($languages['']);
foreach ($languages as $code => $language) {
echo '<h1>Checking '.$language.' files in <code>qa-lang/'.$code.'</code>...</h1>';
foreach ($languages as $code => $language) {
echo '<h1>Checking ' . $language . ' files in <code>qa-lang/' . $code . '</code>...</h1>';
$langdefined=array();
$langdifferent=array();
$langsubstitutions=array();
$langincludefiles=glob(QA_LANG_DIR.$code.'/qa-*.php');
$langnewphrases=array();
$langdefined = array();
$langdifferent = array();
$langsubstitutions = array();
$langincludefiles = glob(QA_LANG_DIR . $code . '/qa-*.php');
$langnewphrases = array();
output_start_includes();
foreach ($langincludefiles as $langincludefile)
foreach ($langincludefiles as $langincludefile) {
if (preg_match('/qa-lang-([a-z]+)\.php$/', $langincludefile, $matches)) { // it's a lang file
$prefix=$matches[1];
$prefix = $matches[1];
output_reading_include($langincludefile);
$phrases=@include $langincludefile;
$phrases = @include $langincludefile;
foreach ($phrases as $key => $value) {
@$langdefined[$prefix][$key]++;
$langdifferent[$prefix][$key]=($value!=@$english[$prefix][$key]);
$langsubstitutions[$prefix][$key]=get_phrase_substitutions($value);
$langdifferent[$prefix][$key] = ($value != @$english[$prefix][$key]);
$langsubstitutions[$prefix][$key] = get_phrase_substitutions($value);
}
}
}
output_finish_includes();
foreach ($langdefined as $key => $valuecount)
foreach ($langdefined as $key => $valuecount) {
foreach ($valuecount as $value => $count) {
if (!@$defined[$key][$value])
output_lang_issue($key, $value, 'defined but not in US English files');
......@@ -173,47 +186,51 @@
output_lang_issue($key, $value, 'identical to US English files', false);
else
foreach ($substitutions[$key][$value] as $substitution => $subcount)
foreach ($substitutions[$key][$value] as $substitution => $subcount) {
if (!@$langsubstitutions[$key][$value][$substitution])
output_lang_issue($key, $value, 'omitted the substitution '.$substitution);
output_lang_issue($key, $value, 'omitted the substitution ' . $substitution);
elseif ($subcount > @$langsubstitutions[$key][$value][$substitution])
output_lang_issue($key, $value, 'has fewer of the substitution '.$substitution);
output_lang_issue($key, $value, 'has fewer of the substitution ' . $substitution);
}
}
}
foreach ($defined as $key => $valuecount) {
$showaserror=!(($key=='admin') || ($key=='options') || ($code=='en-GB'));
$showaserror = !(($key == 'admin') || ($key == 'options') || ($code == 'en-GB'));
if (@$langdefined[$key]) {
if (count($langdefined[$key]) < (count($valuecount)/2)) { // only a few phrases defined
if (count($langdefined[$key]) < (count($valuecount) / 2)) { // only a few phrases defined
output_lang_issue($key, null, 'few translations provided so will use US English defaults', $showaserror);
} else
foreach ($valuecount as $value => $count)
foreach ($valuecount as $value => $count) {
if (!@$langdefined[$key][$value]) {
output_lang_issue($key, $value, 'undefined so will use US English defaults', $showaserror);
$langnewphrases[$key][$value]=$english[$key][$value];
$langnewphrases[$key][$value] = $english[$key][$value];
}
}
} else
output_lang_issue($key, null, 'no translations provided so will use US English defaults', $showaserror);
}
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>';
foreach ($phrases as $key => $value)
echo '<span style="font-size:25%;">'."\t\t</span>'".$key."' => \"".strtr($value, array('\\' => '\\\\', '"' => '\"', '$' => '\$', "\n" => '\n', "\t" => '\t'))."\",\n";
foreach ($phrases as $key => $value) {
echo '<span style="font-size:25%;">' . "\t\t</span>'" . $key . "' => \"" . strtr($value, array('\\' => '\\\\', '"' => '\"', '$' => '\$', "\n" => '\n', "\t" => '\t')) . "\",\n";
}
echo '</pre>';
}
}
}
function output_lang_issue($prefix, $key, $issue, $error=true)
{
function output_lang_issue($prefix, $key, $issue, $error = true)
{
$colorClass = $error ? 'severe' : 'warning';
$htmlKey = strlen($key) > 0 ? "'<strong>" . qa_html($key) . "</strong>'" : '';
......@@ -222,37 +239,37 @@
'<code class="%s">qa-lang-<strong>%s</strong>.php:%s</code> &nbsp; %s<br>',
$colorClass, qa_html($prefix), $htmlKey, qa_html($issue)
);
}
}
function output_start_includes()
{
function output_start_includes()
{
global $oneread;
$oneread=false;
$oneread = false;
echo '<p class="includes">Reading: ';
}
}
function output_reading_include($file)
{
function output_reading_include($file)
{
global $oneread;
echo ($oneread ? ', ' : '').htmlspecialchars(basename($file));
echo ($oneread ? ', ' : '') . htmlspecialchars(basename($file));
flush();
$oneread=true;
}
$oneread = true;
}
function output_finish_includes()
{
function output_finish_includes()
{
echo '</p>';
}
}
echo '<h1>Finished scanning for problems!</h1>';
echo '<h1>Finished scanning for problems!</h1>';
?>
......
......@@ -40,7 +40,7 @@ if (!function_exists('qa_install_db_fail_handler')) {
* @param string $error
* @param string $query
*/
function qa_install_db_fail_handler($type, $errno=null, $error=null, $query=null)
function qa_install_db_fail_handler($type, $errno = null, $error = null, $query = null)
{
global $pass_failure_from_install;
......
......@@ -244,10 +244,10 @@ class qa_html_theme_base
}
// From here on, we have a large number of class methods which output particular pieces of HTML markup
// The calling chain is initiated from qa-page.php, or qa-ajax-*.php for refreshing parts of a page,
// For most HTML elements, the name of the function is similar to the element's CSS class, for example:
// search() outputs <div class="qa-search">, q_list() outputs <div class="qa-q-list">, etc...
// From here on, we have a large number of class methods which output particular pieces of HTML markup
// The calling chain is initiated from qa-page.php, or qa-ajax-*.php for refreshing parts of a page,
// For most HTML elements, the name of the function is similar to the element's CSS class, for example:
// search() outputs <div class="qa-search">, q_list() outputs <div class="qa-q-list">, etc...
public function doctype()
{
......
......@@ -127,7 +127,7 @@ function qa_image_constrain(&$width, &$height, $maxwidth, $maxheight = null)
if (!isset($maxheight))
$maxheight = $maxwidth;
if (($width > $maxwidth) || ($height > $maxheight)) {
if ($width > $maxwidth || $height > $maxheight) {
$multiplier = min($maxwidth / $width, $maxheight / $height);
$width = floor($width * $multiplier);
$height = floor($height * $multiplier);
......
......@@ -52,7 +52,7 @@ class qa_facebook_login
public function facebook_html($tourl, $logout, $context)
{
if (($context == 'login') || ($context == 'register'))
if ($context == 'login' || $context == 'register')
$size = 'large';
else
$size = 'medium';
......
......@@ -173,7 +173,7 @@ class qa_xml_sitemap
// User pages
if ((!QA_FINAL_EXTERNAL_USERS) && qa_opt('xml_sitemap_show_users')) {
if (!QA_FINAL_EXTERNAL_USERS && qa_opt('xml_sitemap_show_users')) {
$nextuserid = 0;
while (1) {
......
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