예제 #1
0
파일: salon.php 프로젝트: vin100zz/mesautos
<?php

$annee = $_REQUEST["annee"];
$relPath = "../..";
$path = "img/salon/" . $annee;
$files = scandir($relPath . "/" . $path);
function remove_array_item($array, $item)
{
    $index = array_search($item, $array);
    if ($index !== false) {
        array_splice($array, $index, 1);
    }
    return $array;
}
$files = remove_array_item($files, '.');
$files = remove_array_item($files, '..');
$files = remove_array_item($files, 'mini');
$salon = array("annee" => $annee, "path" => $path, "photos" => $files);
print json_encode($salon, JSON_PRETTY_PRINT);
?>

예제 #2
0
    $trail = new trail();
    $trail->setID($id);
    $info = $trail->getInfo("array");
    $favCount = $info['favorites'];
    $fav = $_SESSION['data']['fav'];
    if ($_POST['value'] == "yes") {
        if (is_array($fav)) {
            $fav[] = $id;
            $message = "added " . $id;
        } else {
            $fav = array(0, $id);
            $message = "added " . $id;
        }
        $favCount = $favCount + 1;
    } else {
        $fav = remove_array_item($fav, $id);
        $message = "removed " . $id;
        $favCount = $favCount - 1;
    }
    $_SESSION['data']['fav'] = $fav;
    $update = array("fav" => $fav);
    $authObj = new Auth();
    $result = $authObj->setAttr($_SESSION['user_id'], $update);
    if ($result == true) {
        $status = array("status" => "done", "message" => $message);
    } else {
        $status = array("status" => "error", "message" => $result);
    }
} else {
    $status = array("status" => "error", "message" => "unauth");
}