/adei/trunk

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

« back to all changes in this revision

Viewing changes to classes/common.php

  • Committer: Suren A. Chilingaryan
  • Date: 2009-01-30 23:56:42 UTC
  • Revision ID: csa@dside.dyndns.org-20090130235642-gw9n5v9y7w23dmmd
Further search improvements, support for custom properties (config)

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
 
16
16
abstract class ADEICommon  extends BASICRequest {
 
17
 function GetBaseURL() {
 
18
    global $ADEI_URL;
 
19
    global $ADEI_ROOTDIR;
 
20
 
 
21
    if ($ADEI_URL) {
 
22
        return $ADEI_URL;
 
23
    } else if ($_SERVER['SERVER_NAME']) {
 
24
//      list($url, $query) = preg_split("/\?/", $_SERVER['REQUEST_URI'], 2);
 
25
 
 
26
        $ssl = $_SERVER['HTTPS'];
 
27
        if (($ssl)&&(preg_match("/^(off|false|no)$/i", $ssl))) $ssl = false;
 
28
        
 
29
        if ($ssl) {
 
30
            $url = "https://";
 
31
            $default_port = 443;
 
32
        } else {
 
33
            $url = "http://";
 
34
            $default_port = 80;
 
35
        }
 
36
 
 
37
        $url .= $_SERVER['SERVER_NAME'];
 
38
        
 
39
        $port = $_SERVER['SERVER_PORT'];
 
40
        if (($port)&&($port != $default_port)) {
 
41
            $url .= ":$port";
 
42
        }
 
43
        
 
44
        if ($_SERVER['SCRIPT_NAME']) {
 
45
            if (preg_match("/(.*\/)(services|admin)(\/[^\/]+)?$/", $_SERVER['SCRIPT_NAME'], $m)) {
 
46
                $url .= $m[1];
 
47
            } else if (preg_match("/(.*\/)(\/[^\/]+)?$/", $_SERVER['SCRIPT_NAME'], $m)) {
 
48
                $url .= $m[1];
 
49
            } else {
 
50
                $url .= $_SERVER['SCRIPT_NAME'];
 
51
            }
 
52
        } else {
 
53
            $url .= "/";
 
54
        }
 
55
 
 
56
        return $url;
 
57
    } else {
 
58
        return "http://localhost/" .  basename($ADEI_ROOTDIR) . "/";
 
59
    }
 
60
 }
 
61
 
17
62
 function TransformXML($xslt, $xml) {
18
63
    $xsldoc = new DOMDocument();
19
64
    $xmldoc = new DOMDocument();
23
68
            throw new ADEIException(translate("Failed to load xslt stylesheet \"%s\"", $xslt));
24
69
        }
25
70
        
26
 
        if (!$xmldoc->load($xml)) {
 
71
        if (!@$xmldoc->load($xml)) {
27
72
            throw new ADEIException(translate("Failed to load xml file \"%s\"", $xml));
28
73
        }
29
74
    } else {