]> git.mxchange.org Git - friendica.git/commitdiff
Fix: Notes can be posted again. Never use "defaults" with "false" (#5551)
authorMichael Vogel <icarus@dabo.de>
Sat, 4 Aug 2018 14:06:36 +0000 (16:06 +0200)
committerHypolite Petovan <mrpetovan@eml.cc>
Sat, 4 Aug 2018 14:06:36 +0000 (16:06 +0200)
mod/item.php
src/Database/DBA.php
view/theme/frio/templates/jot.tpl
view/theme/quattro/templates/jot.tpl

index afb119c8affed95dff4bb55b06fc6e647b4fb73c..ca0e5e19047536a86bbb63cd58ddb193d9df96eb 100644 (file)
@@ -135,7 +135,13 @@ function item_post(App $a) {
        $app         = strip_tags(defaults($_REQUEST, 'source', ''));
        $extid       = strip_tags(defaults($_REQUEST, 'extid', ''));
        $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
        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
        // 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');
 
index 902efda1fa1ab9e64b356f5a7e86d5febb2e5e47..c0b783c29dccc6e8101b94e080c992a5cfa73083 100644 (file)
@@ -1058,7 +1058,12 @@ class DBA
 
                $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
                if ($cascade && count(self::$relation) == 0) {
index 260d4c18e45246523d5c52dae79a5214b5da2c19..423be5a5d99b8f12bd5190dcf4bf3afe518d051d 100644 (file)
@@ -70,6 +70,7 @@
 
                                        {{* The hidden input fields which submit important values with the post *}}
                                        <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="profile_uid" value="{{$profile_uid}}" />
                                        <input type="hidden" name="return" value="{{$return_path}}" />
index 48c084ca0a6ca6b6fe40432663ba5a4715ae369e..bdf21b8f74a1cf044fac1a912984bbb4b0d9536b 100644 (file)
@@ -6,9 +6,6 @@
                <input name="category" id="jot-category" type="text" placeholder="{{$placeholdercategory}}" title="{{$placeholdercategory}}" value="{{$category}}" class="jothidden" style="display:none" />
                {{/if}}
                <div id="character-counter" class="grey jothidden"></div>
-
-
-
                <input type="hidden" name="wall" value="{{$wall}}" />
                <input type="hidden" name="post_type" value="{{$posttype}}" />
                <input type="hidden" name="profile_uid" value="{{$profile_uid}}" />