src/AppBundle/Controller/Admin/SensitiveController.php
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Controller\Admin;
use AppBundle\Common\Paginator;
use AppBundle\Common\ArrayToolkit;
use Symfony\Component\HttpFoundation\Request;
class SensitiveController extends BaseController
{
public function indexAction(Request $request)
{
$fields = $request->query->all();
$conditions = array(
'keyword' => '',
'searchKeyWord' => '',
'state' => '',
);
if (empty($fields)) {
$fields = array();
}
$conditions = array_merge($conditions, $fields);
$paginator = new Paginator($this->get('request'), $this->getSensitiveService()->searchkeywordsCount($conditions), 20);
$keywords = $this->getSensitiveService()->searchKeywords($conditions, array('id' => 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
return $this->render('admin/sensitive/index.html.twig', array(
'keywords' => $keywords,
'paginator' => $paginator,
));
}
public function createAction(Request $request)
{
if ('POST' == $request->getMethod()) {
$name = $request->request->get('name');
$keywords = preg_split('/\r/', trim($name), -1, PREG_SPLIT_NO_EMPTY);
$state = $request->request->get('state');
$existedKeyWords = array();
foreach ($keywords as $value) {
$value = trim($value);
if (!empty($value)) {
$keyword = $this->getSensitiveService()->getKeywordByName($value);
if (empty($keyword)) {
$this->getSensitiveService()->addKeyword($value, $state);
continue;
}
$existedKeyWords[] = $value;
}
}
if (!empty($existedKeyWords)) {
$this->setFlashMessage(
'warning',
$this->get('translator')->trans(
'admin.sensitive_manage.existed',
array('%keywords%' => implode(',', array_unique($existedKeyWords)))
)
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。