Beispiel #1
0
function checkThreadsTopic($threads, $idTopic, $threadMembers, $userID)
{
    $counter = 0;
    foreach ($threads as $thr) {
        if ($thr->topic == $idTopic) {
            if ($thr->type == 'close') {
                $close = sumCloseThread($threadMembers, $thr->id, $userID);
                $counter += $close;
            } else {
                $counter += 1;
            }
        }
    }
    return $counter;
}
function checkThreadsTopic($threads, $idTopic, $threadMembers, $categoryID, $categoryUser, $topicTenagaAhli, $userID)
{
    $counter = 0;
    foreach ($threads as $thr) {
        if ($thr->topic == $idTopic and $topicTenagaAhli != $userID) {
            if ($thr->type == 'close' and $thr->author != $userID) {
                foreach ($categoryUser as $catUS) {
                    if ($catUS->user_id == $userID and $catUS->category_id == $categoryID) {
                        $counter += 1;
                    } else {
                        $close = sumCloseThread($threadMembers, $thr->id, $userID);
                        $counter += $close;
                    }
                }
            } else {
                $counter += 1;
            }
        } elseif ($thr->topic == $idTopic and $topicTenagaAhli == $userID) {
            $counter += 1;
        }
    }
    return $counter;
}