示例#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;
 }
示例#2
0
 public function interfaceAction()
 {
     $question = new Questionreponse();
     $this->view->lesquestions = $question->selectAll();
     $volume = new Sound();
     $volumeActuel = $volume->selectVolume();
     $this->view->volume = $volumeActuel[0]['volume'];
 }
示例#3
0
require 'lib/bigbuttons.php';
?>
<!doctype html>
<html lang="en">
<head>
  <title>Big Buttons</title>
  <meta charset=utf-8>
  <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
  <script src="bigbuttons.jquery.js"></script>
  <link rel="stylesheet" href="bigbuttons.css" />
</head>
<body>
  <ol class="bigbuttons">
<?php 
foreach (Sound::all() as $sound) {
    ?>
    <li>
      <button>
        <audio src="<?php 
    echo h($sound->path);
    ?>
" preload="none">
          <a href="<?php 
    echo h($sound->path);
    ?>
"><?php 
    echo h($sound->path);
    ?>
</a>
        </audio>
<?php

require_once __DIR__ . "/../autoload/session.autoload.php";
require_once __DIR__ . "/../class/Sound.class.php";
if (isset($_POST)) {
    $Sound = new Sound();
    $Sound->setUsername($_POST['username']);
    $Sound->toggle();
    header("location:/users.admin.php?event=param-changed");
}
示例#5
0
function CreateTestAnnots($doc)
{
    $ew = new ElementWriter();
    $eb = new ElementBuilder();
    $first_page = $doc->PageCreate(new Rect(0.0, 0.0, 600.0, 600.0));
    $doc->PagePushBack($first_page);
    $ew->Begin($first_page, ElementWriter::e_overlay, false);
    // begin writing to this page
    $ew->End();
    // save changes to the current page
    //
    // Test of a free text annotation.
    //
    $txtannot = FreeText::Create($doc->GetSDFDoc(), new Rect(10.0, 400.0, 160.0, 570.0));
    $txtannot->SetContents("\n\nSome swift brown fox snatched a gray hare out of the air by freezing it with an angry glare." . "\n\nAha!\n\nAnd there was much rejoicing!");
    $txtannot->SetBorderStyle(new BorderStyle(BorderStyle::e_solid, 1.0, 10.0, 20.0), true);
    $txtannot->SetQuaddingFormat(0);
    $first_page->AnnotPushBack($txtannot);
    $txtannot->RefreshAppearance();
    $txtannot = FreeText::Create($doc->GetSDFDoc(), new Rect(100.0, 100.0, 350.0, 500.0));
    $txtannot->SetContentRect(new Rect(200.0, 200.0, 350.0, 500.0));
    $txtannot->SetContents("\n\nSome swift brown fox snatched a gray hare out of the air by freezing it with an angry glare." . "\n\nAha!\n\nAnd there was much rejoicing!");
    $txtannot->SetCalloutLinePoints(new Point(200.0, 300.0), new Point(150.0, 290.0), new Point(110.0, 110.0));
    $txtannot->SetBorderStyle(new BorderStyle(BorderStyle::e_solid, 1.0, 10.0, 20.0), true);
    $txtannot->SetEndingStyle(LineAnnot::e_ClosedArrow);
    $txtannot->SetColor(new ColorPt(0.0, 1.0, 0.0));
    $txtannot->SetQuaddingFormat(1);
    $first_page->AnnotPushBack($txtannot);
    $txtannot->RefreshAppearance();
    $txtannot = FreeText::Create($doc->GetSDFDoc(), new Rect(400.0, 10.0, 550.0, 400.0));
    $txtannot->SetContents("\n\nSome swift brown fox snatched a gray hare out of the air by freezing it with an angry glare." . "\n\nAha!\n\nAnd there was much rejoicing!");
    $txtannot->SetBorderStyle(new BorderStyle(BorderStyle::e_solid, 1.0, 10.0, 20.0), true);
    $txtannot->SetColor(new ColorPt(0.0, 0.0, 1.0));
    $txtannot->SetOpacity(0.2);
    $txtannot->SetQuaddingFormat(2);
    $first_page->AnnotPushBack($txtannot);
    $txtannot->RefreshAppearance();
    $page = $doc->PageCreate(new Rect(0.0, 0.0, 600.0, 600.0));
    $doc->PagePushBack($page);
    $ew->Begin($page, ElementWriter::e_overlay, false);
    // begin writing to this page
    $eb->Reset();
    // Reset the GState to default
    $ew->End();
    // save changes to the current page
    //Create a Line annotation...
    $line = LineAnnot::Create($doc->GetSDFDoc(), new Rect(250.0, 250.0, 400.0, 400.0));
    $line->SetStartPoint(new Point(350.0, 270.0));
    $line->SetEndPoint(new Point(260.0, 370.0));
    $line->SetStartStyle(LineAnnot::e_Square);
    $line->SetEndStyle(LineAnnot::e_Circle);
    $line->SetColor(new ColorPt(0.3, 0.5, 0.0), 3);
    $line->SetContents("Dashed Captioned");
    $line->SetShowCaption(true);
    $line->SetCaptionPosition(LineAnnot::e_Top);
    $line->SetBorderStyle(new BorderStyle(BorderStyle::e_dashed, 2.0, 0.0, 0.0, array(2.0, 2.0)));
    $line->RefreshAppearance();
    $page->AnnotPushBack($line);
    $line = LineAnnot::Create($doc->GetSDFDoc(), new Rect(347.0, 377.0, 600.0, 600.0));
    $line->SetStartPoint(new Point(385.0, 410.0));
    $line->SetEndPoint(new Point(540.0, 555.0));
    $line->SetStartStyle(LineAnnot::e_Circle);
    $line->SetEndStyle(LineAnnot::e_OpenArrow);
    $line->SetColor(new ColorPt(1.0, 0.0, 0.0), 3);
    $line->SetInteriorColor(new ColorPt(0.0, 1.0, 0.0), 3);
    $line->SetContents("Inline Caption");
    $line->SetShowCaption(true);
    $line->SetCaptionPosition(LineAnnot::e_Inline);
    $line->SetLeaderLineExtensionLength(-4.0);
    $line->SetLeaderLineLength(-12.0);
    $line->SetLeaderLineOffset(2.0);
    $line->RefreshAppearance();
    $page->AnnotPushBack($line);
    $line = LineAnnot::Create($doc->GetSDFDoc(), new Rect(10.0, 400.0, 200.0, 600.0));
    $line->SetStartPoint(new Point(25.0, 426.0));
    $line->SetEndPoint(new Point(180.0, 555.0));
    $line->SetStartStyle(LineAnnot::e_Circle);
    $line->SetEndStyle(LineAnnot::e_Square);
    $line->SetColor(new ColorPt(0.0, 0.0, 1.0), 3);
    $line->SetInteriorColor(new ColorPt(1.0, 0.0, 0.0), 3);
    $line->SetContents("Offset Caption");
    $line->SetShowCaption(true);
    $line->SetCaptionPosition(LineAnnot::e_Top);
    $line->SetTextHOffset(-60);
    $line->SetTextVOffset(10);
    $line->RefreshAppearance();
    $page->AnnotPushBack($line);
    $line = LineAnnot::Create($doc->GetSDFDoc(), new Rect(200.0, 10.0, 400.0, 70.0));
    $line->SetStartPoint(new Point(220.0, 25.0));
    $line->SetEndPoint(new Point(370.0, 60.0));
    $line->SetStartStyle(LineAnnot::e_Butt);
    $line->SetEndStyle(LineAnnot::e_OpenArrow);
    $line->SetColor(new ColorPt(0.0, 0.0, 1.0), 3);
    $line->SetContents("Regular Caption");
    $line->SetShowCaption(true);
    $line->SetCaptionPosition(LineAnnot::e_Top);
    $line->RefreshAppearance();
    $page->AnnotPushBack($line);
    $line = LineAnnot::Create($doc->GetSDFDoc(), new Rect(200.0, 70.0, 400.0, 130.0));
    $line->SetStartPoint(new Point(220.0, 111.0));
    $line->SetEndPoint(new Point(370.0, 78.0));
    $line->SetStartStyle(LineAnnot::e_Circle);
    $line->SetEndStyle(LineAnnot::e_Diamond);
    $line->SetContents("Circle to Diamond");
    $line->SetColor(new ColorPt(0.0, 0.0, 1.0), 3);
    $line->SetInteriorColor(new ColorPt(0.0, 1.0, 0.0), 3);
    $line->SetShowCaption(true);
    $line->SetCaptionPosition(LineAnnot::e_Top);
    $line->RefreshAppearance();
    $page->AnnotPushBack($line);
    $line = LineAnnot::Create($doc->GetSDFDoc(), new Rect(10.0, 100.0, 160.0, 200.0));
    $line->SetStartPoint(new Point(15.0, 110.0));
    $line->SetEndPoint(new Point(150.0, 190.0));
    $line->SetStartStyle(LineAnnot::e_Slash);
    $line->SetEndStyle(LineAnnot::e_ClosedArrow);
    $line->SetContents("Slash to CArrow");
    $line->SetColor(new ColorPt(1.0, 0.0, 0.0), 3);
    $line->SetInteriorColor(new ColorPt(0.0, 1.0, 1.0), 3);
    $line->SetShowCaption(true);
    $line->SetCaptionPosition(LineAnnot::e_Top);
    $line->RefreshAppearance();
    $page->AnnotPushBack($line);
    $line = LineAnnot::Create($doc->GetSDFDoc(), new Rect(270.0, 270.0, 570.0, 433.0));
    $line->SetStartPoint(new Point(300.0, 400.0));
    $line->SetEndPoint(new Point(550.0, 300.0));
    $line->SetStartStyle(LineAnnot::e_RClosedArrow);
    $line->SetEndStyle(LineAnnot::e_ROpenArrow);
    $line->SetContents("ROpen & RClosed arrows");
    $line->SetColor(new ColorPt(0.0, 0.0, 1.0), 3);
    $line->SetInteriorColor(new ColorPt(0.0, 1.0, 0.0), 3);
    $line->SetShowCaption(true);
    $line->SetCaptionPosition(LineAnnot::e_Top);
    $line->RefreshAppearance();
    $page->AnnotPushBack($line);
    $line = LineAnnot::Create($doc->GetSDFDoc(), new Rect(195.0, 395.0, 205.0, 505.0));
    $line->SetStartPoint(new Point(200.0, 400.0));
    $line->SetEndPoint(new Point(200.0, 500.0));
    $line->RefreshAppearance();
    $page->AnnotPushBack($line);
    $line = LineAnnot::Create($doc->GetSDFDoc(), new Rect(55.0, 299.0, 150.0, 301.0));
    $line->SetStartPoint(new Point(55.0, 300.0));
    $line->SetEndPoint(new Point(155.0, 300.0));
    $line->SetStartStyle(LineAnnot::e_Circle);
    $line->SetEndStyle(LineAnnot::e_Circle);
    $line->SetContents("Caption that's longer than its line.");
    $line->SetColor(new ColorPt(1.0, 0.0, 1.0), 3);
    $line->SetInteriorColor(new ColorPt(0.0, 1.0, 0.0), 3);
    $line->SetShowCaption(true);
    $line->SetCaptionPosition(LineAnnot::e_Top);
    $line->RefreshAppearance();
    $page->AnnotPushBack($line);
    $line = LineAnnot::Create($doc->GetSDFDoc(), new Rect(300.0, 200.0, 390.0, 234.0));
    $line->SetStartPoint(new Point(310.0, 210.0));
    $line->SetEndPoint(new Point(380.0, 220.0));
    $line->SetColor(new ColorPt(0.0, 0.0, 0.0), 3);
    $line->RefreshAppearance();
    $page->AnnotPushBack($line);
    $page3 = $doc->PageCreate(new Rect(0.0, 0.0, 600.0, 600.0));
    $ew->Begin($page3);
    // begin writing to the page
    $ew->End();
    // save changes to the current page
    $doc->PagePushBack($page3);
    $circle = Circle::Create($doc->GetSDFDoc(), new Rect(300.0, 300.0, 390.0, 350.0));
    $circle->SetColor(new ColorPt(0.0, 0.0, 0.0), 3);
    $circle->RefreshAppearance();
    $page3->AnnotPushBack($circle);
    $circle = Circle::Create($doc->GetSDFDoc(), new Rect(100.0, 100.0, 200.0, 200.0));
    $circle->SetColor(new ColorPt(0.0, 1.0, 0.0), 3);
    $circle->SetInteriorColor(new ColorPt(0.0, 0.0, 1.0), 3);
    $circle->SetBorderStyle(new BorderStyle(BorderStyle::e_dashed, 3.0, 0.0, 0.0, array(2.0, 4.0)));
    $circle->SetPadding(2.0);
    $circle->RefreshAppearance();
    $page3->AnnotPushBack($circle);
    $sq = Square::Create($doc->GetSDFDoc(), new Rect(10.0, 200.0, 80.0, 300.0));
    $sq->SetColor(new ColorPt(0.0, 0.0, 0.0), 3);
    $sq->RefreshAppearance();
    $page3->AnnotPushBack($sq);
    $sq = Square::Create($doc->GetSDFDoc(), new Rect(500.0, 200.0, 580.0, 300.0));
    $sq->SetColor(new ColorPt(1.0, 0.0, 0.0), 3);
    $sq->SetInteriorColor(new ColorPt(0.0, 1.0, 1.0), 3);
    $sq->SetBorderStyle(new BorderStyle(BorderStyle::e_dashed, 6.0, 0.0, 0.0, array(4.0, 2.0)));
    $sq->SetPadding(4.0);
    $sq->RefreshAppearance();
    $page3->AnnotPushBack($sq);
    $poly = Polygon::Create($doc->GetSDFDoc(), new Rect(5.0, 500.0, 125.0, 590.0));
    $poly->SetColor(new ColorPt(1.0, 0.0, 0.0), 3);
    $poly->SetInteriorColor(new ColorPt(1.0, 1.0, 0.0), 3);
    $poly->SetVertex(0, new Point(12.0, 510.0));
    $poly->SetVertex(1, new Point(100.0, 510.0));
    $poly->SetVertex(2, new Point(100.0, 555.0));
    $poly->SetVertex(3, new Point(35.0, 544.0));
    $poly->SetBorderStyle(new BorderStyle(BorderStyle::e_solid, 4.0, 0.0, 0.0));
    $poly->SetPadding(4.0);
    $poly->RefreshAppearance();
    $page3->AnnotPushBack($poly);
    $poly = PolyLine::Create($doc->GetSDFDoc(), new Rect(400.0, 10.0, 500.0, 90.0));
    $poly->SetColor(new ColorPt(1.0, 0.0, 0.0), 3);
    $poly->SetInteriorColor(new ColorPt(0.0, 1.0, 0.0), 3);
    $poly->SetVertex(0, new Point(405.0, 20.0));
    $poly->SetVertex(1, new Point(440.0, 40.0));
    $poly->SetVertex(2, new Point(410.0, 60.0));
    $poly->SetVertex(3, new Point(470.0, 80.0));
    $poly->SetBorderStyle(new BorderStyle(BorderStyle::e_solid, 2.0, 0.0, 0.0));
    $poly->SetPadding(4.0);
    $poly->SetStartStyle(LineAnnot::e_RClosedArrow);
    $poly->SetEndStyle(LineAnnot::e_ClosedArrow);
    $poly->RefreshAppearance();
    $page3->AnnotPushBack($poly);
    $lk = Link::Create($doc->GetSDFDoc(), new Rect(5.0, 5.0, 55.0, 24.0));
    //$lk->SetColor( new ColorPt(0.0,1.0,0.0), 3.0 );
    $lk->RefreshAppearance();
    $page3->AnnotPushBack($lk);
    $page4 = $doc->PageCreate(new Rect(0.0, 0.0, 600.0, 600.0));
    $ew->Begin($page4);
    // begin writing to the page
    $ew->End();
    // save changes to the current page
    $doc->PagePushBack($page4);
    $ew->Begin($page4);
    $font = Font::Create($doc->GetSDFDoc(), Font::e_helvetica);
    $element = $eb->CreateTextBegin($font, 16.0);
    $element->SetPathFill(true);
    $ew->WriteElement($element);
    $element = $eb->CreateTextRun("Some random text on the page", $font, 16.0);
    $element->SetTextMatrix(1.0, 0.0, 0.0, 1.0, 100.0, 500.0);
    $ew->WriteElement($element);
    $ew->WriteElement($eb->CreateTextEnd());
    $ew->End();
    $hl = HighlightAnnot::Create($doc->GetSDFDoc(), new Rect(100.0, 490.0, 150.0, 515.0));
    $hl->SetColor(new ColorPt(0.0, 1.0, 0.0), 3);
    $hl->RefreshAppearance();
    $page4->AnnotPushBack($hl);
    $sq = Squiggly::Create($doc->GetSDFDoc(), new Rect(100.0, 450.0, 250.0, 600.0));
    //$sq->SetColor( new ColorPt(1.0,0.0,0.0), 3 );
    $sq->SetQuadPoint(0, new QuadPoint(new Point(122.0, 455.0), new Point(240.0, 545.0), new Point(230.0, 595.0), new Point(101.0, 500.0)));
    $sq->RefreshAppearance();
    $page4->AnnotPushBack($sq);
    $cr = Caret::Create($doc->GetSDFDoc(), new Rect(100.0, 40.0, 129.0, 69.0));
    $cr->SetColor(new ColorPt(0.0, 0.0, 1.0), 3);
    $cr->SetSymbol("P");
    $cr->RefreshAppearance();
    $page4->AnnotPushBack($cr);
    $page5 = $doc->PageCreate(new Rect(0.0, 0.0, 600.0, 600.0));
    $ew->Begin($page5);
    // begin writing to the page
    $ew->End();
    // save changes to the current page
    $doc->PagePushBack($page5);
    global $input_path;
    $fs = FileSpec::Create($doc->GetSDFDoc(), $input_path . "butterfly.png", false);
    $page6 = $doc->PageCreate(new Rect(0.0, 0.0, 600.0, 600.0));
    $ew->Begin($page6);
    // begin writing to the page
    $ew->End();
    // save changes to the current page
    $doc->PagePushBack($page6);
    for ($ipage = 0; $ipage < 2; ++$ipage) {
        for ($iann = 0; $iann < 100; $iann++) {
            if (!($iann > FileAttachment::e_Tag)) {
                $fa = FileAttachment::Create($doc->GetSDFDoc(), new Rect(50.0 + 50.0 * (double) $iann, 100.0, 70.0 + 50.0 * (double) $iann, 120.0), $fs, $iann);
                if ($ipage) {
                    $fa->SetColor(new ColorPt(1.0, 1.0, 0.0));
                }
                $fa->RefreshAppearance();
                if ($ipage == 0) {
                    $page5->AnnotPushBack($fa);
                } else {
                    $page6->AnnotPushBack($fa);
                }
            }
            if ($iann > Text::e_Note) {
                break;
            }
            $txt = Text::Create($doc->GetSDFDoc(), new Rect(10.0 + (double) $iann * 50.0, 200.0, 30.0 + (double) $iann * 50.0, 220.0));
            $txt->SetIcon($iann);
            $txt->SetContents($txt->GetIconName());
            if ($ipage) {
                $txt->SetColor(new ColorPt(1.0, 1.0, 0.0));
            }
            $txt->RefreshAppearance();
            if ($ipage == 0) {
                $page5->AnnotPushBack($txt);
            } else {
                $page6->AnnotPushBack($txt);
            }
        }
    }
    $txt = Text::Create($doc->GetSDFDoc(), new Rect(10.0, 20.0, 30.0, 40.0));
    $txt->SetIcon("UserIcon");
    $txt->SetContents("User defined icon, unrecognized by appearance generator");
    $txt->SetColor(new ColorPt(0.0, 1.0, 0.0));
    $txt->RefreshAppearance();
    $page6->AnnotPushBack($txt);
    $ink = Ink::Create($doc->GetSDFDoc(), new Rect(100.0, 400.0, 200.0, 550.0));
    $ink->SetColor(new ColorPt(0.0, 0.0, 1.0));
    $ink->SetPoint(1, 3, new Point(220.0, 505.0));
    $ink->SetPoint(1, 0, new Point(100.0, 490.0));
    $ink->SetPoint(0, 1, new Point(120.0, 410.0));
    $ink->SetPoint(0, 0, new Point(100.0, 400.0));
    $ink->SetPoint(1, 2, new Point(180.0, 490.0));
    $ink->SetPoint(1, 1, new Point(140.0, 440.0));
    $ink->SetBorderStyle(new BorderStyle(BorderStyle::e_solid, 3.0, 0.0, 0.0));
    $ink->RefreshAppearance();
    $page6->AnnotPushBack($ink);
    $page7 = $doc->PageCreate(new Rect(0.0, 0.0, 600.0, 600.0));
    $ew->Begin($page7);
    // begin writing to the page
    $ew->End();
    // save changes to the current page
    $doc->PagePushBack($page7);
    $snd = Sound::Create($doc->GetSDFDoc(), new Rect(100.0, 500.0, 120.0, 520.0));
    $snd->SetColor(new ColorPt(1.0, 1.0, 0.0));
    $snd->SetIcon(Sound::e_Speaker);
    $snd->RefreshAppearance();
    $page7->AnnotPushBack($snd);
    $snd = Sound::Create($doc->GetSDFDoc(), new Rect(200.0, 500.0, 220.0, 520.0));
    $snd->SetColor(new ColorPt(1.0, 1.0, 0.0));
    $snd->SetIcon(Sound::e_Mic);
    $snd->RefreshAppearance();
    $page7->AnnotPushBack($snd);
    $page8 = $doc->PageCreate(new Rect(0.0, 0.0, 600.0, 600.0));
    $ew->Begin($page8);
    // begin writing to the page
    $ew->End();
    // save changes to the current page
    $doc->PagePushBack($page8);
    for ($ipage = 0; $ipage < 2; ++$ipage) {
        $px = 5;
        $py = 520;
        for ($istamp = RubberStamp::e_Approved; $istamp <= RubberStamp::e_Draft; $istamp = $istamp + 1) {
            $st = RubberStamp::Create($doc->GetSDFDoc(), new Rect(1.0, 1.0, 100.0, 100.0));
            $st->SetIcon($istamp);
            $st->SetContents($st->GetIconName());
            $st->SetRect(new Rect((double) $px, (double) $py, (double) $px + 100.0, (double) $py + 25.0));
            $py -= 100;
            if ($py < 0) {
                $py = 520;
                $px += 200;
            }
            if ($ipage == 0) {
                //$page7->AnnotPushBack( $st );
            } else {
                $page8->AnnotPushBack($st);
                $st->RefreshAppearance();
            }
        }
    }
    $st = RubberStamp::Create($doc->GetSDFDoc(), new Rect(400.0, 5.0, 550.0, 45.0));
    $st->SetIcon("UserStamp");
    $st->SetContents("User defined stamp");
    $page8->AnnotPushBack($st);
    $st->RefreshAppearance();
}
示例#6
0
<?php

require "php/database.php";
$name = isset($_GET["n"]) ? $_GET["n"] : "none";
$sound = Sound::forName($name);
if ($name === "none") {
    header('Location: index.php');
}
if (is_null($sound->name)) {
    header('Location: index.php?error=1&sound=' . $name);
}
?>
<!DOCTYPE html>
<html lang="es">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>Listen the sounds <?php 
echo $sound->name;
?>
 | By VertexMC.net</title>
		<meta name="description" content="Listen to the sounds of minecraft | By VertexMC.net">
		<meta name="author" content="JessHilario.net">
		<link rel="icon" href="img/favicon.ico">
		<link rel="stylesheet" href="css/mediaelementplayer.css" />
		<link href="css/bootstrap.min.css" rel="stylesheet">
		<link rel="stylesheet" type="text/css" href="css/style.css">
		<!--[if lt IE 9]>
			<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
			<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
示例#7
0
 public function actionAction()
 {
     $array = array();
     $array['type_action'] = $_POST['type_action'];
     $array['data-active'] = $_POST['data-active'];
     $array['event'] = $_POST['event'];
     $cheminPython = APPLICATION_PATH . '/../python/';
     $array['cheminPython'] = $cheminPython;
     switch ($_POST['type_action']) {
         case "startLive":
             if ($_POST['event'] == 'click') {
                 exec('/usr/local/bin/python ' . $cheminPython . 'live.py "True"', $output, $return);
                 $array['output'] = $output;
                 $array['return'] = $return;
             }
             break;
         case "grab":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'remoteControle.py "runbehavior" "grabObject"', $output, $return);
                 $array['output'] = $output;
                 $array['return'] = $return;
             }
             break;
         case "say":
             if ($_POST['event'] == 'click') {
                 $question = new Questionreponse();
                 $reponse = $question->find($_POST['id']);
                 exec('python ' . $cheminPython . 'remoteControle.py "say" "' . $reponse[0]['reponse'] . ' "', $output, $return);
             }
             break;
         case "up":
             if ($_POST['event'] == 'press') {
                 exec('python ' . $cheminPython . 'remoteControle.py "forward"', $output, $return);
             } else {
                 exec('python ' . $cheminPython . 'remoteControle.py "stop"', $output, $return);
             }
             break;
         case "down":
             if ($_POST['event'] == 'press') {
                 exec('python ' . $cheminPython . 'remoteControle.py "backward"', $output, $return);
             } else {
                 exec('python ' . $cheminPython . 'remoteControle.py "stop"', $output, $return);
             }
             break;
         case "right":
             if ($_POST['event'] == 'press') {
                 exec('python ' . $cheminPython . 'remoteControle.py "right"', $output, $return);
             } else {
                 exec('python ' . $cheminPython . 'remoteControle.py "stop"', $output, $return);
             }
             $array['output'] = $output;
             $array['return'] = $return;
             break;
         case "left":
             if ($_POST['event'] == 'press') {
                 exec('python ' . $cheminPython . 'remoteControle.py "left"', $output, $return);
             } else {
                 exec('python ' . $cheminPython . 'remoteControle.py "stop"', $output, $return);
             }
             break;
         case "turn-right":
             if ($_POST['event'] == 'press') {
                 exec('python ' . $cheminPython . 'remoteControle.py "rotateright"', $output, $return);
             } else {
                 exec('python ' . $cheminPython . 'remoteControle.py "stop"', $output, $return);
             }
             break;
         case "turn-left":
             if ($_POST['event'] == 'press') {
                 exec('python ' . $cheminPython . 'remoteControle.py "rotateleft"', $output, $return);
             } else {
                 exec('python ' . $cheminPython . 'remoteControle.py "stop"', $output, $return);
             }
             break;
         case "sitdown":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'remoteControle.py "sit"', $output, $return);
             }
             break;
         case "crouch":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'remoteControle.py "crouch"', $output, $return);
             }
             break;
         case "standup":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'remoteControle.py "stand"', $output, $return);
             }
             break;
         case "lyingback":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'remoteControle.py "lyingback"', $output, $return);
             }
             break;
         case "lyingbelly":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'remoteControle.py "lyingbelly"', $output, $return);
             }
             break;
         case "stop":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'remoteControle.py "stop"', $output, $return);
             }
             break;
         case "sayhello":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'remoteControle.py "direBonjour"', $output, $return);
             }
             break;
         case "scenario":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'remoteControle.py "scenario"', $output, $return);
             }
             break;
         case "dance":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'remoteControle.py "runbehavior" "dance"', $output, $return);
             }
             break;
         case "evolution":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'remoteControle.py "runbehavior" "evolution"', $output, $return);
             }
             break;
         case "aiseeutepego":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'remoteControle.py "runbehavior" "aiseeutepego"', $output, $return);
             }
             break;
         case "thriller":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'remoteControle.py "runbehavior" "thriller"', $output, $return);
             }
             break;
         case "caravanpalace":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'remoteControle.py "runbehavior" "caravanpalace"', $output, $return);
             }
             break;
         case "gangnamstyle":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'remoteControle.py "runbehavior" "gangnamstyle"', $output, $return);
             }
             break;
         case "vangelis":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'remoteControle.py "runbehavior" "vangelis"', $output, $return);
             }
             break;
         case "haka":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'remoteControle.py "runbehavior" "Haka"', $output, $return);
             }
             break;
         case "takePicture":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'prendrePhoto.py', $output, $return);
                 $photo = new Photo();
                 $max = $photo->getIdMax();
                 $newphoto = $photo->createRow();
                 $newphoto->idPhoto = $max["MAX(idPhoto)"] + 1;
                 $newphoto->nomPhoto = $output[11] . '.jpeg';
                 $newphoto->save();
             }
             break;
         case "takeVideo":
             if ($_POST['event'] == 'click') {
                 //on fait la video
                 exec('python ' . $cheminPython . '/prendreVideo.py', $output, $return);
                 //on récupère son nom qui est en fait la date et l\'heure
                 $nomVideo = $output[4];
                 //on envoie toutes les sorties dans le JSON pour regarder ce qui se passe au cas ou
                 $array['output'] = $output;
                 $array['return'] = $return;
                 //on execute le cron
                 //exec('wget -o /home/matthieu/nao/cron/cron.convertVideo.log http://nao/cron/convertvideo?nomVideo='.$nomVideo);
                 //on sauvegarde le nom de la video en base
                 $video = new Video();
                 $max = $video->getIdMax();
                 $newvideo = $video->createRow();
                 $newvideo->idVideo = $max["MAX(idVideo)"] + 1;
                 $newvideo->nomVideo = $nomVideo;
                 $newvideo->save();
             }
             break;
         case "setVolume":
             if ($_POST['event'] == 'click') {
                 $sound = new Sound();
                 $sound->updateSound($_POST['value']);
                 $array['value'] = $_POST['value'];
                 exec('python ' . APPLICATION_PATH . '/../python/volume.py "set" "' . $_POST['value'] . '"', $output, $return);
             }
             break;
         case "live":
             if ($_POST['event'] == 'click') {
                 exec('python ' . APPLICATION_PATH . '/../python/live.py True > /dev/null&', $output, $return);
             }
             break;
         case "passion":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'remoteControle.py "runbehavior" "passion"', $output, $return);
             }
             break;
         case "NaoStory":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'subCallLed.py > /dev/null&', $output, $return);
                 exec('python ' . $cheminPython . 'remoteControle.py "runbehavior" "lightEngeneery"', $output1, $return1);
                 $array['output'] = $output;
                 $array['return'] = $return;
                 $array['output1'] = $output1;
                 $array['return1'] = $return1;
             }
             break;
         case "Demo":
             if ($_POST['event'] == 'click') {
                 // Mettre un script local qui appelle le script app.py dans la galileo
                 exec('python ' . $cheminPython . 'subDemo.py', $output, $return);
                 $array['output'] = $output;
                 $array['return'] = $return;
             }
             break;
         case "Rouge":
             if ($_POST['event'] == 'click') {
                 // Mettre un script local qui appelle le script app.py dans la galileo
                 exec('python ' . $cheminPython . 'subCallLed.py', $output, $return);
                 $array['output'] = $output;
                 $array['return'] = $return;
             }
             break;
         case "WriteLetter":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'TellLetter.py', $output, $return);
             }
             break;
         case "WriteNao":
             if ($_POST['event'] == 'click') {
                 exec('python ' . $cheminPython . 'WriteNao.py', $output, $return);
             }
             break;
     }
     echo json_encode($array);
 }
示例#8
0
 public function addSound(Sound $sound, array $players = \null)
 {
     $pk = $sound->encode();
     if ($players === \null) {
         $players = $this->getUsingChunk($sound->x >> 4, $sound->z >> 4);
     }
     if ($pk !== \null) {
         if (!\is_array($pk)) {
             Server::broadcastPacket($players, $pk->setChannel(Network::CHANNEL_WORLD_EVENTS));
         } else {
             $this->server->batchPackets($players, $pk, \false, Network::CHANNEL_WORLD_EVENTS);
         }
     }
 }
示例#9
0
<?php

require 'vendor/autoload.php';
require 'slack.class.php';
require 'sound.class.php';
use Goutte\Client;
$channel = $argv[1];
$outputfile = $argv[2];
if (empty($channel) || empty($outputfile)) {
    die("Usage: slackcast.php [channel] [outputfile]\r\n");
}
if (empty(getenv('SLACK_API')) || empty(getenv('SLACK_USER'))) {
    die("Please set environment variables SLACK_API and SLACK_USER");
}
$sound = new Sound();
$slack = new Slack(array('api_key' => getenv('SLACK_API'), 'slack_user' => getenv('SLACK_USER')));
if ($channel == 'private') {
    die("Feature coming soon.\r\n");
}
$slack->load_channels();
if (empty($slack->channels[$channel])) {
    die("Channel not found.\r\n");
}
$json = $slack->get_channel_history($slack->channels[$channel]['id']);
$json->messages = array_reverse($json->messages);
foreach ($json->messages as $m) {
    $message = $m->text;
    // mute the hubot somewhat
    if ($slack->users[$m->user]['name'] == 'hubot') {
        $items = explode(" ", $message);
        $items = array_slice($items, 0, 10);
<?php

require_once __DIR__ . "/autoload/session.autoload.php";
require_once __DIR__ . "/autoload/checkconnected-admin.autoload.php";
require_once __DIR__ . "/class/User.class.php";
require_once __DIR__ . "/class/Module.class.php";
require_once __DIR__ . "/class/Access.class.php";
require_once __DIR__ . "/class/Sound.class.php";
$User = new User();
$Access = new Access();
$Sound = new Sound();
$modules = Module::getModules();
?>

<!DOCTYPE html>
<html>
<head>
  <?php 
require_once __DIR__ . "/template/headcode.template.php";
?>
<body>

    <?php 
include __DIR__ . "/template/header.template.php";
?>

    <div class="container sub-body">
      <div class="controls text-align-center margin-top-1 big-text">

      	<?php 
if (isset($_GET['event'])) {
示例#11
0
 public function testIfSoundExists()
 {
     $this->assertTrue(Sound::has('mechanical'));
     $this->assertFalse(Sound::has('invalid_sound'));
 }
示例#12
0
<?php

require "database.php";
$download = isset($_GET["d"]) ? $_GET["d"] : "false";
if (!isset($_GET["s"])) {
    echo "E505<br/>";
    header('Location: ../index.php');
} else {
    $sound = Sound::forName($_GET["s"]);
}
if ($download === "false") {
    echo "E101<br/>";
    header('Location: ../index.php');
} else {
    if ($sound != "none") {
        Sound::downUp($sound);
        header('Location: ' . $sound->souce . '?download=1');
    }
}
示例#13
0
<?php

global $routing;
$soundID = (int) $routing->route[1];
if ($soundID) {
    $sound = Sound::find($soundID);
    header('Content-Type:' . $sound->imageMime());
    print $sound->imageData();
}
示例#14
0
function PageContent()
{
    ?>
    
            <div class="layout center-flex">

                <?php 
    $aLabels = array();
    $aLinks = array();
    $aLabels[0] = 'Home';
    $aLinks[0] = 'mainpage.php';
    $aLabels[1] = 'Category List';
    $aLinks[1] = 'category_list.php';
    $aLabels[2] = 'Sound';
    $aLinks[2] = '';
    echo Helpers::CreateBreadCrumbs($aLabels, $aLinks);
    ?>

                <div class="bigbotspace flex-container space-between">
                    <p class="larger auto heading">Sound</p>
                    <!--
                    <a href="category_admin.php" class="button_link"><button class="">Add New Sound</button></a>
                    -->
                </div>
            </div>
    
            <div class="layout">
    
                <table class="tablestyle" id="list_table">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>Overview Text</th>
                            <th>Images</th>
                            <th>Tests</th>
                            <th class="mid">Actions</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php 
    $objSound = new Sound();
    $oSound = $objSound->GetAllSoundByCategoryId($_REQUEST['cat']);
    $objSoundImage = new SoundImage();
    $objSoundTest = new SoundTest();
    foreach ($oSound as $sound) {
        echo '<tr id="img_' . $sound->Id . '">' . PHP_EOL;
        echo '<td>' . $sound->Id . '</td>' . PHP_EOL;
        echo '<td>' . substr($sound->OverviewText, 0, 200) . '</td>' . PHP_EOL;
        echo '<td>(<a href="soundimage_list.php?cat=' . $_REQUEST['cat'] . '&sound=' . $sound->Id . '">' . $objSoundImage->getCountSoundImageBySoundId($sound->Id) . '</a>)</td>' . PHP_EOL;
        echo '<td>(<a href="soundtest_list.php?cat=' . $_REQUEST['cat'] . '&sound=' . $sound->Id . '">' . $objSoundTest->getCountSoundTestBySoundId($sound->Id) . '</a>)</td>' . PHP_EOL;
        echo '<td class="mid"><a href="sound_admin.php?cat=' . $_REQUEST['cat'] . '&id=' . $sound->Id . '"><img src="img/edit-icon.png" /></a></td>' . PHP_EOL;
        echo '</tr>' . PHP_EOL;
    }
    ?>
                    </tbody>
                </table>
    
            </div> <!-- layout -->
    
<?php 
}
示例#15
0
<?php

require "database.php";
if (isset($_GET["s"])) {
    $sound = Sound::forName($_GET["s"]);
    if (isset($_GET["d"])) {
        echo Sound::_downloads($sound);
    }
}
示例#16
0
if ($_POST['commit'] == "Cancel") {
    header("Location:sound_list.php?cat=" . $_REQUEST['cat']);
    exit;
}
if ($_POST['commit'] == "Save Sound") {
    if ($id == 0) {
        // insert
        $obj = new Sound();
        $obj->OverviewText = $_REQUEST["overview_text"];
        $obj->create();
        // redirect to listing list
        header("Location:sound_list.php?cat=" . $_REQUEST['cat']);
        exit;
    } else {
        // update
        $obj = new Sound($_REQUEST["id"]);
        $obj->OverviewText = $_REQUEST["overview_text"];
        $obj->update();
        // redirect to listing list
        header("Location:sound_list.php?cat=" . $_REQUEST['cat']);
        exit;
    }
} else {
    if ($_REQUEST['mode'] == 'e') {
        //listing
        $objSound = new Sound($id);
        $overview_text = $objSound->OverviewText;
    }
}
include "includes/pagetemplate.php";
function PageContent()
示例#17
0
<?php

session_start();
if (!isset($_SESSION['sessCategory'])) {
    header('Location: index.php');
    exit;
}
include_once 'inc/classes/Sound.php';
include_once 'inc/classes/SoundImage.php';
include_once 'inc/classes/SoundTest.php';
include_once 'inc/classes/Technology.php';
include_once 'inc/classes/Category.php';
$objSound = new Sound();
$oSound = $objSound->getAllSoundByCategoryId($_SESSION['sessCategory']);
$objTechnology = new Technology(1);
$objSoundImage = new SoundImage();
$oSoundImage = $objSoundImage->getAllSoundImageBySoundId($oSound[0]->Id);
$objSoundTest = new SoundTest();
$oSoundTest = $objSoundTest->getAllSoundTest($oSound[0]->Id);
$objCategory = new Category($_SESSION['sessCategory']);
$bgcolor = "#F40000";
// Coke red default
if ($objCategory->BackgroundColor != "") {
    $bgcolor = $objCategory->BackgroundColor;
}
$background = $bgcolor . " none repeat scroll 0% 0%";
// this is used in single-product-template.php
?>
<!DOCTYPE html>
<html lang="en">
<head>
示例#18
0
?>
					<form class="search-form center" method="get" action="sound.php">
						<div class="input-group">
							<input id="sound" name="n" type="text" placeholder="Search for..." class="form-control">
						</div>
						<button type="submit" class="btn btn-success">Search</button>
					</form>
				</p>
			</div>
			<div class="sounds panel panel-default">
				<div class="panel-body">
			<?php 
$size = 0;
if (Sound::all() != null) {
    $size = count(Sound::all());
    $all = Sound::all();
    for ($i = $page * 10; $i < $page * 10 + 10; $i++) {
        if (!isset($all[$i])) {
            continue;
        }
        $sound = $all[$i];
        ?>
						<div class="sound-container panel panel-default">
							<div class="sound-title panel-heading">
								<h3 class="panel-title pull-left"><a href="sound.php?n=<?php 
        echo $sound->name;
        ?>
"><?php 
        echo $sound->name;
        ?>
</a></h3>