<commit_before><?php

namespace Minds\Controllers\api\v2\feeds;

use Minds\Api\Exportable;
use Minds\Api\Factory;
use Minds\Core;
use Minds\Core\Di\Di;
use Minds\Entities\Factory as EntitiesFactory;
use Minds\Entities\User;
use Minds\Interfaces;

class scheduled implements Interfaces\Api
{
    /**
      * Equivalent to HTTP GET method
      * @param array $pages
      * @return mixed|null
      * @throws \Exception
      */
    public function get($pages)
    {
        /** @var User $currentUser */
        $currentUser = Core\Session::getLoggedinUser();

        //

        $container_guid = $pages[0] ?? null;

        if (!$container_guid) {
            return Factory::response([
                'status' => 'error',
                'message' => 'Invalid container',
            ]);
        }

        $container = EntitiesFactory::build($container_guid);

        if (!$container || !Core\Security\ACL::_()->read($container, $currentUser)) {
            return Factory::response([
                'status' => 'error',
                'message' => 'Forbidden',
            ]);
        }

        if (!$currentUser || (
            !$currentUser->isAdmin() &&
            $container->canEdit()
        )) {
            return Factory::response([
                'status' => 'error',
                'message' => 'You cannot view this users scheduled posts',
            ]);
        }

        $type = '';
        switch ($pages[1]) {
            case 'activities':
                $type = 'activity';
                break;
            case 'images':
                $type = 'object-image';
                break;
            case 'videos':
                $type = 'object-video';
                break;<commit_msg>(fix): do canEdit on container check vs guid<commit_after><?php

namespace Minds\Controllers\api\v2\feeds;

use Minds\Api\Exportable;
use Minds\Api\Factory;
use Minds\Core;
use Minds\Core\Di\Di;
use Minds\Entities\Factory as EntitiesFactory;
use Minds\Entities\User;
use Minds\Interfaces;

class scheduled implements Interfaces\Api
{
    /**
      * Equivalent to HTTP GET method
      * @param array $pages
      * @return mixed|null
      * @throws \Exception
      */
    public function get($pages)
    {
        /** @var User $currentUser */
        $currentUser = Core\Session::getLoggedinUser();

        //

        $container_guid = $pages[0] ?? null;

        if (!$container_guid) {
            return Factory::response([
                'status' => 'error',
                'message' => 'Invalid container',
            ]);
        }

        $container = EntitiesFactory::build($container_guid);

        if (!$container || !Core\Security\ACL::_()->read($container, $currentUser)) {
            return Factory::response([
                'status' => 'error',
                'message' => 'Forbidden',
            ]);
        }

        if (!$currentUser ||
            !$container->canEdit()
        ) {
            return Factory::response([
                'status' => 'error',
                'message' => 'You cannot view this users scheduled posts',
            ]);
        }

        $type = '';
        switch ($pages[1]) {
            case 'activities':
                $type = 'activity';
                break;
            case 'images':
                $type = 'object-image';
                break;
            case 'videos':
                $type = 'object-video';
                break;
{'fraction_non_alphanumeric': 0.13674716322374164, 'fraction_numerical': 0.0017457084666860634, 'mean_word_length': 1.6124620060790273, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '509848', 'n_tokens_mistral': 945, 'n_tokens_neox': 927, 'n_words': 209}