Exemplo n.º 1
0
<?php

header('Access-Control-Allow-Origin: *');
switch ($_REQUEST['action']) {
    case 'get_lists':
        echo json_encode(get_list($_REQUEST['guid']));
        break;
    case 'save_lists':
        if ($_POST['guid'] != '') {
            save_list($_POST);
            echo json_encode('Saved!');
        }
        break;
    case 'update_web':
        if ($_POST['guid'] != '') {
            echo json_encode(update_web($_POST));
            //echo json_encode('Web updated!');
        }
        break;
    case 'get_playing':
        echo json_encode(get_playing());
        break;
    default:
        echo json_encode('Not supported!');
        break;
}
function save_list($data)
{
    include "config.php";
    $connection = mysql_connect($servername, $dbusername, $dbpassword);
    mysql_select_db($dbname, $connection) or die(mysql_error());
Exemplo n.º 2
0
 ******************/
list($directory, $sources) = parse_list();
if (isset(${"_" . _STYPE}['action'])) {
    // Handle post-action
    if (${"_" . _STYPE}['bsubmit'] == "Run") {
        switch (${"_" . _STYPE}['action']) {
            case 0:
                // Save changes
                foreach (${"_" . _STYPE}['branch'] as $key => $branch) {
                    $url = ${"_" . _STYPE}['url'][$key];
                    if ($url != '' && $branch != '') {
                        $source[] = array($branch, $url);
                    }
                }
                // Save the changes to file
                save_list(${"_" . _STYPE}['dir'], $source, ${"_" . _STYPE}['id']);
                // Then reload the file to propogate the changes
                list($directory, $sources) = parse_list();
                break;
            case 1:
                // Pull from sources
                //$rslt = git_pull_all($directory,$sources);
                $id = ${"_" . _STYPE}['id'];
                $rslt = git_pull($directory[$id], $sources[$id]);
                break;
            case 2:
                // Init new repo
                break;
            case 3:
                // Delete this repo
                break;