Commit 349d03ab by pupi1985

Some more minor formatting changes

parent de40daa8
...@@ -28,10 +28,10 @@ class qa_editor_basic ...@@ -28,10 +28,10 @@ class qa_editor_basic
public function calc_quality($content, $format) public function calc_quality($content, $format)
{ {
if ($format=='') if ($format == '')
return 1.0; return 1.0;
if ($format=='html') if ($format == 'html')
return 0.2; return 0.2;
return 0; return 0;
...@@ -41,7 +41,7 @@ class qa_editor_basic ...@@ -41,7 +41,7 @@ class qa_editor_basic
{ {
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,
); );
...@@ -49,7 +49,7 @@ class qa_editor_basic ...@@ -49,7 +49,7 @@ class qa_editor_basic
public function focus_script($fieldname) public function focus_script($fieldname)
{ {
return "document.getElementById('".$fieldname."').focus();"; return "document.getElementById('" . $fieldname . "').focus();";
} }
public function read_post($fieldname) public function read_post($fieldname)
......
...@@ -89,12 +89,12 @@ class qa_event_limits ...@@ -89,12 +89,12 @@ class qa_event_limits
is_numeric(array_search($event, $writeactions)) is_numeric(array_search($event, $writeactions))
) { ) {
if (isset($userid)) { if (isset($userid)) {
require_once QA_INCLUDE_DIR.'app/users.php'; require_once QA_INCLUDE_DIR . 'app/users.php';
qa_user_report_action($userid, $event); qa_user_report_action($userid, $event);
} elseif (isset($cookieid)) { } elseif (isset($cookieid)) {
require_once QA_INCLUDE_DIR.'app/cookies.php'; require_once QA_INCLUDE_DIR . 'app/cookies.php';
qa_cookie_report_action($cookieid, $event); qa_cookie_report_action($cookieid, $event);
} }
......
...@@ -24,37 +24,38 @@ class qa_related_qs ...@@ -24,37 +24,38 @@ class qa_related_qs
{ {
public function allow_template($template) public function allow_template($template)
{ {
return ($template=='question'); return $template == 'question';
} }
public function allow_region($region) public function allow_region($region)
{ {
return ($region=='side') || ($region=='main') || ($region=='full'); return in_array($region, array('side', 'main', 'full'));
} }
public function output_widget($region, $place, $themeobject, $template, $request, $qa_content) public function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{ {
require_once QA_INCLUDE_DIR.'db/selects.php'; require_once QA_INCLUDE_DIR.'db/selects.php';
if (@$qa_content['q_view']['raw']['type']!='Q') // question might not be visible, etc... if (!isset($qa_content['q_view']['raw']['type']) || $qa_content['q_view']['raw']['type'] != 'Q') // question might not be visible, etc...
return; return;
$questionid=$qa_content['q_view']['raw']['postid']; $questionid = $qa_content['q_view']['raw']['postid'];
$userid=qa_get_logged_in_userid(); $userid = qa_get_logged_in_userid();
$cookieid=qa_cookie_get(); $cookieid = qa_cookie_get();
$questions=qa_db_single_select(qa_db_related_qs_selectspec($userid, $questionid, qa_opt('page_size_related_qs'))); $questions = qa_db_single_select(qa_db_related_qs_selectspec($userid, $questionid, qa_opt('page_size_related_qs')));
$minscore=qa_match_to_min_score(qa_opt('match_related_qs')); $minscore = qa_match_to_min_score(qa_opt('match_related_qs'));
foreach ($questions as $key => $question) foreach ($questions as $key => $question) {
if ($question['score']<$minscore) if ($question['score'] < $minscore)
unset($questions[$key]); unset($questions[$key]);
}
$titlehtml=qa_lang_html(count($questions) ? 'main/related_qs_title' : 'main/no_related_qs_title'); $titlehtml = qa_lang_html(count($questions) ? 'main/related_qs_title' : 'main/no_related_qs_title');
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;">',
...@@ -64,14 +65,20 @@ class qa_related_qs ...@@ -64,14 +65,20 @@ class qa_related_qs
$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>',
...@@ -79,23 +86,21 @@ class qa_related_qs ...@@ -79,23 +86,21 @@ class qa_related_qs
'</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'),
), ),
), ),
'qs' => array(), 'qs' => array(),
); );
$defaults=qa_post_html_defaults('Q'); $defaults = qa_post_html_defaults('Q');
$usershtml=qa_userids_handles_html($questions); $usershtml = qa_userids_handles_html($questions);
foreach ($questions as $question) foreach ($questions as $question)
$q_list['qs'][]=qa_post_html_fields($question, $userid, $cookieid, $usershtml, null, qa_post_html_options($question, $defaults)); $q_list['qs'][] = qa_post_html_fields($question, $userid, $cookieid, $usershtml, null, qa_post_html_options($question, $defaults));
$themeobject->q_list_and_form($q_list); $themeobject->q_list_and_form($q_list);
} }
......
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