/**
  * Makes connection with the ICE-Proxy.
  *
  * @global <type> $ICE
  */
 function __construct()
 {
     global $ICE;
     //TODO why does this not work with Joomla???
     Ice_loadProfile();
     $base = $ICE->stringToProxy("Meta:tcp -h 127.0.0.1 -p 6502");
     $this->_ice = $base->ice_checkedCast("::Murmur::Meta");
 }
 public function __construct($name)
 {
     global $ICE;
     Ice_loadProfile($name);
     try {
         $sessionp = $ICE->stringToProxy("session:tcp -h {$this->host} -p {$this->port}:udp -h {$this->host} -p {$this->port} -h {$this->host}");
         $sessionp = $sessionp->ice_twoway();
         $sessionfactory = $sessionp->ice_uncheckedCast("::OPI::SessionFactory");
         $session = $sessionfactory->CreateProxy("php" . time());
         $this->objectfactory = $session->CreateSession();
     } catch (Ice_LocalException $ex) {
         echo "warning impossible to continue: " . $ex->unknown . "\n";
         if ($debug > 3) {
             var_dump($ex);
         }
         exit(0);
     }
 }
 public function __construct($name)
 {
     global $ICE;
     Ice_loadProfile($name);
     try {
         $sessionp = $ICE->stringToProxy("session:tcp -h {$this->host} -p {$this->port}:udp -h {$this->host} -p {$this->port} -h {$this->host}");
         $sessionp = $sessionp->ice_twoway();
         $sessionfactory = $sessionp->ice_uncheckedCast("::OPI::SessionFactory");
         $session = $sessionfactory->CreateProxy("php" . time());
         $session->TimeOut(10);
         $this->objectfactory = $session->CreateSession();
         $this->valid = true;
     } catch (Ice_LocalException $ex) {
         Header("HTTP/1.0 500 Internal Server Error");
         echo "fatal: impossible to continue: " . $ex->unknown . "\n";
         echo "check the ICE server!";
         exit;
     }
 }
 private function initIce33()
 {
     // ice 3.3
     //TODO it would be good to be able to add a check if slice file is loaded
     //if (empty(ini_get('ice.slice'))) {
     //MessageManager::addError(tr('error_noIceSliceLoaded'));
     global $ICE;
     Ice_loadProfile();
     try {
         $conn = $ICE->stringToProxy(SettingsManager::getInstance()->getDbInterface_address());
         $this->meta = $conn->ice_checkedCast("::Murmur::Meta");
         // use IceSecret if set
         if (!empty($this->contextVars)) {
             $this->meta = $this->meta->ice_context($this->contextVars);
         }
         $this->meta = $this->meta->ice_timeout(10000);
     } catch (Ice_ProxyParseException $e) {
         MessageManager::addError(tr('error_invalidIceInterface_address'));
     }
 }
 function __construct()
 {
     // Check that the PHP Ice extension is loaded.
     if (!extension_loaded('ice')) {
         MessageManager::addError(tr('error_noIceExtensionLoaded'));
     } else {
         $this->contextVars = SettingsManager::getInstance()->getDbInterface_iceSecrets();
         if (!function_exists('Ice_intVersion') || Ice_intVersion() < 30400) {
             // ice 3.3
             global $ICE;
             Ice_loadProfile();
             $this->conn = $ICE->stringToProxy(SettingsManager::getInstance()->getDbInterface_address());
             $this->meta = $this->conn->ice_checkedCast("::Murmur::Meta");
             // use IceSecret if set
             if (!empty($this->contextVars)) {
                 $this->meta = $this->meta->ice_context($this->contextVars);
             }
             $this->meta = $this->meta->ice_timeout(10000);
         } else {
             // ice 3.4
             $initData = new Ice_InitializationData();
             $initData->properties = Ice_createProperties();
             $initData->properties->setProperty('Ice.ImplicitContext', 'Shared');
             $ICE = Ice_initialize($initData);
             /*
              * getImplicitContext() is not implemented for icePHP yet…
              * $ICE->getImplicitContext();
              * foreach ($this->contextVars as $key=>$value) {
              * 	 $ICE->getImplicitContext()->put($key, $value);
              * }
              */
             try {
                 $this->meta = Murmur_MetaPrxHelper::checkedCast($ICE->stringToProxy(SettingsManager::getInstance()->getDbInterface_address()));
                 $this->meta = $this->meta->ice_context($this->contextVars);
             } catch (Ice_ConnectionRefusedException $exc) {
                 MessageManager::addError(tr('error_iceConnectionRefused'));
             }
         }
         $this->connect();
     }
 }
Exemple #6
0
if (!extension_loaded('ice')) {
    exit('Error: This example script needs the PHP extension for Ice to be loaded.');
}
if (!function_exists('Ice_intVersion') || Ice_intVersion() < 30400 || !function_exists('Ice_loadProfile')) {
    exit('Error: This example script is compatible only for php-ice versions prior to 3.4.');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>
<body>
<?php 
Ice_loadProfile();
if (isset($_GET['uname']) && $_GET['password'] && $_GET['email'] && $_GET['uname'] != '' && $_GET['password'] != '') {
    try {
        $base = $ICE->stringToProxy("Meta:tcp -h 127.0.0.1 -p 6502");
        $meta = $base->ice_checkedCast("::Murmur::Meta");
        $server = $meta->getServer($serverId);
        if (empty($server)) {
            echo 'Server could not be found.';
        } else {
            $registrationId = $server->registerPlayer($_GET['uname']);
            $registration = $server->getRegistration(intval($registrationId));
            $registration->pw = $_GET['password'];
            $registration->email = $_GET['email'];
            $server->updateregistration($registration);
        }
    } catch (InvalidPlayerException $ex) {
?>

<HTML><HEAD>
<META HTTP-EQUIV="Refresh" CONTENT="5;">
<TITLE>Test</TITLE>
</HEAD>

<BODY>

<H1>Laser2d test PHP script</H1>
A script that connects to a laser2d component at Coca<br>
It should refresh the <B>scan data</B> every 5 secs<br>&nbsp<br>

<?php 
global $ICE;
Ice_loadProfile("LaserMon");
//The following two lines can be used for diagnostic if required
//Ice_dumpProfile();
//phpinfo();
try {
    //Setup the description of the object that we are going to connect to.
    $base = $ICE->stringToProxy($ProxyStr);
    echo "Connect to: ";
    print $ICE->stringToProxy($ProxyStr);
    //Connect to the object, and get some basic data
    $laser = $base->ice_checkedCast("::orca::LaserScanner2d");
    $data = $laser->getDescription();
    $TimeStamp = $data->timeStamp;
    echo "<H2>Description Data</H2>";
    echo "Time object initialised: " . $TimeStamp->seconds . " <br>\n";
    echo "MaxRange(m): " . $data->maxRange . "<br>\n";
<?php

// ICE ODABA Interface Test
// use ./testphp to call from console OR
// invoke on a webserver
// make sure you
//  - installed the ICE php5 extension
//  - created INI and Profile
//  - started the OPIICEServer
Ice_loadProfile("opi");
// Ice_dumpProfile();
try {
    // create the proxy handles
    // this are dumb handles with no technical use
    // you have to call the appropriate Open* functions before you can
    // use them.
    // not nessesary with generated factory
    // create the proxy that provides us with empty
    // instances of odaba objects
    $sp = $ICE->stringToProxy("session:tcp -p 10000:udp -p 10000");
    $sp = $sp->ice_twoway();
    $s = $sp->ice_uncheckedCast("::OPI::SessionFactory");
    $sprx = $s->CreateSessionProxy("php");
    $of = $sprx->CreateSession();
    $odabaclient = $of->GetODABAClient();
    // the dictionary is in short the structure information
    // you need it to know what is where in the database
    // technical it is just a database and can be used like it
    $dictionary = $of->GetDictionaryHandle();
    // the database is the storage for the data
    $database = $of->GetDatabaseHandle();
Exemple #9
0
<HTML>
<HEAD>
<TITLE>Client</TITLE>
</HEAD>
<?php 
Ice_loadProfile("printer");
try {
    $p = $ICE->stringToProxy("SimplePrinter:default -p 10000");
    $printer = $p->ice_checkedCast("::Demo::Printer");
    $printer->printString("hello");
} catch (Ice_LocalException $ex) {
    //process the Exception
    echo "<pre>\n";
    print_r($ex);
    echo "</pre>\n";
}
?>
</HTML>
<?php

// ICE ODABA Interface Test
// use ./testphp to call from console OR
// invoke on a webserver
// make sure you
//  - installed the ICE php5 extension
//  - created INI and Profile
//  - started the ODABAICEServer
Ice_loadProfile("odaba");
try {
    // create the proxy handles
    // this are dumb handles with no technical use
    // you have to call the appropriate Open* functions before you can
    // use them.
    // not nessesary with generated factory
    sleep(rand() % 5);
    $odabaclientp = $ICE->stringToProxy("odabaclient:tcp -p 10000:udp -p 10000");
    $odabaclientp = $odabaclientp->ice_twoway();
    $odabaclient = $odabaclientp->ice_checkedCast("::Odaba::ODABAClient");
    // create the proxy that provides us with empty
    // instances of odaba objects
    $ofp = $ICE->stringToProxy("objectfactory:tcp -p 10000:udp -p 10000");
    $ofp = $ofp->ice_twoway();
    $of = $ofp->ice_uncheckedCast("::Odaba::ODABAObjectFactory");
    //	    $odabaclient = $of->GetODABAClient();
    // the dictionary is in short the structure information
    // you need it to know what is where in the database
    // technical it is just a database and can be used like it
    $dictionary = $of->GetDictionaryHandle();
    // the database is the storage for the data