コード例 #1
0
ファイル: ajaxcore.php プロジェクト: lonelywoolf/hypervm
function __ajax_desc_update()
{
    global $gbl, $sgbl, $login, $ghtml;
    $caction = $ghtml->frm_action;
    $cgi_action = "__ac_desc_{$ghtml->frm_action}";
    try {
        $var = $cgi_action($gbl->__c_object);
        $gbl->unsetSessionV('__tmp_redirect_var');
        $login->was();
        $v = ob_get_clean();
        $ret = array('message' => $v, 'returnvalue' => 'success', 'refresh' => $gbl->__ajax_refresh);
    } catch (exception $e) {
        log_ajax("Caught Execption {$e->getMessage()}");
        $gbl->setSessionV('__tmp_redirect_var', $ghtml->__http_vars);
        $gbl->c_session->write();
        $v = ob_get_clean();
        if (is_array($e->variable)) {
            $evlist = implode(",", $e->variable);
        } else {
            $evlist = $e->variable;
        }
        $post = $ghtml->getCurrentInheritVar();
        if (strtolower($post['frm_action']) === 'update') {
            $post['frm_action'] = 'updateform';
        } else {
            $post['frm_action'] = 'addform';
        }
        if ($ghtml->frm_dttype) {
            $post['frm_dttype'] = $ghtml->frm_dttype;
        }
        if ($ghtml->frm_subaction) {
            $post['frm_subaction'] = $ghtml->frm_subaction;
        }
        $url = $ghtml->get_get_from_post(null, $post);
        $ret = array('returnvalue' => 'failure', 'refresh' => false, 'url' => "{$url}&frm_ev_list={$evlist}&frm_emessage={$e->getMessage()}&frm_m_emessage_data={$e->value}");
    }
    return $ret;
}
コード例 #2
0
ファイル: get-nodes.php プロジェクト: lonelywoolf/hypervm
<?php

// from php manual page
chdir("/usr/local/lxlabs/kloxo/httpdocs/");
include_once "htmllib/lib/include.php";
log_ajax($_REQUEST);
$dir = isset($_REQUEST['lib']) && $_REQUEST['lib'] == 'yui' ? '../../../' : '../../';
$node = isset($_REQUEST['node']) ? $_REQUEST['node'] : "";
if (strpos($node, '..') !== false) {
    die('Nice try buddy.');
}
$nodes = array();
$d = dir($dir . $node);
while ($f = $d->read()) {
    if ($f == '.' || $f == '..' || substr($f, 0, 1) == '.') {
        continue;
    }
    $lastmod = date('M j, Y, g:i a', filemtime($dir . $node . '/' . $f));
    if (is_dir($dir . $node . '/' . $f)) {
        $qtip = 'Type: Folder<br />Last Modified: ' . $lastmod;
        $nodes[] = array('text' => $f, 'id' => $node . '/' . $f, 'cls' => 'folder');
    } else {
        $size = "100";
        $qtip = 'Type: JavaScript File<br />Last Modified: ' . $lastmod . '<br />Size: ' . $size;
        $nodes[] = array('text' => $f, 'id' => $node . '/' . $f, 'leaf' => true, 'cls' => 'file');
    }
}
$d->close();
echo json_encode($nodes);