Commit 4d76a957 authored by thomas craipeau's avatar thomas craipeau
Browse files

fix is_countable

parent 1c204405
......@@ -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;
}
......
......@@ -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']));
}
......
......@@ -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"]) ){
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment