#!/usr/bin/php <?php /******************************************************************/ /***KIT SYNC SCRIPT - TO BE RUN FROM CLI AND FROM APP ROOT PATH!***/ /******************************************************************/ require_once "config.php"; require_once "api/classes/kit.inc.php"; $kitAPI = new Kit(); $downloadDir = "download/kits/"; $kitArr = $kitAPI->getKits(); foreach ($kitArr as $key => $val) { $kitId = $val['id']; $kitChannels = $kitAPI->getKitChannels($kitId, 'ogg'); mkdir($downloadDir . $kitId); $channelArr = array(); foreach ($kitChannels as $key => $val) { $fileName = $downloadDir . $kitId . '/' . $val['channel'] . '.ogg'; $fp = fopen($fileName, 'wb'); fwrite($fp, base64_decode($val['src'])); fclose($fp); $channel = exec("soxi -c " . $fileName); array_push($channelArr, $channel); } $maxChannels = max($channelArr); if ($maxChannels > 1) { foreach ($channelArr as $key => $val) { if ($val == 1) { $fileName = $downloadDir . $kitId . '/' . $key . ".ogg"; exec("sox " . $fileName . " " . $fileName . " remix 1 1"); } }
<?php session_start(); require_once "config.php"; require_once "api/classes/kit.inc.php"; require_once "api/classes/pattern.inc.php"; $kit = new Kit(); $kitArr = $kit->getKits(); $pattern = new Pattern(); if (isset($_SESSION['user_id'])) { $patternArr = $pattern->get("all"); } else { $patternArr = $pattern->get("system"); } $sharePattern = ""; if ($_GET) { require_once "api/classes/pattern.inc.php"; $sharePattern = new Pattern(); if ($_GET['p']) { $p = $_GET['p']; } $sharePattern = $sharePattern->getSharedPattern($p); } ?> <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta name="description" content="<?php echo APP_NAME; ?>
if (isset($_REQUEST['cmd'])) { $cmd = $_REQUEST['cmd']; } if (isset($_REQUEST['id'])) { $id = $_REQUEST['id']; } if (isset($_REQUEST['format'])) { $format = $_REQUEST['format']; } if (!isset($cmd)) { echo "No command specified."; return; } switch ($cmd) { case "getKits": $kits = $kit->getKits(); echo json_encode($kits); break; case "getKitChannels": if (isset($id) && isset($format)) { $channels = $kit->getKitChannels($id, $format); echo json_encode($channels); } else { echo "Missing Required Parameters"; return; } break; default: echo "That command is not implemented."; return; }
require_once APP_PATH . "/api/classes/kit.inc.php"; if (!isset($_SESSION['user_id']) || $_SESSION['email'] != SYSTEM_ADMIN_EMAIL) { header('Location: ../login.php'); } $kitAPI = new Kit(); $template = new MainTemplate(); if ($_POST) { $action = $_POST['action']; if ($action == 'newKit') { $newKitName = $_POST['newKitName']; $newKitStatus = $kitAPI->newKit($newKitName); $newKitSuccess = $newKitStatus['success'] ? 'success' : 'error'; } else { if ($action == 'syncKits') { $downloadDir = "../../download/kits/"; $kitArr = $kitAPI->getKits(); foreach ($kitArr as $key => $val) { $kitId = $val['id']; $kitChannels = $kitAPI->getKitChannels($kitId, 'ogg'); mkdir($downloadDir . $kitId); $channelArr = array(); foreach ($kitChannels as $key => $val) { $fileName = $downloadDir . $kitId . '/' . $val['channel'] . '.ogg'; $fp = fopen($fileName, 'wb'); fwrite($fp, base64_decode($val['src'])); fclose($fp); $channel = exec("soxi -c " . $fileName); array_push($channelArr, $channel); } $maxChannels = max($channelArr); if ($maxChannels > 1) {