Beispiel #1
0
         Logger::welcomeTemplateDeleted($database, $template);
         $template->delete();
         SessionAlert::success("Template deleted. Any users who were using this template have had automatic welcoming disabled.");
         Notification::welcomeTemplateDeleted($tid);
     });
     header("Location: {$baseurl}/acc.php?action=templatemgmt");
     die;
 }
 if (isset($_GET['edit'])) {
     if (!User::getCurrent()->isAdmin() && !User::getCurrent()->isCheckuser()) {
         BootstrapSkin::displayAccessDenied();
         BootstrapSkin::displayInternalFooter();
         die;
     }
     $database = gGetDb();
     $template = WelcomeTemplate::getById($_GET['edit'], $database);
     if ($template == false) {
         SessionAlert::success("Something went wrong, we can't find the template you asked for! Please try again.");
         header("Location: {$baseurl}/acc.php?action=templatemgmt");
         die;
     }
     if (isset($_POST['submit'])) {
         $database->transactionally(function () use($database, $template) {
             $template->setUserCode($_POST['usercode']);
             $template->setBotCode($_POST['botcode']);
             $template->save();
             Logger::welcomeTemplateEdited($database, $template);
             SessionAlert::success("Template updated.");
             Notification::welcomeTemplateEdited($template);
         });
         header("Location: {$baseurl}/acc.php?action=templatemgmt");