Subversion Repositories oidplus

Rev

Rev 806 | Rev 812 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 806 Rev 811
Line 34... Line 34...
34
 
34
 
35
        protected static $html = true;
35
        protected static $html = true;
36
 
36
 
37
        /*public*/ const DEFAULT_LANGUAGE = 'enus'; // the language of the source code
37
        /*public*/ const DEFAULT_LANGUAGE = 'enus'; // the language of the source code
38
 
38
 
39
        /*public*/ const PATH_RELATIVE = 1;
39
        /*public*/ const PATH_RELATIVE = 1;           // e.g. "../"
40
        /*public*/ const PATH_ABSOLUTE = 2;
40
        /*public*/ const PATH_ABSOLUTE = 2;           // e.g. "http://www.example.com/oidplus/"
-
 
41
        /*public*/ const PATH_ABSOLUTE_CANONICAL = 3; // e.g. "http://www.example.org/oidplus/" (if baseconfig CANONICAL_SYSTEM_URL is set)
41
        /*public*/ const PATH_ABSOLUTE_CANONICAL = 3;
42
        /*public*/ const PATH_RELATIVE_TO_ROOT = 4;   // e.g. "/oidplus/"
42
 
43
 
43
        // These plugin types can contain HTML code and therefore may
44
        // These plugin types can contain HTML code and therefore may
44
        // emit (non-setup) CSS/JS code via their manifest.
45
        // emit (non-setup) CSS/JS code via their manifest.
45
        /*public*/ const INTERACTIVE_PLUGIN_TYPES = array(
46
        /*public*/ const INTERACTIVE_PLUGIN_TYPES = array(
46
                'publicPages',
47
                'publicPages',
Line 110... Line 111...
110
                        } else {
111
                        } else {
111
                                if (!is_dir(OIDplus::localpath().'setup')) {
112
                                if (!is_dir(OIDplus::localpath().'setup')) {
112
                                        throw new OIDplusConfigInitializationException(_L('File %1 is missing, but setup can\'t be started because its directory missing.','userdata/baseconfig/config.inc.php'));
113
                                        throw new OIDplusConfigInitializationException(_L('File %1 is missing, but setup can\'t be started because its directory missing.','userdata/baseconfig/config.inc.php'));
113
                                } else {
114
                                } else {
114
                                        if (self::$html) {
115
                                        if (self::$html) {
115
                                                if (strpos($_SERVER['REQUEST_URI'], OIDplus::webpath(null,OIDplus::PATH_RELATIVE).'setup/') !== 0) {
116
                                                if (strpos($_SERVER['REQUEST_URI'], OIDplus::webpath(null,OIDplus::PATH_RELATIVE_TO_ROOT).'setup/') !== 0) {
116
                                                        header('Location:'.OIDplus::webpath(null,OIDplus::PATH_RELATIVE).'setup/');
117
                                                        header('Location:'.OIDplus::webpath(null,OIDplus::PATH_RELATIVE).'setup/');
117
                                                        die(_L('Redirecting to setup...'));
118
                                                        die(_L('Redirecting to setup...'));
118
                                                } else {
119
                                                } else {
119
                                                        return self::$baseConfig;
120
                                                        return self::$baseConfig;
120
                                                }
121
                                                }
Line 1389... Line 1390...
1389
         *                          results in an absolute URL. OIDplus::PATH_ABSOLUTE_CANONICAL is an absolute URL,
1390
         *                          results in an absolute URL. OIDplus::PATH_ABSOLUTE_CANONICAL is an absolute URL,
1390
         *                          but a canonical path (set by base config setting CANONICAL_SYSTEM_URL) is preferred.
1391
         *                          but a canonical path (set by base config setting CANONICAL_SYSTEM_URL) is preferred.
1391
         * @return string|false The URL, with guaranteed trailing path delimiter for directories
1392
         * @return string|false The URL, with guaranteed trailing path delimiter for directories
1392
         */
1393
         */
1393
        public static function webpath($target=null, $mode=self::PATH_ABSOLUTE_CANONICAL) {
1394
        public static function webpath($target=null, $mode=self::PATH_ABSOLUTE_CANONICAL) {
1394
 
-
 
1395
                // backwards compatibility
1395
                // backwards compatibility
1396
                if ($mode === true) $mode = self::PATH_RELATIVE;
1396
                if ($mode === true) $mode = self::PATH_RELATIVE;
1397
                if ($mode === false) $mode = self::PATH_ABSOLUTE;
1397
                if ($mode === false) $mode = self::PATH_ABSOLUTE;
1398
 
1398
 
-
 
1399
                if ($mode == OIDplus::PATH_RELATIVE_TO_ROOT) {
-
 
1400
                        return parse_url(OIDplus::webpath($target,OIDplus::PATH_ABSOLUTE))['path'];
-
 
1401
                }
-
 
1402
 
1399
                $res = self::getSystemUrl($mode); // Note: already contains a trailing path delimiter
1403
                $res = self::getSystemUrl($mode); // Note: already contains a trailing path delimiter
1400
                if ($res === false) return false;
1404
                if ($res === false) return false;
1401
 
1405
 
1402
                if (!is_null($target)) {
1406
                if (!is_null($target)) {
1403
                        $basedir = realpath(__DIR__.'/../../');
1407
                        $basedir = realpath(__DIR__.'/../../');