$checked_dirs = 4; } #if(file_perms($_POST['dir_template']) == 777) { $dir_template_chmod = 1; } else { $dir_template_chmod = 0; $checked_dirs = 4;} if (file_perms('../demos') == 777) { $dir_demos_chmod = 1; } else { $dir_demos_chmod = 0; $checked_dirs = 4; } if (file_perms('../include') == 777) { $dir_include_chmod = 1; } else { $dir_include_chmod = 0; $checked_dirs = 4; } if (file_perms('../smarty/templates_c') == 777) { $dir_smarty_chmod = 1; } else { $dir_smarty_chmod = 0; $checked_dirs = 4; } } } } ?> <html> <head> <title>AMXBans - Installation</title>
/** * Copy File * Copy a single file * * @param string $copyFrom Full path to file to copy * @param string $copyTo Full path to new location of file to be copied * @return bool True on pass, false on fail */ public static function copy_file($copyFrom, $copyTo) { $fileFrom = $copyFrom; $fileTo = $copyTo; if (copy($fileFrom, $fileTo)) { if (self::findServerOS() == 'LINUX') { $perms = file_perms($fileTo); if ($perms != '0644') { @chmod($fileTo, 0644); } } return true; } else { return false; } }
function put2file($remote_file, $contents) { $filename = getSystemRoot(RAZOR_ADMIN_FILENAME) . $remote_file; $f = @fopen($filename, "w"); if (!$f) { return false; } else { fwrite($f, $contents); fclose($f); if (findServerOS() == 'LINUX') { $perms = file_perms($filename); if ($perms != '0644') { @chmod($filename, 0644); } } return true; } }
function recycles_privileges($SourcePath, $uid) { $unix = new unix(); $dir = dirname($SourcePath); if (strpos($dir, "RecycleBin\$/{$uid}/") == 0) { return; } $DestPos = strpos($SourcePath, "/.RecycleBin\$"); $finalDestination = substr($SourcePath, 0, $DestPos); $suffix = substr($dir, 0, strpos($dir, "RecycleBin\$/{$uid}/") + strlen("RecycleBin\$/{$uid}/")); $dir = substr($dir, strpos($dir, "RecycleBin\$/{$uid}/") + strlen("RecycleBin\$/{$uid}/"), strlen($dir)); echo $dir . "\n"; echo "suffix:{$suffix}\n"; echo "Destination:{$finalDestination}\n"; $tr = explode("/", $dir); while (list($index, $directory) = each($tr)) { $dirs[] = $directory; $sourcedir = "{$suffix}/" . @implode("/", $dirs); $sourcedir = str_replace('//', "/", $sourcedir); $actualPerms = file_perms($sourcedir, true); $stat = stat($sourcedir); $uid = $stat["uid"]; $gid = $stat["gid"]; if ($GLOBALS["VERBOSE"]) { echo "recycles_privileges():: {$sourcedir} -> {$actualPerms} ({$uid} {$gid})\n"; } $FinalDirectoryDestination = "{$finalDestination}/" . @implode("/", $dirs); $FinalDirectoryDestination = str_replace('//', "/", $FinalDirectoryDestination); if (!is_dir($FinalDirectoryDestination)) { @mkdir($FinalDirectoryDestination, $actualPerms, true); shell_exec("/bin/chmod {$actualPerms} " . $unix->shellEscapeChars($FinalDirectoryDestination)); shell_exec("/bin/chown {$uid}:{$gid} " . $unix->shellEscapeChars($FinalDirectoryDestination)); } } }
function loginLog() { $contents = ''; $logPath = getSystemRoot(RAZOR_ADMIN_FILENAME) . RAZOR_LOGS_DIR . RAZOR_FAILED_LOGIN_LOG; if (!file_exists(getSystemRoot(RAZOR_ADMIN_FILENAME) . RAZOR_LOGS_DIR)) { return false; } // find IP of user and ensure no funny IP injection scripts // $userIP = preg_replace('/[^0-9.]/', '', $_SERVER['REMOTE_ADDR']); if ($userIP == '' || $userIP == NULL) { $userIP = 'Could Not Log IP'; } // read in any old data // if (file_exists($logPath)) { // read file into array // $loginLogArray = array_reverse(file($logPath)); // shorten array list by certain amount // if (count($loginLogArray) > 300) { $loginLogArray = array_slice($loginLogArray, 0, 300); } $shortArray = array_reverse($loginLogArray); $contents = implode('', $shortArray); } // create data to write // $contents .= '##' . $userIP . ':' . time() . '##' . "\r\n"; // write IP to log // $f = @fopen($logPath, "w"); if (!$f) { return false; } else { @fwrite($f, $contents); fclose($f); if (findServerOS() == 'LINUX') { $perms = file_perms($logPath); if ($perms != '0644') { chmod($logPath, 0644); } } return true; } }