1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15:
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17:
18: function isWindows()
19: {
20: if (strtolower(substr(PHP_OS, 0, 3)) == "win") {
21: return true;
22: } else {
23: return false;
24: }
25: }
26:
27: function getServerUID()
28: {
29: if (function_exists("posix_getuid")) {
30: return posix_getuid();
31: }
32:
33: $sFilename = md5(mt_rand()) . ".txt";
34:
35: if (is_writeable(".")) {
36: cFileHandler::create($sFilename, "test");
37: $iUserId = fileowner($sFilename);
38: cFileHandler::remove($sFilename);
39:
40: return ($iUserId);
41: } else {
42: if (is_writeable("/tmp/")) {
43: cFileHandler::create("/tmp/".$sFilename, "w");
44: $iUserId = fileowner("/tmp/".$sFilename);
45: cFileHandler::remove("/tmp/".$sFilename);
46:
47: return ($iUserId);
48: }
49: return false;
50: }
51: }
52:
53: function getServerGID() {
54: if (function_exists("posix_getgid")) {
55: return posix_getgid();
56: }
57:
58: $sFilename = md5(mt_rand()) . ".txt";
59:
60: if (is_writeable(".")) {
61: cFileHandler::create($sFilename, "test");
62: $iUserId = filegroup($sFilename);
63: cFileHandler::remove($sFilename);
64:
65: return ($iUserId);
66: } else {
67: return false;
68: }
69: }
70:
71: function getUsernameByUID($iUid)
72: {
73: if (function_exists("posix_getpwuid")) {
74: $aInfo = posix_getpwuid($iUid);
75: return ($aInfo["name"]);
76: } else {
77: return false;
78: }
79: }
80:
81: function getGroupnameByGID($iGid)
82: {
83: if (function_exists("posix_getgrgid")) {
84: $aInfo = posix_getgrgid($iGid);
85: return ($aInfo["name"]);
86: } else {
87: return false;
88: }
89: }
90:
91: ?>