Example #1
0
 public static function handler($signal)
 {
     System_Daemon::info('Reveived signal %s', $signal);
     if ($signal === SIGUSR1 && ($pid = self::getCurrentPid())) {
         if (file_exists(sprintf(__DIR__ . '/../../' . 'data/tmp/%s%s.%s', System_Daemon::opt('appName'), $pid, 'reload'))) {
             System_Daemon::notice('Control command received, attempting to reload playlist');
             self::killScreen(true);
             PlaylistService::init();
         }
         if (file_exists(sprintf(__DIR__ . '/../../' . 'data/tmp/%s%s.%s', System_Daemon::opt('appName'), $pid, 'shutdown'))) {
             System_Daemon::notice('Control command received, shutting down');
             self::killScreen(true);
             self::clearTemp();
             System_Daemon::stop();
         }
         self::clearTemp();
     }
 }
Example #2
0
File: app.php Project: rlanyi/kiosk
$app->register(new SessionServiceProvider());
$app->register(new TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
/**  Config */
$app['config'] = array('web_dir' => '');
$app['locale'] = 'hu';
/** Controller */
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
$app->get('/', function () use($app) {
    return $app->redirect('/playlist');
});
$app->match('/playlist', function (Request $request) use($app) {
    $app->register(new FormServiceProvider());
    $app->register(new TranslationServiceProvider());
    $app->register(new ValidatorServiceProvider(), array('translator.messages' => array()));
    PlaylistService::init();
    $pldata = array();
    foreach (PlaylistService::getData() as $pld) {
        $pldata[$pld['id']] = $pld['name'];
    }
    $form = $app['form.factory']->createBuilder('form')->add('playlist', 'choice', array('choices' => $pldata, 'expanded' => true, 'constraints' => $request->request->get('stop') ? array() : array(new Assert\Choice(array_keys($pldata)), new Assert\NotNull())))->add('security', 'password', array('constraints' => array(new Security()), 'attr' => array('placeholder' => 'Biztonsági kód'), 'label' => 'Biztonsági kód'))->getForm();
    if ('POST' == $request->getMethod()) {
        $form->bind($request);
        if ($form->isValid()) {
            $data = $form->getData();
            $saved = false;
            if ($request->request->get('stop')) {
                PlaylistService::disablePlaylist(true);
                $saved = PlaylistService::savePlaylist();
            }
            if ($request->request->get('play')) {