Posts: 2,833
Threads: 141
Joined: Jan 2012
Reputation:
86
If a plugin uses a global variable named "$announcement" the modcp edit announcement part will thrown the error "The specified announcement doesn't exist". That's because of
this if. The reason for the if is to avoid that the announcement is loaded multiple times (it's already loaded in do_edit_announcement normally). However it fails when the variable is already in use. IMHO we should add a check for request_method == "post".
Support PMs will be ignored!
Posts: 2,833
Threads: 141
Joined: Jan 2012
Reputation:
86
Support PMs will be ignored!
Posts: 2,833
Threads: 141
Joined: Jan 2012
Reputation:
86
2015-06-29, 06:32 AM
(This post was last modified: 2015-06-29, 06:34 AM by Jones H.)
Yeah, meant the "isset" - if the request method is post, the variable/announcement is loaded already. If you're accessing it directly (without a post request) the query is always executed. So the if would be:
if(!isset($announcement) || $mybb->request_method != 'post')
Don't know about other places but IMHO we should fix those cases to - "announcement" is a very common variable name, especially for announcement managers (we have at least 3 of them on the mods site).
Edit: Probably even better to check for $mybb->input['action'] != 'do_edit_announcement'.
Support PMs will be ignored!
Posts: 2,833
Threads: 141
Joined: Jan 2012
Reputation:
86
Ah, yeah, forgot that we change that always...
Support PMs will be ignored!