Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationMain
    • NavigationTop
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Functions

  • getGroupnameByGID
  • getServerGID
  • getServerUID
  • getUsernameByUID
  • isWindows
  • Overview
  • Package
  • Function
  • Tree
  • Deprecated
  • Todo
 1: <?php
 2: /**
 3:  * This file contains various helper functions to read specific values needed for setup checks.
 4:  *
 5:  * @package    Setup
 6:  * @subpackage Helper_Environment
 7:  * @version    SVN Revision $Rev:$
 8:  *
 9:  * @author     Unknown
10:  * @copyright  four for business AG <www.4fb.de>
11:  * @license    http://www.contenido.org/license/LIZENZ.txt
12:  * @link       http://www.4fb.de
13:  * @link       http://www.contenido.org
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: ?>
CMS CONTENIDO 4.9.0 API documentation generated by ApiGen 2.8.0