Exemple #1
0
<?php

include $_SERVER["DOCUMENT_ROOT"] . "/php/init.php";
$nrofpictures = $_POST["nrofpictures"];
$approve_type = $_POST["approve_type"];
for ($i = 1; $i <= $nrofpictures; $i++) {
    $bildid = $_POST["bild_{$i}"];
    $fotoalbumbild = FotoalbumBild::loadById($bildid);
    $fotoalbumbild->setApproved($approve_type);
}
header("Location: " . $_SERVER["HTTP_REFERER"]);
Exemple #2
0
 public function delete()
 {
     global $USER;
     //Security::demand(USER, $this->getMedlem());
     if (Security::authorized(ADMIN) || Security::authorized(USER, $this->getMedlem())) {
         // Leta reda på alla bilder som tillhör detta fotoalbum
         $medlem = Medlem::loadById($this->getMedlemId());
         $bilder = FotoalbumBild::listAsArray($medlem, $this->getId());
         for ($x = 0; $x < count($bilder); $x++) {
             // .. och plocka bort bild för bild
             $bild = FotoalbumBild::loadById($bilder[$x]["id"]);
             $bild->delete();
         }
         // Plocka bort själva fotoalbumet
         parent::delete();
     } else {
         throw new SecurityException("Ej behörig", "Du har inte behörighet att ta bort bilden");
     }
 }
<?php

require $_SERVER["DOCUMENT_ROOT"] . "/php/init.php";
// kolla rättigheter/tillträde
$bild = FotoalbumBild::loadById($_GET["id"]);
if ($bild->getFotoalbumId() > 0) {
    $fotoalbum = Fotoalbum::loadById($bild->getFotoalbumId());
    // har besökaren tilltrade till detta fotoalbum?
    if (!$fotoalbum->harMedlemTilltrade($USER)) {
        // nej
        exit;
    }
} elseif ($bild->getMedlemId() != $USER->getId()) {
    // äger inte bilden
    exit;
}
$filename = FOTOALBUM_PATH . "/" . $_GET["id"] . "_" . $_GET["storlek"] . ".jpg";
header("Content-type: image/jpeg");
header("Content-length: " . filesize($filename));
readfile($filename);
Exemple #4
0
$smarty->assign("pagetitle", "Kommun - " . $kommunNamn);
$notin = array($kommun->getId());
$kommunnamn = Kommun::listNamn();
$medlemmarIKommun = Medlem::loadByJustNuKommun($kommun);
if ($medlemmarIKommun) {
    $smarty->assign("medlemmarIKommun", $medlemmarIKommun);
}
$smarty->assign("kommunnamn", $kommunnamn);
$avstand = $kommun->listAvstand();
$smarty->assign("avstand", $avstand);
$grannkommuner = array();
$taggs = Tagg::listByTagId($kommun->getId(), Kommun::TABLE);
$taggbilder = array();
if ($taggs) {
    foreach ($taggs as $tagg) {
        $bild = FotoalbumBild::loadById($tagg->getObjektId());
        if ($bild->getApproved()) {
            $taggbilder[] = $bild;
        }
    }
}
// print_r($taggbilder);
$smarty->assign('taggbilder', $taggbilder);
$kommuner_ids = array();
foreach ($avstand as $tmp) {
    $kommuner_ids[] = $tmp["id"];
}
$grannkommuner = Kommun::listByIds($kommuner_ids);
$smarty->assign("grannkommuner", $grannkommuner);
$avstandArgs = array();
foreach ($avstand as $temp) {