1
0
Fork 0

Fix: Notes can be posted again. Never use "defaults" with "false" (#5551)

This commit is contained in:
Michael Vogel 2018-08-04 16:06:36 +02:00 committed by Hypolite Petovan
parent 00fbddcfb8
commit 810c108297
4 changed files with 20 additions and 6 deletions

View file

@ -135,7 +135,13 @@ function item_post(App $a) {
$app = strip_tags(defaults($_REQUEST, 'source', '')); $app = strip_tags(defaults($_REQUEST, 'source', ''));
$extid = strip_tags(defaults($_REQUEST, 'extid', '')); $extid = strip_tags(defaults($_REQUEST, 'extid', ''));
$object = defaults($_REQUEST, 'object', ''); $object = defaults($_REQUEST, 'object', '');
$wall = intval(defaults($_REQUEST, 'wall', 1));
// Don't use "defaults" here. It would turn 0 to 1
if (!isset($_REQUEST['wall'])) {
$wall = 1;
} else {
$wall = $_REQUEST['wall'];
}
// Ensure that the user id in a thread always stay the same // Ensure that the user id in a thread always stay the same
if (!is_null($parent_user) && in_array($parent_user, [local_user(), 0])) { if (!is_null($parent_user) && in_array($parent_user, [local_user(), 0])) {
@ -560,7 +566,12 @@ function item_post(App $a) {
// even if the post arrived via API we are considering that it // even if the post arrived via API we are considering that it
// originated on this site by default for determining relayability. // originated on this site by default for determining relayability.
$origin = intval(defaults($_REQUEST, 'origin', 1)); // Don't use "defaults" here. It would turn 0 to 1
if (!isset($_REQUEST['origin'])) {
$origin = 1;
} else {
$origin = $_REQUEST['origin'];
}
$notify_type = ($parent ? 'comment-new' : 'wall-new'); $notify_type = ($parent ? 'comment-new' : 'wall-new');

View file

@ -1058,7 +1058,12 @@ class DBA
$commands[$key] = ['table' => $table, 'conditions' => $conditions]; $commands[$key] = ['table' => $table, 'conditions' => $conditions];
$cascade = defaults($options, 'cascade', true); // Don't use "defaults" here, since it would set "false" to "true"
if (isset($options['cascade'])) {
$cascade = $options['cascade'];
} else {
$cascade = true;
}
// To speed up the whole process we cache the table relations // To speed up the whole process we cache the table relations
if ($cascade && count(self::$relation) == 0) { if ($cascade && count(self::$relation) == 0) {

View file

@ -70,6 +70,7 @@
{{* The hidden input fields which submit important values with the post *}} {{* The hidden input fields which submit important values with the post *}}
<input type="hidden" name="jot" value="{{$jot}}" /> <input type="hidden" name="jot" value="{{$jot}}" />
<input type="hidden" name="wall" value="{{$wall}}" />
<input type="hidden" name="post_type" value="{{$posttype}}" /> <input type="hidden" name="post_type" value="{{$posttype}}" />
<input type="hidden" name="profile_uid" value="{{$profile_uid}}" /> <input type="hidden" name="profile_uid" value="{{$profile_uid}}" />
<input type="hidden" name="return" value="{{$return_path}}" /> <input type="hidden" name="return" value="{{$return_path}}" />

View file

@ -6,9 +6,6 @@
<input name="category" id="jot-category" type="text" placeholder="{{$placeholdercategory}}" title="{{$placeholdercategory}}" value="{{$category}}" class="jothidden" style="display:none" /> <input name="category" id="jot-category" type="text" placeholder="{{$placeholdercategory}}" title="{{$placeholdercategory}}" value="{{$category}}" class="jothidden" style="display:none" />
{{/if}} {{/if}}
<div id="character-counter" class="grey jothidden"></div> <div id="character-counter" class="grey jothidden"></div>
<input type="hidden" name="wall" value="{{$wall}}" /> <input type="hidden" name="wall" value="{{$wall}}" />
<input type="hidden" name="post_type" value="{{$posttype}}" /> <input type="hidden" name="post_type" value="{{$posttype}}" />
<input type="hidden" name="profile_uid" value="{{$profile_uid}}" /> <input type="hidden" name="profile_uid" value="{{$profile_uid}}" />