Beispiel #1
0
 public static function parseSoundFile($filename)
 {
     global $getID3;
     // Get sound meta
     $id3 = $getID3->analyze($filename);
     getid3_lib::CopyTagsToComments($id3);
     // Validate
     if (!Sounds::validateID3($id3)) {
         unlink($filename);
         return false;
     }
     // Make our directory
     $artist = @$id3['comments']['artist'][0];
     $album = @$id3['comments']['album'][0];
     $dir = DOC_ROOT . '/music/' . Sounds::safeDirectory($artist) . '/' . Sounds::safeDirectory($album);
     if (!is_dir($dir)) {
         mkdir($dir, 0777, true);
     }
     // Our new filename
     $moved = $dir . '/' . basename($filename);
     // Already exists! Madness!
     if (file_exists($moved)) {
         unlink($filename);
         return false;
     }
     // Move
     rename($filename, $moved);
     // Create and Save
     $sound = new Sound(array('filename' => $moved));
     $sound->save();
     return $sound;
 }
<?php

require_once "inc/models/sounds.php";
if (isset($_GET['id'])) {
    $id = $_GET['id'];
    $sound = Sounds::selectById($id);
}
$again = false;
$view = 'sound-delete';
<?php 
require_once "inc/models/sounds.php";
$action = 'sounds-show-prepare';
$again = true;
if (isset($_GET['id'])) {
    if ($_POST['yes']) {
        $id = $_GET['id'];
        Sounds::deleteById($id);
    }
}
<?php

require_once "inc/models/sounds.php";
require_once "inc/models/sound-groups.php";
$soundGroupArray = SoundGroups::selectAll();
$soundArray = Sounds::selectAll();
if (!isset($msgObject["msg"])) {
    $msgObject["msg"] = '';
}
$again = false;
$view = 'sound-group-create';
<?php

require_once "inc/models/sounds.php";
$action = 'sound-create-prepare';
$again = true;
$path = '';
if (isset($_POST['abort'])) {
    $action = 'sounds-show-prepare';
} else {
    if (isset($_POST['name']) && $_POST['name'] != '') {
        $target_path = realpath(__FILE__) . '/../../../../uploads/' . basename($_FILES['path']['name']);
        if (move_uploaded_file($_FILES['path']['tmp_name'], $target_path)) {
            $path = '/uploads/' . basename($_FILES['path']['name']);
        } else {
            $path = 'Fehler aufgetreten';
        }
        $name = $_POST['name'];
        $description = $_POST['description'];
        $category_id = $_POST['category_id'];
        $soundObject = new Sounds($name, $path, $description, $category_id);
        $soundObject->insert();
        $action = 'sounds-show-prepare';
    } else {
        $action = 'sounds-show-prepare';
        $msgObject = array("type" => "danger", "msg" => "Sound konnte nicht angelegt werden.");
    }
}
Beispiel #6
0
require_once "../models/stories.php";
require_once "../models/sounds.php";
$_POST['gameid'] = 1;
if (isset($_GET['gameobjectid']) && $_GET['gameobjectid'] != '') {
    $gameObjectId = $_GET['gameobjectid'];
    $gameId = $_POST['gameid'];
} else {
    $gameObjectId = 0;
}
$gameArray = Games::selectById($gameId);
$currentPlayerId = $gameArray['current_player'];
$currentStoryId = $gameArray['story_id'];
$playersArray = Players::selectByGameId($gameId);
$storyArray = Stories::selectById($currentStoryId);
$storySequenceArray = json_decode($storyArray['sequence'], true);
$soundArray = Sounds::selectAllOrderedById();
$modifyPlayerSituation = false;
foreach ($playersArray as $key => $value) {
    $playersSituationArray[$key] = json_decode($value[situation], true);
}
echo "Current GameObjectId: {$gameObjectId}<br>";
echo "Current GameId: {$gameId}<br>";
echo "Current StoryId: {$currentStoryId}<br>";
echo "Current PlayerId: {$currentPlayerId}<br><br>";
echo "Dump PlayersArray:<br><br>";
var_dump($playersArray);
echo "<br><br>Dump CurrentPlayerSituationArray:<br><br>";
var_dump($playersSituationArray[$currentPlayerId]);
echo "<br><br>Dump CurrentPlayerSituationArray for GameObjectId:<br><br>";
var_dump($playersSituationArray[$currentPlayerId][$gameObjectId]);
echo "<br><br>";
Beispiel #7
0
<?php

header('Content-Type: application/json');
if (isset($_GET['gameid']) && $_GET['gameid'] != '') {
    $gameid = $_GET['gameid'];
} else {
    $gameid = 0;
}
require_once "../../ini.db.php";
require_once "../models/sounds.php";
require_once "../models/games.php";
$soundArray = Sounds::selectAllByGameId($gameid);
$gameArray = Games::selectById($gameid);
$currentPlayerId = $gameArray['current_player'];
$json = json_encode(array("current_player" => $currentPlayerId, "ambience" => array("id" => $soundArray[0]['id'], "name" => $soundArray[0]['name'], "path" => $soundArray[0]['path'], "category_id" => $soundArray[0]['category_id'], "game_sound_id" => $soundArray[0]['game_sound_id']), "event" => array("id" => $soundArray[1]['id'], "name" => $soundArray[1]['name'], "path" => $soundArray[1]['path'], "category_id" => $soundArray[1]['category_id'], "game_sound_id" => $soundArray[1]['game_sound_id'])));
echo $json;
Beispiel #8
0
<?php

printf('<pre>%1$s</pre>', print_r(Sounds::all(), true));