یک پرونده بار می‌شود.

@param unknown $request
@param unknown $match
769426
public function loadGsonFile ($request, $match)
    {
        foreach ($request->FILES as $file) {
            if (is_readable($file['tmp_name'])) {
                Geo_Shortcuts_LoadJson($request->tenant, $request->user, $file['tmp_name']);
            }
        }
        return new Pluf_HTTP_Response_Json(
                new ArrayObject(array(
                        'success' => true
                )));
    }
1233350
public function findTermTaxonomies($request, $match)
    {
        $content = Pluf_Shortcuts_GetObjectOr404('CMS_Content', $match['parentId']);
        $tt = new CMS_TermTaxonomy();
        Pluf::loadFunction('Pluf_Shortcuts_GetAssociationTableName');
        $assoc = $tt->_con->pfx . Pluf_Shortcuts_GetAssociationTableName('CMS_Content', 'CMS_TermTaxonomy');
        $tt_table = $tt->_con->pfx . $tt->_a['table'];
        Pluf::loadFunction('Pluf_Shortcuts_GetForeignKeyName');
        $tt_fk = Pluf_Shortcuts_GetForeignKeyName('CMS_TermTaxonomy');
        $content_fk = Pluf_Shortcuts_GetForeignKeyName('CMS_Content');
        $tt->_a['views'] = array(
            'join_content' => array(
                'join' => 'LEFT JOIN ' . $assoc . ' ON ' . $tt_table . '.id=' . $tt_fk
            )
        );
        $sql = new Pluf_SQL('`' . $content_fk . '`=%s', array(
            $content->id
        ));
        $builder = new Pluf_Paginator_Builder($tt);
        return $builder->setRequest($request)
            ->setView('join_content')
            ->setWhereClause($sql)
            ->build();
    }
96098
public function addTag ($request, $match)
    {
        $location = Geo_Shortcuts_GetLocationOr404($match[1]);
        Geo_Precondition::canEditLocation($request, $location);
        $tag = SaaSKM_Shortcuts_GetTagOr404($match[2]);
        SaaSKM_Precondition::userCanAccessTag($request, $tag); 
        SaaSKM_TagRow::add($request->tenant, $location, $tag);
        return new Pluf_HTTP_Response_Json($location);
    }
604824
public static function paidAmount($request, $match)
    {
        $model = new Bank_Receipt();
        $params = array(
            'select' => 'SUM(amount) AS amount',
            'filter' => array(
                'payRef IS NOT NULL',
                'payMeta IS NOT NULL'
            )
        );
        $result = $model->getList($params);
        return $result[0]->amount;
    }
1060422
private function match(InternalRequestInterface $request)
    {
        return !$this->hasMatcher()
            || (is_string($this->matcher) && preg_match($this->matcher, (string) $request->getUri()))
            || (is_callable($this->matcher) && call_user_func($this->matcher, $request));
    }
1122090
public function get($request, $match)
    {
        $userId = $match['userId'];
//         $user = Pluf_Shortcuts_GetObjectOr404('User', $userId);
//         try {
//             $profile = $user->getProfile();
//         } catch (Pluf_Exception_DoesNotExist $ex) {
//             $profile = new $profile_model();
//             $profile->user = $user;
//             $profile->create();
//         }
//         return new Pluf_HTTP_Response_Json($profile);
        $profileDoc = User_Views_CProfile::get_profile_document($userId);
        $docMap = User_Views_CProfile::getDocumentMap($profileDoc);
        $docMap['user'] = $userId;
        return new Pluf_HTTP_Response_Json($docMap);
    }
1303445
public static function create($request, $match)
    {
        $model = new User_Role();
        $form = Pluf_Shortcuts_GetFormForModel($model, $request->REQUEST, array());
        return new Pluf_HTTP_Response_Json($form->save());
    }
669201
private function internalGet($request, $match){
        if ($request->user->hasPerm('tenant.owner')) {
            $sql = new Pluf_SQL('`key`=%s', array(
                $match['key']
            ));
        } else {
            $sql = new Pluf_SQL('`key`=%s AND `mode`=%s', array(
                $match['key'],
                Tenant_Setting::MOD_PUBLIC
            ));
        }
        $model = new Tenant_Setting();
        $model = $model->getOne(array(
            'filter' => $sql->gen()
        ));
        return $model;
    }
938610
public function update($request, $match)
    {
        $currentUser = $request->user;
        $user = Pluf_Shortcuts_GetObjectOr404('User', $match['userId']);
        if($currentUser->getId() === $user->getId() || User_Precondition::ownerRequired($request)){
            $profileDoc = User_Views_CProfile::get_profile_document($user->id);
            User_Views_CProfile::putDocumentMap($profileDoc, $request->REQUEST);
            $docMap = User_Views_CProfile::getDocumentMap($profileDoc);
            $docMap['user'] = $user->id;
            return new Pluf_HTTP_Response_Json($docMap);
        }
        throw new Pluf_Exception_PermissionDenied("Permission is denied");
    }
649207
public static function get($request, $match)
    {
        if(isset($match['userId'])){        
            $user = Pluf_Shortcuts_GetObjectOr404('User_Account', $match['userId']);
        }else{
            $user = $request->user;
        }
        if (array_key_exists('profileId', $match)) {
            return Pluf_Shortcuts_GetObjectOr404('User_Profile', $match['profileId']);
        }
        $profile = self::getProfileOfUser($user);
        if($profile === null){
            $profile = new User_Profile();
            $profile->account_id = $user;
        }
        return $profile;
    }
658829
public static function get($request, $match)
    {
        if (array_key_exists('userId', $match)) {
            $user = Pluf_Shortcuts_GetObjectOr404('User_Account', $match['userId']);
        } else {
            $user = $request->user;
        }
        if($user->isAnonymous()){
            throw new Pluf_Exception_BadRequest('User is not defined');
        }
        return User_Shortcuts_GetAvatar($user);
    }
1164376
public function get ($request, $match)
    {
        if (isset($match['collectionId'])) {
            $collectionId = $match['collectionId'];
        } else {
            $collectionId = $request->REQUEST['collectionId'];
        }
        $collection = Pluf_Shortcuts_GetObjectOr404('Collection_Collection', 
                $collectionId);
        $document = Pluf_Shortcuts_GetObjectOr404('Collection_Document', 
                $match['documentId']);
        if ($document->collection !== $collection->id) {
            throw new Pluf_Exception_DoesNotExist(
                    'Document with id (' . $document->id .
                             ') does not exist in collection with id (' .
                             $collection->id . ')');
        }
        return new Pluf_HTTP_Response_Json($document);
    }
1352426
public function loadResource($request, $match)
    {
        // First part of path
        $firstPart = $match['firstPart'];
        // Remain part of path
        $remainPart = '';
        if (array_key_exists('remainPart', $match)) {
            $remainPart = $match['remainPart'];
        }

        $spa = Tenant_SPA::getSpaByName($firstPart);
        if (isset($spa)) { // SPA is valid
            $path = $remainPart;
            $spaName = $firstPart;
        } else {
            // first part is not an SPA so use default SPA
            $path = isset($remainPart) && ! empty($remainPart) ? $firstPart . '/' . $remainPart : $firstPart;

            // find a resource
            $tenantResource = $this->findTenantResource('/' . $path);
            if ($tenantResource) {
                return new Pluf_HTTP_Response_File($tenantResource->getAbsloutPath(), $tenantResource->mime_type);
            }

            // [OR] check for default spa
            $name = Tenant_Service::setting('spa.default', 'not-found');
            $spa = Tenant_SPA::getSpaByName($name);
            if ($spa === null) {
                $spa = Tenant_SpaService::getNotfoundSpa();
                $spaName = 'not-found';
            } else {
                $spaName = null;
            }
        }

        if (preg_match('/.+\.[a-zA-Z0-9]+$/', $path)) {
            // Looking for file in SPA
            $resPath = $spa->getResourcePath($path);
            $isMain = false;
        } else {
            // [OR]Request is for main file (path is an internal state)
            $resPath = $spa->getMainPagePath();
            $isMain = true;
        }
        if ($isMain) {
            return new Tenant_HTTP_Response_SpaMain($resPath, Pluf_FileUtil::getMimeType($resPath), $spaName);
        } else {
            return new Pluf_HTTP_Response_File($resPath, Pluf_FileUtil::getMimeType($resPath));
        }
    }
227853
public function defaultSpaRobotsTxt($request, $match)
    {
        $name = Tenant_Service::setting('spa.default', 'not-found');
        $spa = Tenant_SPA::getSpaByName($name);
        if (! isset($spa)) {
            $spa = Tenant_SpaService::getNotfoundSpa();
        }
        $resourcePath = $spa->getResourcePath('robots.txt');
        $host = ($request->https ? 'https://' : 'http://') . $request->SERVER['HTTP_HOST'];
        return new Tenant_HTTP_Response_RobotsTxt($host, $resourcePath);
    }
239009
public function delete($request, $match)
    {
        $model = Pluf_Shortcuts_GetObjectOr404('User_Role', $match['id']);
        $model2 = new User_Role($match['id']);
        if ($model->delete()) {
            return new Pluf_HTTP_Response_Json($model2);
        }
        throw new Pluf_HTTP_Error500('Unexpected error while removing role: ' . $model2->code_name);
    }
1262635
public function createManyToOne($request, $match)
    {
        $parent = Pluf_Shortcuts_GetObjectOr404('Tenant_Ticket', $match['parentId']);
        $object = new Tenant_Comment();
        $form = Pluf_Shortcuts_GetFormForModel($object, $request->REQUEST);
        $object = $form->save(false);
        $object->ticket_id = $parent;
        $object->author_id = $request->user;
        $object->create();
        return $object;
    }
986103
public function updateFile($request, $match)
    {
        // Get data
        $content = Pluf_Shortcuts_GetObjectOr404('CMS_Content', $match['modelId']);
        // Check accesss
        if (! CMS_Precondition::isAuthor($request)) {
            throw new Pluf_Exception_PermissionDenied('You are not an author');
        }
        if (! CMS_Precondition::isEditor($request) && $request->user->id !== $content->author_id) {
            throw new Pluf_Exception_PermissionDenied('You can not change content created by another author');
        }
        // Do action
        if (array_key_exists('file', $request->FILES)) {
            $extra = array(
                'model' => $content
            );
            $form = new CMS_Form_ContentUpdate(array_merge($request->REQUEST, $request->FILES), $extra);
            $content = $form->save();
            return $content;
        } else {
            $myfile = fopen($content->getAbsloutPath(), "w") or die("Unable to open file!");
            $entityBody = file_get_contents('php://input', 'r');
            fwrite($myfile, $entityBody);
            fclose($myfile);
            $content->update();
        }
        return $content;
    }