コード例 #1
0
ファイル: core_actions.php プロジェクト: jasanders/os-aios
function core_actions($act, $log)
{
    global $mos;
    if ($act == 'getrep') {
        doCommand("{$mos}/bin/pm updatelist", $log);
    }
    if ($act == 'update_all') {
        doCommand("{$mos}/bin/pm updatelist", $log);
        $updates = getUpdates();
        foreach ($updates as $mod => $item) {
            doAction($mod, 'update', $log);
        }
    } else {
        if (isset($_REQUEST['mod'])) {
            doAction($_REQUEST['mod'], $act, $log);
        }
    }
}
コード例 #2
0
ファイル: api.php プロジェクト: helloworldprojects/Autism
        $type = $_GET['query'];
        switch ($type) {
            case 'online':
                $out = online();
                break;
            case 'online_doctors':
                $out = online_users(session::USER_DOCTOR);
                break;
            case 'online_users':
                $out = online_users(session::USER_REGULAR);
                break;
            case 'getHistory':
                $out = getHistory();
                break;
            case 'getUpdates':
                $out = getUpdates();
                break;
            default:
                setStatus($out, 'fail', 'invalid type.');
                break;
        }
    } else {
        setStatus($out, 'fail', 'query not set.');
    }
}
header('Content-type: text/plain');
echo json_encode($out, JSON_PRETTY_PRINT);
function setStatus($out, $msg, $error = NULL)
{
    $out['status'] = $msg;
    if (!is_null($error)) {
コード例 #3
0
//hookremove per rimuovere il link di webhook
//getupdates per eseguzione a polling (con cron o manualmente)
//e non si imposta il primo paramentro da shell si assume di avere impostato il webhook e di utilizzare quello
include 'settings_t.php';
include 'getUpdates.php';
//istanzia oggetto Telegram
$bot_id = TELEGRAM_BOT;
$bot = new Telegram($bot_id);
//valuta se l'interfaccia è di tipo CLI per vedere il parametro e settare o rimuovere il webhook e poi esce (se lanciato da riga di comando)
if (php_sapi_name() == 'cli') {
    if ($argv[1] == 'sethook') {
        //setta il webhook
        $bot->setWebhook(BOT_WEBHOOK);
    } else {
        if ($argv[1] == 'removehook') {
            //rimuove il webhook
            $bot->removeWebhook();
        } else {
            if ($argv[1] == 'getupdates') {
                //esegue il getupdates manuale
                getUpdates($bot);
            }
        }
    }
    exit;
}
//legge
$bot->init();
$update = $bot->getData();
$update_manager = new mainloop();
$update_manager->start($bot, $update);
コード例 #4
0
ファイル: _header.php プロジェクト: devbeta/WebFundamentals
<html>
	<head>
		<title>Updates Admin</title>
		<link rel="stylesheet" href="style.css">
		<meta charset="UTF-8">
	</head>
	<body>

	<?php 
require_once 'lib/goutte.phar';
include 'lib/functions.php';
$updates = getUpdates();
$total_count = count($updates);
$unpublished_count = 0;
function cmp($b, $a)
{
    if ($a['page']->fetch('date') == $b['page']->fetch('date')) {
        return 0;
    }
    return $a['page']->fetch('date') < $b['page']->fetch('date') ? -1 : 1;
}
usort($updates, "cmp");
foreach ($updates as $key => $update) {
    $published = $update['page']->fetch('published') == "true";
    if (!$published) {
        $unpublished_count++;
    }
}
?>

	<header>
コード例 #5
0
ファイル: mod_update_all.php プロジェクト: jasanders/os-aios
function update_all_body()
{
    ?>
<script type="text/javascript">
<?php 
    $act = $_REQUEST['act'];
    $ret = $_REQUEST['ret'];
    $url = '/';
    if (isset($ret)) {
        $url = '?page=' . $ret;
    }
    if ($act == 'prepare') {
        $updates = getUpdates();
        if (count($updates) == 0) {
            ?>
	alert("<?php 
            echo getMsg('coreUpdNothing');
            ?>
");
	window.location.href='<?php 
            echo $url;
            ?>
';
<?php 
        } else {
            $msg = getMsg('coreUpdMods') . '\\n\\n';
            foreach ($updates as $mod => $item) {
                $msg .= "'" . $item['title'] . "' rev " . $item['revision'] . ' -> rev ' . $item['_arev'] . '\\n';
            }
            $urlYes = '?page=update_all&act=update';
            if (isset($ret)) {
                $urlYes .= '&ret=' . $ret;
            }
            ?>
	isConfirmed = confirm("<?php 
            echo $msg;
            ?>
");
	if(isConfirmed)
	{
		window.location.href = '<?php 
            echo $urlYes;
            ?>
';
	}
	else
	{
		window.location.href='<?php 
            echo $url;
            ?>
';
	}
<?php 
        }
    } else {
        ?>
	window.location.href = '<?php 
        echo $url;
        ?>
'; 
<?php 
    }
    ?>
</script>
<?php 
}