Commit ed8194f6 by pupi1985

Removed some unneeded ternary operators

parent 21dab95f
...@@ -390,19 +390,19 @@ ...@@ -390,19 +390,19 @@
break; break;
case 'show_custom_sidebar': case 'show_custom_sidebar':
$value=strlen(qa_opt('custom_sidebar')) ? true : false; $value = (bool) strlen(qa_opt('custom_sidebar'));
break; break;
case 'show_custom_header': case 'show_custom_header':
$value=strlen(qa_opt('custom_header')) ? true : false; $value = (bool) strlen(qa_opt('custom_header'));
break; break;
case 'show_custom_footer': case 'show_custom_footer':
$value=strlen(qa_opt('custom_footer')) ? true : false; $value = (bool) strlen(qa_opt('custom_footer'));
break; break;
case 'show_custom_in_head': case 'show_custom_in_head':
$value=strlen(qa_opt('custom_in_head')) ? true : false; $value = (bool) strlen(qa_opt('custom_in_head'));
break; break;
case 'custom_sidebar': case 'custom_sidebar':
......
...@@ -55,9 +55,9 @@ ...@@ -55,9 +55,9 @@
qa_post_unindex($oldquestion['postid']); qa_post_unindex($oldquestion['postid']);
$wasqueued=($oldquestion['type']=='Q_QUEUED'); $wasqueued=($oldquestion['type']=='Q_QUEUED');
$titlechanged=strcmp($oldquestion['title'], $title) ? true : false; $titlechanged = (bool) strcmp($oldquestion['title'], $title);
$contentchanged=strcmp($oldquestion['content'], $content) || strcmp($oldquestion['format'], $format); $contentchanged=strcmp($oldquestion['content'], $content) || strcmp($oldquestion['format'], $format);
$tagschanged=strcmp($oldquestion['tags'], $tagstring) ? true : false; $tagschanged = (bool) strcmp($oldquestion['tags'], $tagstring);
$setupdated=($titlechanged || $contentchanged || $tagschanged) && (!$wasqueued) && !$silent; $setupdated=($titlechanged || $contentchanged || $tagschanged) && (!$wasqueued) && !$silent;
qa_db_post_set_content($oldquestion['postid'], $title, $content, $format, $tagstring, $notify, qa_db_post_set_content($oldquestion['postid'], $title, $content, $format, $tagstring, $notify,
......
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
if (isset($userid) && isset($categoryid)) { 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 = (bool) @$favoritemap['category'][$navcategories[$categoryid]['backpath']];
$qa_content['favorite']=qa_favorite_form(QA_ENTITY_CATEGORY, $categoryid, $categoryisfavorite, $qa_content['favorite']=qa_favorite_form(QA_ENTITY_CATEGORY, $categoryid, $categoryisfavorite,
qa_lang_sub($categoryisfavorite ? 'main/remove_x_favorites' : 'main/add_category_x_favorites', $navcategories[$categoryid]['title'])); qa_lang_sub($categoryisfavorite ? 'main/remove_x_favorites' : 'main/add_category_x_favorites', $navcategories[$categoryid]['title']));
......
...@@ -220,7 +220,7 @@ ...@@ -220,7 +220,7 @@
Return whether there are any blobs whose content has been stored as a file 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 (bool) count(qa_db_read_all_values(qa_db_query_sub('SELECT blobid FROM ^blobs WHERE content IS NULL LIMIT 1')));
} }
...@@ -229,7 +229,7 @@ ...@@ -229,7 +229,7 @@
Return whether there are any blobs whose content has been stored in the database 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 (bool) count(qa_db_read_all_values(qa_db_query_sub('SELECT blobid FROM ^blobs WHERE content IS NOT NULL LIMIT 1')));
} }
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
$doconfirms=qa_opt('confirm_user_emails') && ($useraccount['level']<QA_USER_LEVEL_EXPERT); $doconfirms=qa_opt('confirm_user_emails') && ($useraccount['level']<QA_USER_LEVEL_EXPERT);
$isconfirmed=($useraccount['flags'] & QA_USER_FLAGS_EMAIL_CONFIRMED) ? true : false; $isconfirmed=($useraccount['flags'] & QA_USER_FLAGS_EMAIL_CONFIRMED) ? true : false;
$haspassword=isset($useraccount['passsalt']) && isset($useraccount['passcheck']); $haspassword=isset($useraccount['passsalt']) && isset($useraccount['passcheck']);
$isblocked=qa_user_permit_error() ? true : false; $isblocked = (bool) qa_user_permit_error();
// Process profile if saved // Process profile if saved
...@@ -439,4 +439,4 @@ ...@@ -439,4 +439,4 @@
/* /*
Omit PHP closing tag to help avoid accidental output Omit PHP closing tag to help avoid accidental output
*/ */
\ No newline at end of file
...@@ -110,9 +110,9 @@ ...@@ -110,9 +110,9 @@
$userlevel=qa_user_level_for_categories($categoryids); $userlevel=qa_user_level_for_categories($categoryids);
$in['name']=qa_post_text('name'); $in['name']=qa_post_text('name');
$in['notify']=qa_post_text('notify') ? true : false; $in['notify'] = (bool) qa_post_text('notify');
$in['email']=qa_post_text('email'); $in['email']=qa_post_text('email');
$in['queued']=qa_user_moderation_reason($userlevel) ? true : false; $in['queued'] = (bool) qa_user_moderation_reason($userlevel);
qa_get_post_content('editor', 'content', $in['editor'], $in['content'], $in['format'], $in['text']); qa_get_post_content('editor', 'content', $in['editor'], $in['content'], $in['format'], $in['text']);
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
if (strtolower(qa_db_calc_passcheck($inpassword, $userinfo['passsalt'])) == strtolower($userinfo['passcheck'])) { // login and redirect if (strtolower(qa_db_calc_passcheck($inpassword, $userinfo['passsalt'])) == strtolower($userinfo['passcheck'])) { // login and redirect
require_once QA_INCLUDE_DIR.'qa-app-users.php'; require_once QA_INCLUDE_DIR.'qa-app-users.php';
qa_set_logged_in_user($inuserid, $userinfo['handle'], $inremember ? true : false); qa_set_logged_in_user($inuserid, $userinfo['handle'], (bool) $inremember);
$topath=qa_get('to'); $topath=qa_get('to');
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
'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' => (bool) @$inremember,
), ),
), ),
......
...@@ -450,7 +450,7 @@ ...@@ -450,7 +450,7 @@
if ($question['isbyuser']) { if ($question['isbyuser']) {
$in['name']=qa_post_text('q_name'); $in['name']=qa_post_text('q_name');
$in['notify']=qa_post_text('q_notify') ? true : false; $in['notify'] = (bool) qa_post_text('q_notify');
$in['email']=qa_post_text('q_email'); $in['email']=qa_post_text('q_email');
} }
...@@ -781,7 +781,7 @@ ...@@ -781,7 +781,7 @@
if ($answer['isbyuser']) { if ($answer['isbyuser']) {
$in['name']=qa_post_text($prefix.'name'); $in['name']=qa_post_text($prefix.'name');
$in['notify']=qa_post_text($prefix.'notify') ? true : false; $in['notify'] = (bool) qa_post_text($prefix.'notify');
$in['email']=qa_post_text($prefix.'email'); $in['email']=qa_post_text($prefix.'email');
} }
...@@ -982,7 +982,7 @@ ...@@ -982,7 +982,7 @@
if ($comment['isbyuser']) { if ($comment['isbyuser']) {
$in['name']=qa_post_text($prefix.'name'); $in['name']=qa_post_text($prefix.'name');
$in['notify']=qa_post_text($prefix.'notify') ? true : false; $in['notify'] = (bool) qa_post_text($prefix.'notify');
$in['email']=qa_post_text($prefix.'email'); $in['email']=qa_post_text($prefix.'email');
} }
......
...@@ -324,9 +324,9 @@ ...@@ -324,9 +324,9 @@
{ {
$in=array( $in=array(
'name' => qa_post_text('a_name'), 'name' => qa_post_text('a_name'),
'notify' => qa_post_text('a_notify') ? true : false, 'notify' => (bool) qa_post_text('a_notify'),
'email' => qa_post_text('a_email'), 'email' => qa_post_text('a_email'),
'queued' => qa_user_moderation_reason(qa_user_level_for_post($question)) ? true : false, 'queued' => (bool) qa_user_moderation_reason(qa_user_level_for_post($question)),
); );
qa_get_post_content('a_editor', 'a_content', $in['editor'], $in['content'], $in['format'], $in['text']); qa_get_post_content('a_editor', 'a_content', $in['editor'], $in['content'], $in['format'], $in['text']);
...@@ -386,9 +386,9 @@ ...@@ -386,9 +386,9 @@
$in=array( $in=array(
'name' => qa_post_text($prefix.'name'), 'name' => qa_post_text($prefix.'name'),
'notify' => qa_post_text($prefix.'notify') ? true : false, 'notify' => (bool) qa_post_text($prefix.'notify'),
'email' => qa_post_text($prefix.'email'), 'email' => qa_post_text($prefix.'email'),
'queued' => qa_user_moderation_reason(qa_user_level_for_post($parent)) ? true : false, 'queued' => (bool) qa_user_moderation_reason(qa_user_level_for_post($parent)),
); );
qa_get_post_content($prefix.'editor', $prefix.'content', $in['editor'], $in['content'], $in['format'], $in['text']); qa_get_post_content($prefix.'editor', $prefix.'content', $in['editor'], $in['content'], $in['format'], $in['text']);
...@@ -443,9 +443,9 @@ ...@@ -443,9 +443,9 @@
'content' => $post['content'], 'content' => $post['content'],
'format' => $post['format'], 'format' => $post['format'],
'text' => qa_viewer_text($post['content'], $post['format']), 'text' => qa_viewer_text($post['content'], $post['format']),
'notify' => isset($post['notify']) ? true : false, 'notify' => isset($post['notify']),
'email' => qa_email_validate($post['notify']) ? $post['notify'] : null, 'email' => qa_email_validate($post['notify']) ? $post['notify'] : null,
'queued' => qa_user_moderation_reason(qa_user_level_for_post($post)) ? true : false, 'queued' => (bool) qa_user_moderation_reason(qa_user_level_for_post($post)),
); );
if ($post['basetype']=='Q') { if ($post['basetype']=='Q') {
......
...@@ -435,7 +435,7 @@ ...@@ -435,7 +435,7 @@
// Category-specific levels // Category-specific levels
if (qa_using_categories()) { if (qa_using_categories()) {
$catleveladd=qa_get('catleveladd') ? true : false; $catleveladd = (bool) qa_get('catleveladd');
if ((!$catleveladd) && !count($userlevels)) if ((!$catleveladd) && !count($userlevels))
$qa_content['form_profile']['fields']['level']['suffix']=strtr(qa_lang_html('users/category_level_add'), array( $qa_content['form_profile']['fields']['level']['suffix']=strtr(qa_lang_html('users/category_level_add'), array(
...@@ -547,7 +547,7 @@ ...@@ -547,7 +547,7 @@
if (($loginlevel>=QA_USER_LEVEL_ADMIN) && !qa_user_permit_error()) { if (($loginlevel>=QA_USER_LEVEL_ADMIN) && !qa_user_permit_error()) {
$doconfirms=qa_opt('confirm_user_emails') && ($useraccount['level']<QA_USER_LEVEL_EXPERT); $doconfirms=qa_opt('confirm_user_emails') && ($useraccount['level']<QA_USER_LEVEL_EXPERT);
$isconfirmed=($useraccount['flags'] & QA_USER_FLAGS_EMAIL_CONFIRMED) ? true : false; $isconfirmed = (bool) ($useraccount['flags'] & QA_USER_FLAGS_EMAIL_CONFIRMED);
$htmlemail=qa_html(isset($inemail) ? $inemail : $useraccount['email']); $htmlemail=qa_html(isset($inemail) ? $inemail : $useraccount['email']);
$qa_content['form_profile']['fields']['email']=array( $qa_content['form_profile']['fields']['email']=array(
...@@ -610,7 +610,7 @@ ...@@ -610,7 +610,7 @@
if (!isset($value)) if (!isset($value))
$value=@$userprofile[$userfield['title']]; $value=@$userprofile[$userfield['title']];
$valuehtml=qa_html($value, (($userfield['flags'] & QA_FIELD_FLAGS_MULTI_LINE) && !$fieldsediting) ? true : false); $valuehtml=qa_html($value, (($userfield['flags'] & QA_FIELD_FLAGS_MULTI_LINE) && !$fieldsediting));
} }
$label=trim(qa_user_userfield_label($userfield), ':'); $label=trim(qa_user_userfield_label($userfield), ':');
......
...@@ -646,7 +646,7 @@ ...@@ -646,7 +646,7 @@
{ {
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 preg_match("/^[\-\!\#\$\%\&\'\*\+\/\=\?\_\`\{\|\}\~a-zA-Z0-9\.\^]+\@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\.\-]+$/", $email) ? true : false; return (bool) preg_match("/^[\-\!\#\$\%\&\'\*\+\/\=\?\_\`\{\|\}\~a-zA-Z0-9\.\^]+\@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\.\-]+$/", $email);
} }
......
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