Ejemplo n.º 1
0
function _wddx_encode($data)
{
    global $session;
    $ret = wddx_serialize_vars($session->vars);
    return $ret;
}
Ejemplo n.º 2
0
<?php

$foo = 'bar';
$a['x'] = 'foo';
$a['x'] =& $a;
var_dump(wddx_serialize_vars($a));
// replace $a - the recursion detection seems to be causing $a to be not an array here, maybe its internally a pointer
// replacing $a with a new array() allows this test to still check for 2 things
//  1. recursion detection in &$a;
//  2. recursion detection in adding $a to itself and then serializing $a
// the one thing the test won't check is using $a as an array after doing &$a; which isn't really a wddx problem.
$a = array();
$a['x'] = 'foo';
$a['x'] = $a;
var_dump(wddx_serialize_vars($a));
Ejemplo n.º 3
0
<?php

$data = array('01' => 'Zero', '+1' => 'Plus sign', ' 1' => 'Space');
var_dump(wddx_deserialize(wddx_serialize_vars('data')));
Ejemplo n.º 4
0
function vcldquery()
{
    $query = processInputVar("query", ARG_STRING);
    $arr = explode(',', $query);
    $function = array_shift($arr);
    $args = array();
    foreach ($arr as $item) {
        if (ereg(':', $item)) {
            $item = array_diff(explode(':', $item), array(""));
        }
        array_push($args, $item);
    }
    require_once ".ht-inc/groups.php";
    require_once ".ht-inc/privileges.php";
    require_once ".ht-inc/requests.php";
    require_once ".ht-inc/schedules.php";
    require_once ".ht-inc/statistics.php";
    require_once ".ht-inc/userpreferences.php";
    if (count($args) == 0) {
        $data = $function();
    } elseif (count($args) == 1) {
        $data = $function($args[0]);
    } elseif (count($args) == 2) {
        $data = $function($args[0], $args[1]);
    } elseif (count($args) == 3) {
        $data = $function($args[0], $args[1], $args[2]);
    } elseif (count($args) == 4) {
        $data = $function($args[0], $args[1], $args[2], $args[3]);
    } elseif (count($args) == 5) {
        $data = $function($args[0], $args[1], $args[2], $args[3], $args[4]);
    } elseif (count($args) == 6) {
        $data = $function($args[0], $args[1], $args[2], $args[3], $args[4], $args[5]);
    }
    print wddx_serialize_vars("data");
}
Ejemplo n.º 5
0
<?php

// Our assoc array
$talk = array('id' => 4, 'title' => 'Dynamic Images in PHP - How and When to Use Them', 'date' => '2002-04-29', 'speaker' => 'Alison Gianotto', 'url' => 'http://www.sdphp.net/talks/ag_image');
// we can serialize the value and
// create the packet in one step
$ser1 = wddx_serialize_vars('talk');
echo format_packet($ser1, 'In one step');
// or we could serialize it in several steps
$packet = wddx_packet_start("One of Alison's talks at SDPHP");
wddx_add_vars($packet, 'talk');
$ser2 = wddx_packet_end($packet);
echo format_packet($ser2, 'Making the packet by hand');
// now let's deserialize the packet
$vars = wddx_deserialize($ser2);
echo "<pre>\n<small>\n";
print_r($vars);
echo "</small>\n</pre>\n";
function format_packet($pckt, $title = 'wddx packet')
{
    $re = '/^[^<]/';
    $pckt = str_replace('>', ">\n", $pckt);
    $t = explode("\n", $pckt);
    $s = "[ {$title} ]<br>\n<pre>\n";
    foreach ($t as $line) {
        if (trim($line) == '') {
            continue;
        } elseif (preg_match($re, $line)) {
            $tmp = explode("\n", str_replace('<', "\n<", $line));
            $s .= ' <span style="color: blue;">' . $tmp[0] . "</span>\n" . htmlspecialchars($tmp[1]) . "\n";
        } else {
Ejemplo n.º 6
0
<?php

error_reporting(E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR);
require './roots.php';
require $root_path . 'include/inc_environment_global.php';
$debug = FALSE;
$debug ? $db->debug = TRUE : ($db->debug = FALSE);
$sql = "SELECT *  FROM care_encounter limit 0,100";
$request = $db->Execute($sql);
$res_arr = $request->GetArray();
//header('Content-Type: text/xml');
$myWDDX = wddx_serialize_vars("res_arr");
//echo $myWDDX;
//print_r($res_arr);
$filename = './xml/all_encounter.xml';
if (is_writable($filename)) {
    if (!($handle = fopen($filename, "w"))) {
        print "cannot open {$filename} ";
        exit;
    }
    if (!fwrite($handle, $myWDDX)) {
        print "cannot write tp {$filename} ...";
        exit;
    }
    fclose($handle);
} else {
    print "oopps,  {$filename} is not writable";
}
print "done";