src/AppBundle/Controller/File/AttachmentController.php
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Controller\File;
use AppBundle\Controller\BaseController;
use Biz\File\UploadFileException;
use Biz\User\UserException;
use Topxia\Service\Common\ServiceKernel;
use AppBundle\Util\UploaderToken;
use Symfony\Component\HttpFoundation\Request;
class AttachmentController extends BaseController
{
public function uploadAction(Request $request)
{
$query = $request->query->all();
$useSeajs = $request->query->get('useSeajs', false);
$parser = new UploaderToken();
$params = $parser->parse($query['token']);
if (!$params) {
return $this->createJsonResponse(array('error' => '上传授权码不正确,请重试!'));
}
$template = 'attachment/upload-modal.html.twig';
if ($useSeajs) {
$template = 'attachment/seajs-upload-modal.html.twig';
}
$attachmentSetting = $this->setting('cloud_attachment', array());
return $this->render($template, array(
'token' => $query['token'],
'idsClass' => $query['idsClass'],
'listClass' => $query['listClass'],
'targetType' => $params['targetType'],
'targetId' => $params['targetId'],
'fileSize' => empty($attachmentSetting['fileSize']) ? 0 : $attachmentSetting['fileSize'],
));
}
public function formFieldsAction(Request $request, $targetType, $targetId)
{
$targets = explode('.', $targetType);
$type = 'attachment';
$attachments = $this->getUploadFileService()->findUseFilesByTargetTypeAndTargetIdAndType($targetType, $targetId, $type);
return $this->render('attachment/form-fields.html.twig', array(
'target' => array_shift($targets),
'targetType' => $targetType,
'fileType' => array_pop($targets),
'type' => 'attachment',
'useType' => $request->query->get('useType', false),
'showLabel' => $request->query->get('showLabel', true),
'useSeajs' => $request->query->get('useSeajs', false),
'attachments' => $attachments,
'currentTarget' => $request->query->get('currentTarget', ''),
));
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。