/dev/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/dev/trunk

« back to all changes in this revision

Viewing changes to setups/katrin/classes/aux/kdbphp.php

  • Committer: Suren A. Chilingaryan
  • Date: 2012-02-07 22:44:15 UTC
  • Revision ID: csa@dside.dyndns.org-20120207224415-sy360wa1ammhd1ph
Use localization subsystem, updated Katrin configs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
// $Id: kdbphp.php 598 2009-02-18 13:49:18Z s_voec01 $
3
 
// Author: Sebastian Voecking <sebastian.voecking@uni-muenster.de>
4
 
 
5
 
if (!extension_loaded("kdbphp")) {
6
 
  if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
7
 
    if (!dl('php_kdbphp.dll')) return;
8
 
  } else {
9
 
    // PHP_SHLIB_SUFFIX is available as of PHP 4.3.0, for older PHP assume 'so'.
10
 
    // It gives 'dylib' on MacOS X which is for libraries, modules are 'so'.
11
 
    if (PHP_SHLIB_SUFFIX === 'PHP_SHLIB_SUFFIX' || PHP_SHLIB_SUFFIX === 'dylib') {
12
 
      if (!dl('kdbphp.so')) return;
13
 
    } else {
14
 
      if (!dl('kdbphp.'.PHP_SHLIB_SUFFIX)) return;
15
 
    }
16
 
  }
17
 
}
18
 
 
19
 
function vectori_to_array($v)
20
 
{
21
 
    $a = array();
22
 
 
23
 
    if (is_resource($v)) {
24
 
        for ($i = 0; $i < vectori_size($v); $i++) {
25
 
            $a[] = vectori_get($v, $i);
26
 
        }
27
 
    }
28
 
 
29
 
    return $a;
30
 
}
31
 
 
32
 
function vectori_from_array(array $a)
33
 
{
34
 
    $size = count($a);
35
 
    $r = new_vectori($size);
36
 
    for ($i = 0; $i < $size; $i++) {
37
 
        vectori_set($r, $i, $a[$i]);
38
 
    }
39
 
 
40
 
    return $r;
41
 
}
42
 
 
43
 
class KDBPhp
44
 
{
45
 
    public $_cPtr = 0;
46
 
 
47
 
    function __construct()
48
 
    {
49
 
        $this->_cPtr = new_KDBPhp();
50
 
    }
51
 
 
52
 
    function GetRun($number)
53
 
    {
54
 
        $xml = KDBPhp_GetRun($this->_cPtr, $number);
55
 
        $this->PrintXml($xml);
56
 
    }
57
 
 
58
 
    function ListRuns()
59
 
    {
60
 
        $xml = KDBPhp_ListRuns($this->_cPtr);
61
 
        $this->PrintXml($xml);
62
 
    }
63
 
 
64
 
    function HaveData($from, $to)
65
 
    {
66
 
        return KDBPhp_HaveData($this->_cPtr, $from, $to);
67
 
    }
68
 
 
69
 
    function PrintXml($xml)
70
 
    {
71
 
        header("Content-type: text/xml");
72
 
        header("Cache-Control: no-cache, must-revalidate");
73
 
        header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
74
 
 
75
 
        print $xml;
76
 
    }
77
 
 
78
 
    function PrintError($error)
79
 
    {
80
 
        $xml = "<?xml version=\"1.0\"?>\n<result>\n";
81
 
        $xml .= " <Error>$error</Error>\n</result>";
82
 
 
83
 
        $this->PrintXml($xml);
84
 
    }
85
 
}
86
 
 
87
 
?>
 
 
b'\\ No newline at end of file'