Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • 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:  * @author     Unknown
 8:  * @copyright  four for business AG <www.4fb.de>
 9:  * @license    http://www.contenido.org/license/LIZENZ.txt
10:  * @link       http://www.4fb.de
11:  * @link       http://www.contenido.org
12:  */
13: 
14: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
15: 
16: function isWindows()
17: {
18:     if (strtolower(substr(PHP_OS, 0, 3)) == "win") {
19:         return true;
20:     } else {
21:         return false;
22:     }
23: }
24: 
25: function getServerUID()
26: {
27:     if (function_exists("posix_getuid")) {
28:         return posix_getuid();
29:     }
30: 
31:     $sFilename = md5(mt_rand()) . ".txt";
32: 
33:     if (is_writeable(".")) {
34:         cFileHandler::create($sFilename, "test");
35:         $iUserId = fileowner($sFilename);
36:         cFileHandler::remove($sFilename);
37: 
38:         return ($iUserId);
39:     } else {
40:         if (is_writeable("/tmp/")) {
41:             cFileHandler::create("/tmp/".$sFilename, "w");
42:             $iUserId = fileowner("/tmp/".$sFilename);
43:             cFileHandler::remove("/tmp/".$sFilename);
44: 
45:             return ($iUserId);
46:         }
47:         return false;
48:     }
49: }
50: 
51: function getServerGID() {
52:     if (function_exists("posix_getgid")) {
53:         return posix_getgid();
54:     }
55: 
56:     $sFilename = md5(mt_rand()) . ".txt";
57: 
58:     if (is_writeable(".")) {
59:         cFileHandler::create($sFilename, "test");
60:         $iUserId = filegroup($sFilename);
61:         cFileHandler::remove($sFilename);
62: 
63:         return ($iUserId);
64:     } else {
65:         return false;
66:     }
67: }
68: 
69: function getUsernameByUID($iUid)
70: {
71:     if (function_exists("posix_getpwuid")) {
72:         $aInfo = posix_getpwuid($iUid);
73:         return ($aInfo["name"]);
74:     } else {
75:         return false;
76:     }
77: }
78: 
79: function getGroupnameByGID($iGid)
80: {
81:     if (function_exists("posix_getgrgid")) {
82:         $aInfo = posix_getgrgid($iGid);
83:         return ($aInfo["name"]);
84:     } else {
85:         return false;
86:     }
87: }
88: 
89: ?>
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0