Ejemplo n.º 1
0
 public function update_files()
 {
     $pkg = new update_package($this->package);
     foreach ($_POST['files'] as $file) {
         if (file_exists($file)) {
             $pkg->addFile($file);
         }
     }
     throw new redirect(MODUL_SELF . '&edit=' . $pkg->id . '#tabs-2-hash');
 }
Ejemplo n.º 2
0
<?php

function output($method, $data)
{
    $serverid = (int) $_GET['serverid'];
    if (!isset($_GET['plain'])) {
        echo 'update.' . $method . '(' . intval($serverid) . ', ' . json_encode($data) . ");\n";
    } else {
        echo json_encode($data);
    }
}
try {
    if (!empty($_GET['package'])) {
        $data = db()->update_package->get("id = '%s'", $_GET['package'])->assoc();
        $pkg = new update_package($data);
        $current = intval($_GET['current']);
        output('install', $pkg->deliver($_SERVER['REMOTE_ADDR'], $current));
        $col = $current ? 'updates' : 'installations';
        db()->query("UPDATE update_package SET %s = %s + 1 WHERE id = '%s'", $col, $col, $data['id']);
    } else {
        output('remote', array_values(update_package::liste($_SERVER['REMOTE_ADDR'])));
    }
} catch (Exception $e) {
    output('error', array('error' => $e->getMessage()));
}
Ejemplo n.º 3
0
} else {
    $writer = new writer_fs();
}
if (!empty($_GET['edit'])) {
    if (empty($packages[$_GET['edit']])) {
        throw new Exception('Paket nicht gefunden!');
    }
    new update_manager($view, $packages[$_GET['edit']]);
} elseif (isset($_GET['storefile'])) {
    $view->format = 'plain';
    $pkg = new update_package(array('id' => $_POST['pkg']));
    $pkg->updateFile($_POST['path'], $_POST['content']);
    $view->content('ok');
} elseif (isset($_GET['addpackage'])) {
    $view->format = 'plain';
    $pkg = new update_package($_POST);
    $pkg->install($writer);
    $view->content('ok');
} elseif (isset($_GET['getmigrations'])) {
    $all = globFiles('migration/*');
    $applied = db()->select('update_migration')->assocs('id');
    $result = $pending = array();
    foreach ($all as $id) {
        if (empty($applied[$id])) {
            $pending[] = $id;
        }
    }
    $view->plain(json_encode($pending));
} elseif (!empty($_GET['install'])) {
    $view->format = 'plain';
    $migrations = new update_migration();