コード例 #1
0
ファイル: profile.php プロジェクト: nickavv/iSENSE
$is_owner = true;
$errors = array();
if (isset($_GET['id'])) {
    if ($_GET['id'] != $id) {
        $id = (int) safeString($_GET['id']);
        $is_owner = false;
    }
}
$userdata = getUserDetails($id);
$data = array();
$output = array();
// Grab the users meta data
$data['vis'] = getVisByUser($id);
$data['session'] = browseMySessions($id);
$data['experiment'] = browseExperimentsByUser($id);
$data['image'] = getImagesByUser($id);
$data['video'] = getVideosByUser($id);
/*
$data['activity_responses'] = array();
if($is_owner) {
    $data['activity_responses'] = getFeedFromFollowers($id, -1);
}
else {
    
}
*/
$data['activity_responses'] = getResponsesFromUser($id);
// Compile the user's media
foreach ($data as $key => $value) {
    if (is_array($value)) {
        foreach ($value as $v) {
コード例 #2
0
ファイル: api.php プロジェクト: nickavv/iSENSE
     }
     break;
 case "getSessionsByUser":
     if (isset($_REQUEST['user'])) {
         $id = safeString($_REQUEST['user']);
         $dataset = browseMySessions($id);
         if ($dataset) {
             $data = $dataset;
             $status = 200;
         }
     }
     break;
 case "getImagesByUser":
     if (isset($_REQUEST['user'])) {
         $id = safeString($_REQUEST['user']);
         $dataset = getImagesByUser($id);
         if ($dataset) {
             $data = $dataset;
             $status = 200;
         }
     }
     break;
 case "getVideosByUser":
     if (isset($_REQUEST['user'])) {
         $id = safeString($_REQUEST['user']);
         $dataset = getVideosByUser($id);
         if ($dataset) {
             $data = $dataset;
             $status = 200;
         }
     }
コード例 #3
0
ファイル: mypictures.php プロジェクト: Cibale/sofascoreEDU
<?php

/**
 * Created by PhpStorm.
 * User: martinmatak
 * Date: 20/02/16
 * Time: 18:33
 */
include 'htmllibrary.php';
include 'DAO.php';
session_start();
if (!isset($_SESSION['user_id'])) {
    header('Location: index.php');
}
$images = getImagesByUser('slike.txt');
$imgGallery = getGalleriesIds(array_keys($images), 'slike.txt');
$galleries = getGalleriesNames(array_values($imgGallery), 'galerije.txt');
$brElement = create_element("br", false, null);
create_doctype();
begin_html();
begin_head();
echo create_element("a", true, ["href" => "index.php", "contents" => "Home page"]), $brElement;
echo create_element("a", true, ["href" => "upload.php", "contents" => "Upload a new photo"]), $brElement;
echo create_element("a", true, ["href" => "new_gallery.php", "contents" => "Create a new gallery"]), $brElement;
echo create_element("h1", true, ["contents" => "Your photos:"]);
end_head();
begin_body();
$listElements = array();
foreach ($images as $key => $value) {
    $imgContent = create_element("img", false, ["src" => "picture.php?id={$key}&size=small"]);
    $imgTitle = create_element("h3", true, ['contents' => $value]);
コード例 #4
0
ファイル: editphoto.php プロジェクト: Cibale/sofascoreEDU
/**
 * Created by PhpStorm.
 * User: martinmatak
 * Date: 21/02/16
 * Time: 16:01
 */
include 'htmllibrary.php';
include 'DAO.php';
session_start();
// not logged in or id of photo not set
if (!isset($_SESSION['user_id']) || !isset($_GET['id'])) {
    header('Location: index.php');
}
//not his photo
if (!in_array($_GET['id'], array_keys(getImagesByUser('slike.txt')))) {
    header('Location: index.php');
}
if (!empty($_POST['submitted'])) {
    if (isset($_POST['btnDelete'])) {
        removePicture($_GET['id']);
        header('Location: mypictures.php');
    }
    $data = elements(array('title', 'galleryOption'), $_POST);
    $allGood = true;
    foreach ($data as $value) {
        if ($value === null || empty($value)) {
            $allGood = false;
            break;
        }
    }