Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pixel Humain
news
Commits
4d76a957
Commit
4d76a957
authored
May 11, 2022
by
thomas craipeau
Browse files
fix is_countable
parent
1c204405
Changes
3
Hide whitespace changes
Inline
Side-by-side
controllers/actions/GetAction.php
View file @
4d76a957
...
...
@@ -323,7 +323,7 @@ class GetAction extends \PixelHumain\PixelHumain\components\Action
$limit
=
(
@
$_POST
[
"indexStep"
])
?
$_POST
[
"indexStep"
]
:
6
;
$news
=
News
::
getNewsForObjectId
(
$where
,
array
(
"sharedBy.updated"
=>-
1
),
$type
,
$limit
,
@
$followsArrayIds
);
$params
[
"endStream"
]
=
(
count
(
$news
)
==
$limit
)
?
false
:
true
;
$params
[
"endStream"
]
=
(
(
is_countable
(
$news
)
?
count
(
$news
)
:
0
)
==
$limit
)
?
false
:
true
;
foreach
(
$news
as
$key
=>
$newsItem
)
{
if
(
@
$newsItem
[
"type"
]){
if
(
$newsItem
[
"type"
]
===
"activitypub"
){
...
...
@@ -353,7 +353,7 @@ class GetAction extends \PixelHumain\PixelHumain\components\Action
//TODO : reorganise by created date
$params
[
"news"
]
=
$news
;
$params
[
"limitDate"
]
=
end
(
$news
);
if
(
count
(
$news
)
==
0
&&
$removeNews
===
true
){
if
(
(
is_countable
(
$news
)
?
count
(
$news
)
:
0
)
==
0
&&
$removeNews
===
true
){
$params
[
"limitDate"
]
=
$removeNewsUpdated
;
$params
[
"removeNews"
]
=
$removeNewsArray
;
}
...
...
controllers/actions/ModerateAction.php
View file @
4d76a957
...
...
@@ -112,7 +112,7 @@ class ModerateAction extends \PixelHumain\PixelHumain\components\Action
}
elseif
(
isset
(
$_REQUEST
[
'subAction'
])
&&
$_REQUEST
[
'subAction'
]
==
"getNextIdToModerate"
){
$params
=
News
::
getNewsToModerate
(
null
,
1
);
if
(
isset
(
$params
)
&&
count
(
$params
)){
if
(
isset
(
$params
)
&&
(
is_countable
(
$params
)
?
count
(
$params
)
:
0
)
){
$params
=
array_pop
(
$params
);
return
Rest
::
json
(
array
(
"result"
=>
true
,
"msg"
=>
"il y a des news à modérer"
,
"newsId"
=>
(
string
)
@
$params
[
'_id'
]));
}
...
...
views/co/timelinePanel.php
View file @
4d76a957
...
...
@@ -103,7 +103,7 @@ if(@$media["object"]){
<?php
//var_dump(@$media["sharedBy"]);
if
(
@
$media
[
"sharedBy"
]
&&
@
$media
[
"verb"
]
==
"share"
){
$countSharedBy
=
count
(
$media
[
"sharedBy"
]);
$countSharedBy
=
is_countable
(
$media
[
"sharedBy"
])
?
count
(
$media
[
"sharedBy"
])
:
0
;
if
(
$countSharedBy
==
1
){
if
(
isset
(
$media
[
"lastAuthorShare"
])
){
...
...
Write
Preview
Supports
Markdown
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