Beispiel #1
0
<?php

use CMS\Conf\FileUploader;
use CMS\AdminBundle\Entity\Todolist;
use CMS\Conf\Config;
use CMS\AdminBundle\Controller\Adm_usersController as AdminController;
if (!AdminController::isUserLogged()) {
    echo json_encode(array("error" => "Non sei loggato", "logout" => true));
    exit;
}
if (!isset($_POST["messaggio"])) {
    echo json_encode(array("error" => "Inserire il testo!"));
    exit;
}
$controller = new AdminController();
$user = $controller->getUserLogged();
if (!$user) {
    exit;
}
$params = array("testo" => trim(addslashes($_POST["messaggio"])), "data_aggiunta" => date("Y-m-d H:i:s"), "id_user" => $user->getId());
$list = new Todolist(null, $params);
if (is_numeric($list->getId())) {
    $success = true;
} else {
    echo json_encode(array("error" => "There was an error"));
    exit;
}
if (count($_FILES["immagini"]) > 0) {
    $imm = new FileUploader("immagini", "admin/upNoteImages/" . $list->getId());
    $result = $imm->getResult();
    $list->setGallery(implode(",", $result["success"]));
Beispiel #2
0
    if (file_exists($percorso)) {
        require_once str_replace("//", "/", $percorso);
        /*if($class_name[count($class_name)-1] == "Config"){
              $class::setSmarter();
              $class::readProperties();
              $class::readParameters();
          }*/
    }
});
Config::readParameters();
Config::setSmarter();
Config::readProperties();
$check_equal = $_GET["url"] == ADMIN_DIR || $_GET["url"] == "/" . ADMIN_DIR || $_GET["url"] == ADMIN_DIR . "/" || $_GET["url"] == "/" . ADMIN_DIR . "/";
$check = substr($_GET["url"], 0, strlen(ADMIN_DIR)) == ADMIN_DIR || substr($_GET["url"], 0, strlen(ADMIN_DIR) + 1) == "/" . ADMIN_DIR;
if ($check) {
    $controller = new AdminController();
}
if ($check_equal && COUNT($_POST) > 0) {
    if (AdminController::exists()) {
        $cook = md5($_POST["username"]) . "|" . md5($_POST["password"]);
        setcookie("authenticate_user", $cook, time() + 3600 * 24 * 2, "/");
        $user = $controller->findBy(array("username" => $_POST["username"]));
        if (!isset($_SESSION["admin_user"]) || $_SESSION["admin_user"] != $_COOKIE["authenticate_user"]) {
            $_SESSION["admin_user"] = $_COOKIE["authenticate_user"];
            $setAccess = true;
        } else {
            $setAccess = false;
        }
        $controller->dashboardAction($user[0], $setAccess);
    } else {
        $controller->loginAction();
Beispiel #3
0
 public function editAction($sezione, $id)
 {
     $sezione = new Sezioni($sezione, "*", "scheda");
     $user = new Adm_usersController();
     $username = $user->getUserLogged();
     $titolo_field = "";
     $campi_hidden = "";
     $campi = $this->formalizzaCampi($sezione->getCampi("scheda"));
     $object = $sezione->getRows("scheda", array($sezione->getChiave() => $id), "1");
     #print_r($campi);
     return $this->render("admin/scheda", array("sezione" => $sezione, "user" => $username, "id" => $id, "object" => $object[0], "campi" => $campi));
 }