<?php

require_once 'includes/common.php';
require_once 'libAllure/FormHandler.php';
use libAllure\FormHandler;
$formHandler = new FormHandler('FormPermissionCreate', $tpl);
$formHandler->setRedirect('listPermissions.php');
$formHandler->handle();
<?php

require_once 'includes/common.php';
use libAllure\FormHandler;
$handler = new FormHandler('FormUpdatePermission', $tpl);
$handler->setRedirect('listPermissions.php');
$handler->handle();
Exemplo n.º 3
0
    public function validateExtended()
    {
        if ($this->getElement('file')->wasAnythingUploaded()) {
            $this->validateFilename();
        }
    }
    public function process()
    {
        $filename = uniqid() . '.png';
        $this->getElement('file')->destinationFilename = 'full/' . $filename;
        $this->getElement('file')->savePng();
        $this->getElement('file')->resize(100, 100);
        $this->getElement('file')->destinationFilename = 'thumb/' . $filename;
        $this->getElement('file')->savePng();
        $gal = intval(str_replace('gallery', null, $this->getElementValue('dir')));
        if ($gal != null) {
            $sql = 'INSERT INTO images (filename, gallery, caption, published, user_uploaded) values (:filename, :gallery, :caption, 0, :user)';
            $stmt = DatabaseFactory::getInstance()->prepare($sql);
            $stmt->bindValue(':filename', $filename);
            $stmt->bindValue(':gallery', $gal);
            $stmt->bindValue(':caption', 'Uploaded by: ' . Session::getUser()->getUsername());
            $stmt->bindValue(':user', Session::getUser()->getId());
            $stmt->execute();
        }
        logActivity(Session::getUser()->getUsername() . ' uploaded image ' . $filename . ' to gallery: ' . $this->getElement('file')->destinationDir);
        redirect('account.php', 'Image has been uploaded, thanks!');
    }
}
$fh = new FormHandler('FormUploadImage');
$fh->handle();
require_once 'includes/widgets/footer.php';