Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
8c7ee30b
Commit
8c7ee30b
authored
Mar 18, 2014
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch bool castings for expressions
parent
5c2fc047
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
46 additions
and
43 deletions
+46
-43
qa-app-format.php
qa-include/qa-app-format.php
+8
-7
qa-app-options.php
qa-include/qa-app-options.php
+4
-4
qa-app-post-update.php
qa-include/qa-app-post-update.php
+14
-12
qa-app-q-list.php
qa-include/qa-app-q-list.php
+1
-1
qa-page-account.php
qa-include/qa-page-account.php
+1
-1
qa-page-ask.php
qa-include/qa-page-ask.php
+2
-2
qa-page-login.php
qa-include/qa-page-login.php
+2
-2
qa-page-question-post.php
qa-include/qa-page-question-post.php
+3
-3
qa-page-question-submit.php
qa-include/qa-page-question-submit.php
+5
-5
qa-page-user-profile.php
qa-include/qa-page-user-profile.php
+5
-5
qa-util-string.php
qa-include/qa-util-string.php
+1
-1
No files found.
qa-include/qa-app-format.php
View file @
8c7ee30b
...
...
@@ -149,7 +149,7 @@
$favoritenonqs
=
qa_db_get_pending_result
(
'favoritenonqs'
,
qa_db_user_favorite_non_qs_selectspec
(
$loginuserid
));
foreach
(
$favoritenonqs
as
$favorite
)
foreach
(
$favoritenonqs
as
$favorite
)
{
switch
(
$favorite
[
'type'
])
{
case
QA_ENTITY_USER
:
$qa_favorite_non_qs_map
[
'user'
][
$favorite
[
'userid'
]]
=
true
;
...
...
@@ -163,6 +163,7 @@
$qa_favorite_non_qs_map
[
'category'
][
$favorite
[
'categorybackpath'
]]
=
true
;
break
;
}
}
}
}
...
...
@@ -1455,7 +1456,7 @@
*/
{
$pathcategories
=
qa_category_path
(
$navcategories
,
$categoryid
);
$startpath
=
''
;
foreach
(
$pathcategories
as
$category
)
$startpath
.=
'/'
.
$category
[
'categoryid'
];
...
...
@@ -1467,14 +1468,14 @@
$qa_content
[
'script_rel'
][]
=
'qa-content/qa-ask.js?'
.
QA_VERSION
;
$qa_content
[
'script_onloads'
][]
=
sprintf
(
'qa_category_select(%s, %s);'
,
qa_js
(
$fieldname
),
qa_js
(
$startpath
));
$qa_content
[
'script_var'
]
=
array
(
'qa_cat_exclude'
=>
$excludecategoryid
,
'qa_cat_allownone'
=>
(
int
)
$allownone
,
'qa_cat_allownosub'
=>
(
int
)
$allownosub
,
'qa_cat_maxdepth'
=>
$maxdepth
,
);
$field
[
'type'
]
=
'select'
;
$field
[
'tags'
]
=
sprintf
(
'name="%s_0" id="%s_0" onchange="qa_category_select(%s);"'
,
$fieldname
,
$fieldname
,
qa_js
(
$fieldname
));
$field
[
'options'
]
=
array
();
...
...
@@ -1496,7 +1497,7 @@
}
$keycategoryids
=
array_reverse
(
$keycategoryids
,
true
);
$depth
=
count
(
$keycategoryids
);
// number of levels above
if
(
isset
(
$category
))
{
...
...
@@ -1506,7 +1507,7 @@
if
(
!
strcmp
(
$navcategory
[
'parentid'
],
$category
[
'parentid'
]))
$keycategoryids
[
$navcategory
[
'categoryid'
]]
=
true
;
}
if
(
$depth
<
$maxdepth
)
foreach
(
$navcategories
as
$navcategory
)
// now get children, if not too deep
if
(
!
strcmp
(
$navcategory
[
'parentid'
],
$categoryid
))
...
...
@@ -1528,7 +1529,7 @@
foreach
(
$keycategoryids
as
$keycategoryid
=>
$dummy
)
if
(
strcmp
(
$keycategoryid
,
$excludecategoryid
))
$field
[
'options'
][
$keycategoryid
]
=
qa_category_path_html
(
$navcategories
,
$keycategoryid
);
$field
[
'value'
]
=
@
$field
[
'options'
][
$categoryid
];
$field
[
'note'
]
=
'<div id="'
.
$fieldname
.
'_note">'
.
...
...
qa-include/qa-app-options.php
View file @
8c7ee30b
...
...
@@ -390,19 +390,19 @@
break
;
case
'show_custom_sidebar'
:
$value
=
(
bool
)
strlen
(
qa_opt
(
'custom_sidebar'
))
;
$value
=
strlen
(
qa_opt
(
'custom_sidebar'
))
>
0
;
break
;
case
'show_custom_header'
:
$value
=
(
bool
)
strlen
(
qa_opt
(
'custom_header'
))
;
$value
=
strlen
(
qa_opt
(
'custom_header'
))
>
0
;
break
;
case
'show_custom_footer'
:
$value
=
(
bool
)
strlen
(
qa_opt
(
'custom_footer'
))
;
$value
=
strlen
(
qa_opt
(
'custom_footer'
))
>
0
;
break
;
case
'show_custom_in_head'
:
$value
=
(
bool
)
strlen
(
qa_opt
(
'custom_in_head'
))
;
$value
=
strlen
(
qa_opt
(
'custom_in_head'
))
>
0
;
break
;
case
'custom_sidebar'
:
...
...
qa-include/qa-app-post-update.php
View file @
8c7ee30b
...
...
@@ -54,11 +54,11 @@
{
qa_post_unindex
(
$oldquestion
[
'postid'
]);
$wasqueued
=
(
$oldquestion
[
'type'
]
==
'Q_QUEUED'
);
$titlechanged
=
(
bool
)
strcmp
(
$oldquestion
[
'title'
],
$title
)
;
$contentchanged
=
strcmp
(
$oldquestion
[
'content'
],
$content
)
||
strcmp
(
$oldquestion
[
'format'
],
$format
)
;
$tagschanged
=
(
bool
)
strcmp
(
$oldquestion
[
'tags'
],
$tagstring
)
;
$setupdated
=
(
$titlechanged
||
$contentchanged
||
$tagschanged
)
&&
(
!
$wasqueued
)
&&
!
$silent
;
$wasqueued
=
(
$oldquestion
[
'type'
]
==
'Q_QUEUED'
);
$titlechanged
=
strcmp
(
$oldquestion
[
'title'
],
$title
)
!==
0
;
$contentchanged
=
strcmp
(
$oldquestion
[
'content'
],
$content
)
!==
0
||
strcmp
(
$oldquestion
[
'format'
],
$format
)
!==
0
;
$tagschanged
=
strcmp
(
$oldquestion
[
'tags'
],
$tagstring
)
!==
0
;
$setupdated
=
(
$titlechanged
||
$contentchanged
||
$tagschanged
)
&&
(
!
$wasqueued
)
&&
!
$silent
;
qa_db_post_set_content
(
$oldquestion
[
'postid'
],
$title
,
$content
,
$format
,
$tagstring
,
$notify
,
$setupdated
?
$userid
:
null
,
$setupdated
?
qa_remote_ip_address
()
:
null
,
...
...
@@ -72,18 +72,19 @@
if
(
$setupdated
&&
$remoderate
)
{
require_once
QA_INCLUDE_DIR
.
'qa-app-posts.php'
;
$answers
=
qa_post_get_question_answers
(
$oldquestion
[
'postid'
]);
$commentsfollows
=
qa_post_get_question_commentsfollows
(
$oldquestion
[
'postid'
]);
$closepost
=
qa_post_get_question_closepost
(
$oldquestion
[
'postid'
]);
$answers
=
qa_post_get_question_answers
(
$oldquestion
[
'postid'
]);
$commentsfollows
=
qa_post_get_question_commentsfollows
(
$oldquestion
[
'postid'
]);
$closepost
=
qa_post_get_question_closepost
(
$oldquestion
[
'postid'
]);
foreach
(
$answers
as
$answer
)
qa_post_unindex
(
$answer
[
'postid'
]);
foreach
(
$commentsfollows
as
$comment
)
if
(
$comment
[
'basetype'
]
==
'C'
)
foreach
(
$commentsfollows
as
$comment
)
{
if
(
$comment
[
'basetype'
]
==
'C'
)
qa_post_unindex
(
$comment
[
'postid'
]);
}
if
(
@
$closepost
[
'parentid'
]
==
$oldquestion
[
'postid'
])
if
(
@
$closepost
[
'parentid'
]
==
$oldquestion
[
'postid'
])
qa_post_unindex
(
$closepost
[
'postid'
]);
qa_db_post_set_type
(
$oldquestion
[
'postid'
],
'Q_QUEUED'
);
...
...
@@ -94,7 +95,8 @@
if
(
$oldquestion
[
'flagcount'
])
qa_db_flaggedcount_update
();
}
elseif
(
$oldquestion
[
'type'
]
==
'Q'
)
{
// not hidden or queued
}
else
if
(
$oldquestion
[
'type'
]
==
'Q'
)
{
// not hidden or queued
qa_post_index
(
$oldquestion
[
'postid'
],
'Q'
,
$oldquestion
[
'postid'
],
$oldquestion
[
'parentid'
],
$title
,
$content
,
$format
,
$text
,
$tagstring
,
$oldquestion
[
'categoryid'
]);
}
...
...
qa-include/qa-app-q-list.php
View file @
8c7ee30b
...
...
@@ -93,7 +93,7 @@
if
(
isset
(
$userid
)
&&
isset
(
$categoryid
))
{
$favoritemap
=
qa_get_favorite_non_qs_map
();
$categoryisfavorite
=
(
bool
)
@
$favoritemap
[
'category'
][
$navcategories
[
$categoryid
][
'backpath'
]];
$categoryisfavorite
=
@
$favoritemap
[
'category'
][
$navcategories
[
$categoryid
][
'backpath'
]];
$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-include/qa-page-account.php
View file @
8c7ee30b
...
...
@@ -60,7 +60,7 @@
$doconfirms
=
qa_opt
(
'confirm_user_emails'
)
&&
(
$useraccount
[
'level'
]
<
QA_USER_LEVEL_EXPERT
);
$isconfirmed
=
(
$useraccount
[
'flags'
]
&
QA_USER_FLAGS_EMAIL_CONFIRMED
)
?
true
:
false
;
$haspassword
=
isset
(
$useraccount
[
'passsalt'
])
&&
isset
(
$useraccount
[
'passcheck'
]);
$isblocked
=
(
bool
)
qa_user_permit_error
()
;
$isblocked
=
qa_user_permit_error
()
!==
false
;
// Process profile if saved
...
...
qa-include/qa-page-ask.php
View file @
8c7ee30b
...
...
@@ -110,9 +110,9 @@
$userlevel
=
qa_user_level_for_categories
(
$categoryids
);
$in
[
'name'
]
=
qa_post_text
(
'name'
);
$in
[
'notify'
]
=
(
bool
)
qa_post_text
(
'notify'
)
;
$in
[
'notify'
]
=
strlen
(
qa_post_text
(
'notify'
))
>
0
;
$in
[
'email'
]
=
qa_post_text
(
'email'
);
$in
[
'queued'
]
=
(
bool
)
qa_user_moderation_reason
(
$userlevel
)
;
$in
[
'queued'
]
=
qa_user_moderation_reason
(
$userlevel
)
!==
false
;
qa_get_post_content
(
'editor'
,
'content'
,
$in
[
'editor'
],
$in
[
'content'
],
$in
[
'format'
],
$in
[
'text'
]);
...
...
qa-include/qa-page-login.php
View file @
8c7ee30b
...
...
@@ -75,7 +75,7 @@
if
(
strtolower
(
qa_db_calc_passcheck
(
$inpassword
,
$userinfo
[
'passsalt'
]))
==
strtolower
(
$userinfo
[
'passcheck'
]))
{
// login and redirect
require_once
QA_INCLUDE_DIR
.
'qa-app-users.php'
;
qa_set_logged_in_user
(
$inuserid
,
$userinfo
[
'handle'
],
(
bool
)
$inremember
);
qa_set_logged_in_user
(
$inuserid
,
$userinfo
[
'handle'
],
!
empty
(
$inremember
)
);
$topath
=
qa_get
(
'to'
);
...
...
@@ -143,7 +143,7 @@
'type'
=>
'checkbox'
,
'label'
=>
qa_lang_html
(
'users/remember_label'
),
'tags'
=>
'name="remember"'
,
'value'
=>
(
bool
)
@
$inremember
,
'value'
=>
!
empty
(
@
$inremember
)
,
),
),
...
...
qa-include/qa-page-question-post.php
View file @
8c7ee30b
...
...
@@ -450,7 +450,7 @@
if
(
$question
[
'isbyuser'
])
{
$in
[
'name'
]
=
qa_post_text
(
'q_name'
);
$in
[
'notify'
]
=
(
bool
)
qa_post_text
(
'q_notify'
);
$in
[
'notify'
]
=
!
empty
(
qa_post_text
(
'q_notify'
)
);
$in
[
'email'
]
=
qa_post_text
(
'q_email'
);
}
...
...
@@ -781,7 +781,7 @@
if
(
$answer
[
'isbyuser'
])
{
$in
[
'name'
]
=
qa_post_text
(
$prefix
.
'name'
);
$in
[
'notify'
]
=
(
bool
)
qa_post_text
(
$prefix
.
'notify'
);
$in
[
'notify'
]
=
!
empty
(
qa_post_text
(
$prefix
.
'notify'
)
);
$in
[
'email'
]
=
qa_post_text
(
$prefix
.
'email'
);
}
...
...
@@ -982,7 +982,7 @@
if
(
$comment
[
'isbyuser'
])
{
$in
[
'name'
]
=
qa_post_text
(
$prefix
.
'name'
);
$in
[
'notify'
]
=
(
bool
)
qa_post_text
(
$prefix
.
'notify'
);
$in
[
'notify'
]
=
!
empty
(
qa_post_text
(
$prefix
.
'notify'
)
);
$in
[
'email'
]
=
qa_post_text
(
$prefix
.
'email'
);
}
...
...
qa-include/qa-page-question-submit.php
View file @
8c7ee30b
...
...
@@ -324,9 +324,9 @@
{
$in
=
array
(
'name'
=>
qa_post_text
(
'a_name'
),
'notify'
=>
(
bool
)
qa_post_text
(
'a_notify'
),
'notify'
=>
!
empty
(
qa_post_text
(
'a_notify'
)
),
'email'
=>
qa_post_text
(
'a_email'
),
'queued'
=>
(
bool
)
qa_user_moderation_reason
(
qa_user_level_for_post
(
$question
))
,
'queued'
=>
qa_user_moderation_reason
(
qa_user_level_for_post
(
$question
))
!==
false
,
);
qa_get_post_content
(
'a_editor'
,
'a_content'
,
$in
[
'editor'
],
$in
[
'content'
],
$in
[
'format'
],
$in
[
'text'
]);
...
...
@@ -386,9 +386,9 @@
$in
=
array
(
'name'
=>
qa_post_text
(
$prefix
.
'name'
),
'notify'
=>
(
bool
)
qa_post_text
(
$prefix
.
'notify'
),
'notify'
=>
!
empty
(
qa_post_text
(
$prefix
.
'notify'
)
),
'email'
=>
qa_post_text
(
$prefix
.
'email'
),
'queued'
=>
(
bool
)
qa_user_moderation_reason
(
qa_user_level_for_post
(
$parent
))
,
'queued'
=>
qa_user_moderation_reason
(
qa_user_level_for_post
(
$parent
))
!==
false
,
);
qa_get_post_content
(
$prefix
.
'editor'
,
$prefix
.
'content'
,
$in
[
'editor'
],
$in
[
'content'
],
$in
[
'format'
],
$in
[
'text'
]);
...
...
@@ -445,7 +445,7 @@
'text'
=>
qa_viewer_text
(
$post
[
'content'
],
$post
[
'format'
]),
'notify'
=>
isset
(
$post
[
'notify'
]),
'email'
=>
qa_email_validate
(
$post
[
'notify'
])
?
$post
[
'notify'
]
:
null
,
'queued'
=>
(
bool
)
qa_user_moderation_reason
(
qa_user_level_for_post
(
$post
))
,
'queued'
=>
qa_user_moderation_reason
(
qa_user_level_for_post
(
$post
))
!==
false
,
);
if
(
$post
[
'basetype'
]
==
'Q'
)
{
...
...
qa-include/qa-page-user-profile.php
View file @
8c7ee30b
...
...
@@ -435,7 +435,7 @@
// Category-specific levels
if
(
qa_using_categories
())
{
$catleveladd
=
(
bool
)
qa_get
(
'catleveladd'
)
;
$catleveladd
=
strlen
(
qa_get
(
'catleveladd'
))
>
0
;
if
((
!
$catleveladd
)
&&
!
count
(
$userlevels
))
$qa_content
[
'form_profile'
][
'fields'
][
'level'
][
'suffix'
]
=
strtr
(
qa_lang_html
(
'users/category_level_add'
),
array
(
...
...
@@ -545,10 +545,10 @@
// Show email address only if we're an administrator
if
((
$loginlevel
>=
QA_USER_LEVEL_ADMIN
)
&&
!
qa_user_permit_error
())
{
$doconfirms
=
qa_opt
(
'confirm_user_emails'
)
&&
(
$useraccount
[
'level'
]
<
QA_USER_LEVEL_EXPERT
);
$isconfirmed
=
(
bool
)
(
$useraccount
[
'flags'
]
&
QA_USER_FLAGS_EMAIL_CONFIRMED
)
;
$htmlemail
=
qa_html
(
isset
(
$inemail
)
?
$inemail
:
$useraccount
[
'email'
]);
if
((
$loginlevel
>=
QA_USER_LEVEL_ADMIN
)
&&
!
qa_user_permit_error
())
{
$doconfirms
=
qa_opt
(
'confirm_user_emails'
)
&&
(
$useraccount
[
'level'
]
<
QA_USER_LEVEL_EXPERT
);
$isconfirmed
=
(
$useraccount
[
'flags'
]
&
QA_USER_FLAGS_EMAIL_CONFIRMED
)
>
0
;
$htmlemail
=
qa_html
(
isset
(
$inemail
)
?
$inemail
:
$useraccount
[
'email'
]);
$qa_content
[
'form_profile'
][
'fields'
][
'email'
]
=
array
(
'type'
=>
$userediting
?
'text'
:
'static'
,
...
...
qa-include/qa-util-string.php
View file @
8c7ee30b
...
...
@@ -646,7 +646,7 @@
{
if
(
qa_to_override
(
__FUNCTION__
))
{
$args
=
func_get_args
();
return
qa_call_override
(
__FUNCTION__
,
$args
);
}
return
(
bool
)
preg_match
(
"/^[\-\!\#
\$
\%\&\'\*\+\/\=\?\_\`\{\|\}\~a-zA-Z0-9\.\^]+\@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\.\-]+$/"
,
$email
)
;
return
preg_match
(
"/^[\-\!\#
\$
\%\&\'\*\+\/\=\?\_\`\{\|\}\~a-zA-Z0-9\.\^]+\@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\.\-]+$/"
,
$email
)
===
1
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment