Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-conte.../plugins/wp-file-.../lib/php
File: elFinderVolumeFTP.class.php
* | +---------> group
[500] Fix | Delete
* +-----------------> owner
[501] Fix | Delete
* The isowner parameter is computed by the caller.
[502] Fix | Delete
* If the owner parameter in the options is true, the user is the actual owner of all objects even if che user used in the ftp Login
[503] Fix | Delete
* is different from the file owner id.
[504] Fix | Delete
* If the owner parameter is false to understand if the user is the file owner we compare the ftp user with the file owner id.
[505] Fix | Delete
* @param Boolean $isowner . Tell if the current user is the owner of the object.
[506] Fix | Delete
*
[507] Fix | Delete
* @return array
[508] Fix | Delete
* @author Dmitry (dio) Levashov
[509] Fix | Delete
* @author Ugo Vierucci
[510] Fix | Delete
*/
[511] Fix | Delete
protected function parsePermissions($perm, $isowner = true)
[512] Fix | Delete
{
[513] Fix | Delete
$res = array();
[514] Fix | Delete
$parts = array();
[515] Fix | Delete
for ($i = 0, $l = strlen($perm); $i < $l; $i++) {
[516] Fix | Delete
$parts[] = substr($perm, $i, 1);
[517] Fix | Delete
}
[518] Fix | Delete
[519] Fix | Delete
$read = ($isowner && $parts[1] == 'r') || $parts[4] == 'r' || $parts[7] == 'r';
[520] Fix | Delete
[521] Fix | Delete
return array(
[522] Fix | Delete
'read' => $parts[0] == 'd' ? $read && (($isowner && $parts[3] == 'x') || $parts[6] == 'x' || $parts[9] == 'x') : $read,
[523] Fix | Delete
'write' => ($isowner && $parts[2] == 'w') || $parts[5] == 'w' || $parts[8] == 'w'
[524] Fix | Delete
);
[525] Fix | Delete
}
[526] Fix | Delete
[527] Fix | Delete
/**
[528] Fix | Delete
* Cache dir contents
[529] Fix | Delete
*
[530] Fix | Delete
* @param string $path dir path
[531] Fix | Delete
*
[532] Fix | Delete
* @return void
[533] Fix | Delete
* @author Dmitry Levashov
[534] Fix | Delete
**/
[535] Fix | Delete
protected function cacheDir($path)
[536] Fix | Delete
{
[537] Fix | Delete
$this->dirsCache[$path] = array();
[538] Fix | Delete
$hasDir = false;
[539] Fix | Delete
[540] Fix | Delete
$list = array();
[541] Fix | Delete
$encPath = $this->convEncIn($path);
[542] Fix | Delete
foreach ($this->ftpRawList($encPath) as $raw) {
[543] Fix | Delete
if (($stat = $this->parseRaw($raw, $encPath))) {
[544] Fix | Delete
$list[] = $stat;
[545] Fix | Delete
}
[546] Fix | Delete
}
[547] Fix | Delete
$list = $this->convEncOut($list);
[548] Fix | Delete
$prefix = ($path === $this->separator) ? $this->separator : $path . $this->separator;
[549] Fix | Delete
$targets = array();
[550] Fix | Delete
foreach ($list as $stat) {
[551] Fix | Delete
$p = $prefix . $stat['name'];
[552] Fix | Delete
if (isset($stat['target'])) {
[553] Fix | Delete
// stat later
[554] Fix | Delete
$targets[$stat['name']] = $stat['target'];
[555] Fix | Delete
} else {
[556] Fix | Delete
$stat = $this->updateCache($p, $stat);
[557] Fix | Delete
if (empty($stat['hidden'])) {
[558] Fix | Delete
if (!$hasDir && $stat['mime'] === 'directory') {
[559] Fix | Delete
$hasDir = true;
[560] Fix | Delete
}
[561] Fix | Delete
$this->dirsCache[$path][] = $p;
[562] Fix | Delete
}
[563] Fix | Delete
}
[564] Fix | Delete
}
[565] Fix | Delete
// stat link targets
[566] Fix | Delete
foreach ($targets as $name => $target) {
[567] Fix | Delete
$stat = array();
[568] Fix | Delete
$stat['name'] = $name;
[569] Fix | Delete
$p = $prefix . $name;
[570] Fix | Delete
$cacheDirTarget = $this->cacheDirTarget;
[571] Fix | Delete
$this->cacheDirTarget = $this->convEncIn($target, true);
[572] Fix | Delete
if ($tstat = $this->stat($target)) {
[573] Fix | Delete
$stat['size'] = $tstat['size'];
[574] Fix | Delete
$stat['alias'] = $target;
[575] Fix | Delete
$stat['thash'] = $tstat['hash'];
[576] Fix | Delete
$stat['mime'] = $tstat['mime'];
[577] Fix | Delete
$stat['read'] = $tstat['read'];
[578] Fix | Delete
$stat['write'] = $tstat['write'];
[579] Fix | Delete
[580] Fix | Delete
if (isset($tstat['ts'])) {
[581] Fix | Delete
$stat['ts'] = $tstat['ts'];
[582] Fix | Delete
}
[583] Fix | Delete
if (isset($tstat['owner'])) {
[584] Fix | Delete
$stat['owner'] = $tstat['owner'];
[585] Fix | Delete
}
[586] Fix | Delete
if (isset($tstat['group'])) {
[587] Fix | Delete
$stat['group'] = $tstat['group'];
[588] Fix | Delete
}
[589] Fix | Delete
if (isset($tstat['perm'])) {
[590] Fix | Delete
$stat['perm'] = $tstat['perm'];
[591] Fix | Delete
}
[592] Fix | Delete
if (isset($tstat['isowner'])) {
[593] Fix | Delete
$stat['isowner'] = $tstat['isowner'];
[594] Fix | Delete
}
[595] Fix | Delete
} else {
[596] Fix | Delete
[597] Fix | Delete
$stat['mime'] = 'symlink-broken';
[598] Fix | Delete
$stat['read'] = false;
[599] Fix | Delete
$stat['write'] = false;
[600] Fix | Delete
$stat['size'] = 0;
[601] Fix | Delete
[602] Fix | Delete
}
[603] Fix | Delete
$this->cacheDirTarget = $cacheDirTarget;
[604] Fix | Delete
$stat = $this->updateCache($p, $stat);
[605] Fix | Delete
if (empty($stat['hidden'])) {
[606] Fix | Delete
if (!$hasDir && $stat['mime'] === 'directory') {
[607] Fix | Delete
$hasDir = true;
[608] Fix | Delete
}
[609] Fix | Delete
$this->dirsCache[$path][] = $p;
[610] Fix | Delete
}
[611] Fix | Delete
}
[612] Fix | Delete
[613] Fix | Delete
if (isset($this->sessionCache['subdirs'])) {
[614] Fix | Delete
$this->sessionCache['subdirs'][$path] = $hasDir;
[615] Fix | Delete
}
[616] Fix | Delete
}
[617] Fix | Delete
[618] Fix | Delete
/**
[619] Fix | Delete
* Return ftp transfer mode for file
[620] Fix | Delete
*
[621] Fix | Delete
* @param string $path file path
[622] Fix | Delete
*
[623] Fix | Delete
* @return string
[624] Fix | Delete
* @author Dmitry (dio) Levashov
[625] Fix | Delete
**/
[626] Fix | Delete
protected function ftpMode($path)
[627] Fix | Delete
{
[628] Fix | Delete
return strpos($this->mimetype($path), 'text/') === 0 ? FTP_ASCII : FTP_BINARY;
[629] Fix | Delete
}
[630] Fix | Delete
[631] Fix | Delete
/*********************** paths/urls *************************/
[632] Fix | Delete
[633] Fix | Delete
/**
[634] Fix | Delete
* Return parent directory path
[635] Fix | Delete
*
[636] Fix | Delete
* @param string $path file path
[637] Fix | Delete
*
[638] Fix | Delete
* @return string
[639] Fix | Delete
* @author Naoki Sawada
[640] Fix | Delete
**/
[641] Fix | Delete
protected function _dirname($path)
[642] Fix | Delete
{
[643] Fix | Delete
$parts = explode($this->separator, trim($path, $this->separator));
[644] Fix | Delete
array_pop($parts);
[645] Fix | Delete
return $this->separator . join($this->separator, $parts);
[646] Fix | Delete
}
[647] Fix | Delete
[648] Fix | Delete
/**
[649] Fix | Delete
* Return file name
[650] Fix | Delete
*
[651] Fix | Delete
* @param string $path file path
[652] Fix | Delete
*
[653] Fix | Delete
* @return string
[654] Fix | Delete
* @author Naoki Sawada
[655] Fix | Delete
**/
[656] Fix | Delete
protected function _basename($path)
[657] Fix | Delete
{
[658] Fix | Delete
$parts = explode($this->separator, trim($path, $this->separator));
[659] Fix | Delete
return array_pop($parts);
[660] Fix | Delete
}
[661] Fix | Delete
[662] Fix | Delete
/**
[663] Fix | Delete
* Join dir name and file name and retur full path
[664] Fix | Delete
*
[665] Fix | Delete
* @param string $dir
[666] Fix | Delete
* @param string $name
[667] Fix | Delete
*
[668] Fix | Delete
* @return string
[669] Fix | Delete
* @author Dmitry (dio) Levashov
[670] Fix | Delete
**/
[671] Fix | Delete
protected function _joinPath($dir, $name)
[672] Fix | Delete
{
[673] Fix | Delete
return rtrim($dir, $this->separator) . $this->separator . $name;
[674] Fix | Delete
}
[675] Fix | Delete
[676] Fix | Delete
/**
[677] Fix | Delete
* Return normalized path, this works the same as os.path.normpath() in Python
[678] Fix | Delete
*
[679] Fix | Delete
* @param string $path path
[680] Fix | Delete
*
[681] Fix | Delete
* @return string
[682] Fix | Delete
* @author Troex Nevelin
[683] Fix | Delete
**/
[684] Fix | Delete
protected function _normpath($path)
[685] Fix | Delete
{
[686] Fix | Delete
if (empty($path)) {
[687] Fix | Delete
$path = '.';
[688] Fix | Delete
}
[689] Fix | Delete
// path must be start with /
[690] Fix | Delete
$path = preg_replace('|^\.\/?|', $this->separator, $path);
[691] Fix | Delete
$path = preg_replace('/^([^\/])/', "/$1", $path);
[692] Fix | Delete
[693] Fix | Delete
if ($path[0] === $this->separator) {
[694] Fix | Delete
$initial_slashes = true;
[695] Fix | Delete
} else {
[696] Fix | Delete
$initial_slashes = false;
[697] Fix | Delete
}
[698] Fix | Delete
[699] Fix | Delete
if (($initial_slashes)
[700] Fix | Delete
&& (strpos($path, '//') === 0)
[701] Fix | Delete
&& (strpos($path, '///') === false)) {
[702] Fix | Delete
$initial_slashes = 2;
[703] Fix | Delete
}
[704] Fix | Delete
[705] Fix | Delete
$initial_slashes = (int)$initial_slashes;
[706] Fix | Delete
[707] Fix | Delete
$comps = explode($this->separator, $path);
[708] Fix | Delete
$new_comps = array();
[709] Fix | Delete
foreach ($comps as $comp) {
[710] Fix | Delete
if (in_array($comp, array('', '.'))) {
[711] Fix | Delete
continue;
[712] Fix | Delete
}
[713] Fix | Delete
[714] Fix | Delete
if (($comp != '..')
[715] Fix | Delete
|| (!$initial_slashes && !$new_comps)
[716] Fix | Delete
|| ($new_comps && (end($new_comps) == '..'))) {
[717] Fix | Delete
array_push($new_comps, $comp);
[718] Fix | Delete
} elseif ($new_comps) {
[719] Fix | Delete
array_pop($new_comps);
[720] Fix | Delete
}
[721] Fix | Delete
}
[722] Fix | Delete
$comps = $new_comps;
[723] Fix | Delete
$path = implode($this->separator, $comps);
[724] Fix | Delete
if ($initial_slashes) {
[725] Fix | Delete
$path = str_repeat($this->separator, $initial_slashes) . $path;
[726] Fix | Delete
}
[727] Fix | Delete
[728] Fix | Delete
return $path ? $path : '.';
[729] Fix | Delete
}
[730] Fix | Delete
[731] Fix | Delete
/**
[732] Fix | Delete
* Return file path related to root dir
[733] Fix | Delete
*
[734] Fix | Delete
* @param string $path file path
[735] Fix | Delete
*
[736] Fix | Delete
* @return string
[737] Fix | Delete
* @author Dmitry (dio) Levashov
[738] Fix | Delete
**/
[739] Fix | Delete
protected function _relpath($path)
[740] Fix | Delete
{
[741] Fix | Delete
if ($path === $this->root) {
[742] Fix | Delete
return '';
[743] Fix | Delete
} else {
[744] Fix | Delete
if (strpos($path, $this->root) === 0) {
[745] Fix | Delete
return ltrim(substr($path, strlen($this->root)), $this->separator);
[746] Fix | Delete
} else {
[747] Fix | Delete
// for link
[748] Fix | Delete
return $path;
[749] Fix | Delete
}
[750] Fix | Delete
}
[751] Fix | Delete
}
[752] Fix | Delete
[753] Fix | Delete
/**
[754] Fix | Delete
* Convert path related to root dir into real path
[755] Fix | Delete
*
[756] Fix | Delete
* @param string $path file path
[757] Fix | Delete
*
[758] Fix | Delete
* @return string
[759] Fix | Delete
* @author Dmitry (dio) Levashov
[760] Fix | Delete
**/
[761] Fix | Delete
protected function _abspath($path)
[762] Fix | Delete
{
[763] Fix | Delete
if ($path === $this->separator) {
[764] Fix | Delete
return $this->root;
[765] Fix | Delete
} else {
[766] Fix | Delete
if ($path[0] === $this->separator) {
[767] Fix | Delete
// for link
[768] Fix | Delete
return $path;
[769] Fix | Delete
} else {
[770] Fix | Delete
return $this->_joinPath($this->root, $path);
[771] Fix | Delete
}
[772] Fix | Delete
}
[773] Fix | Delete
}
[774] Fix | Delete
[775] Fix | Delete
/**
[776] Fix | Delete
* Return fake path started from root dir
[777] Fix | Delete
*
[778] Fix | Delete
* @param string $path file path
[779] Fix | Delete
*
[780] Fix | Delete
* @return string
[781] Fix | Delete
* @author Dmitry (dio) Levashov
[782] Fix | Delete
**/
[783] Fix | Delete
protected function _path($path)
[784] Fix | Delete
{
[785] Fix | Delete
return $this->rootName . ($path == $this->root ? '' : $this->separator . $this->_relpath($path));
[786] Fix | Delete
}
[787] Fix | Delete
[788] Fix | Delete
/**
[789] Fix | Delete
* Return true if $path is children of $parent
[790] Fix | Delete
*
[791] Fix | Delete
* @param string $path path to check
[792] Fix | Delete
* @param string $parent parent path
[793] Fix | Delete
*
[794] Fix | Delete
* @return bool
[795] Fix | Delete
* @author Dmitry (dio) Levashov
[796] Fix | Delete
**/
[797] Fix | Delete
protected function _inpath($path, $parent)
[798] Fix | Delete
{
[799] Fix | Delete
return $path == $parent || strpos($path, rtrim($parent, $this->separator) . $this->separator) === 0;
[800] Fix | Delete
}
[801] Fix | Delete
[802] Fix | Delete
/***************** file stat ********************/
[803] Fix | Delete
/**
[804] Fix | Delete
* Return stat for given path.
[805] Fix | Delete
* Stat contains following fields:
[806] Fix | Delete
* - (int) size file size in b. required
[807] Fix | Delete
* - (int) ts file modification time in unix time. required
[808] Fix | Delete
* - (string) mime mimetype. required for folders, others - optionally
[809] Fix | Delete
* - (bool) read read permissions. required
[810] Fix | Delete
* - (bool) write write permissions. required
[811] Fix | Delete
* - (bool) locked is object locked. optionally
[812] Fix | Delete
* - (bool) hidden is object hidden. optionally
[813] Fix | Delete
* - (string) alias for symlinks - link target path relative to root path. optionally
[814] Fix | Delete
* - (string) target for symlinks - link target path. optionally
[815] Fix | Delete
* If file does not exists - returns empty array or false.
[816] Fix | Delete
*
[817] Fix | Delete
* @param string $path file path
[818] Fix | Delete
*
[819] Fix | Delete
* @return array|false
[820] Fix | Delete
* @author Dmitry (dio) Levashov
[821] Fix | Delete
**/
[822] Fix | Delete
protected function _stat($path)
[823] Fix | Delete
{
[824] Fix | Delete
$outPath = $this->convEncOut($path);
[825] Fix | Delete
if (isset($this->cache[$outPath])) {
[826] Fix | Delete
return $this->convEncIn($this->cache[$outPath]);
[827] Fix | Delete
} else {
[828] Fix | Delete
$this->convEncIn();
[829] Fix | Delete
}
[830] Fix | Delete
if (!$this->MLSTsupprt) {
[831] Fix | Delete
if ($path === $this->root) {
[832] Fix | Delete
$res = array(
[833] Fix | Delete
'name' => $this->root,
[834] Fix | Delete
'mime' => 'directory',
[835] Fix | Delete
'dirs' => -1
[836] Fix | Delete
);
[837] Fix | Delete
if ($this->needOnline && (($this->ARGS['cmd'] === 'open' && $this->ARGS['target'] === $this->encode($this->root)) || $this->isMyReload())) {
[838] Fix | Delete
$check = array(
[839] Fix | Delete
'ts' => true,
[840] Fix | Delete
'dirs' => true,
[841] Fix | Delete
);
[842] Fix | Delete
$ts = 0;
[843] Fix | Delete
foreach ($this->ftpRawList($path) as $str) {
[844] Fix | Delete
$info = preg_split('/\s+/', $str, 9);
[845] Fix | Delete
if ($info[8] === '.') {
[846] Fix | Delete
$info[8] = 'root';
[847] Fix | Delete
if ($stat = $this->parseRaw(join(' ', $info), $path)) {
[848] Fix | Delete
unset($stat['name']);
[849] Fix | Delete
$res = array_merge($res, $stat);
[850] Fix | Delete
if ($res['ts']) {
[851] Fix | Delete
$ts = 0;
[852] Fix | Delete
unset($check['ts']);
[853] Fix | Delete
}
[854] Fix | Delete
}
[855] Fix | Delete
}
[856] Fix | Delete
if ($check && ($stat = $this->parseRaw($str, $path))) {
[857] Fix | Delete
if (isset($stat['ts']) && !empty($stat['ts'])) {
[858] Fix | Delete
$ts = max($ts, $stat['ts']);
[859] Fix | Delete
}
[860] Fix | Delete
if (isset($stat['dirs']) && $stat['mime'] === 'directory') {
[861] Fix | Delete
$res['dirs'] = 1;
[862] Fix | Delete
unset($stat['dirs']);
[863] Fix | Delete
}
[864] Fix | Delete
if (!$check) {
[865] Fix | Delete
break;
[866] Fix | Delete
}
[867] Fix | Delete
}
[868] Fix | Delete
}
[869] Fix | Delete
if ($ts) {
[870] Fix | Delete
$res['ts'] = $ts;
[871] Fix | Delete
}
[872] Fix | Delete
$this->cache[$outPath] = $res;
[873] Fix | Delete
}
[874] Fix | Delete
return $res;
[875] Fix | Delete
}
[876] Fix | Delete
[877] Fix | Delete
$pPath = $this->_dirname($path);
[878] Fix | Delete
if ($this->_inPath($pPath, $this->root)) {
[879] Fix | Delete
$outPPpath = $this->convEncOut($pPath);
[880] Fix | Delete
if (!isset($this->dirsCache[$outPPpath])) {
[881] Fix | Delete
$parentSubdirs = null;
[882] Fix | Delete
if (isset($this->sessionCache['subdirs']) && isset($this->sessionCache['subdirs'][$outPPpath])) {
[883] Fix | Delete
$parentSubdirs = $this->sessionCache['subdirs'][$outPPpath];
[884] Fix | Delete
}
[885] Fix | Delete
$this->cacheDir($outPPpath);
[886] Fix | Delete
if ($parentSubdirs) {
[887] Fix | Delete
$this->sessionCache['subdirs'][$outPPpath] = $parentSubdirs;
[888] Fix | Delete
}
[889] Fix | Delete
}
[890] Fix | Delete
}
[891] Fix | Delete
[892] Fix | Delete
$stat = $this->convEncIn(isset($this->cache[$outPath]) ? $this->cache[$outPath] : array());
[893] Fix | Delete
if (!$this->mounted) {
[894] Fix | Delete
// dispose incomplete cache made by calling `stat` by 'startPath' option
[895] Fix | Delete
$this->cache = array();
[896] Fix | Delete
}
[897] Fix | Delete
return $stat;
[898] Fix | Delete
}
[899] Fix | Delete
$raw = ftp_raw($this->connect, 'MLST ' . $path);
[900] Fix | Delete
if (is_array($raw) && count($raw) > 1 && substr(trim($raw[0]), 0, 1) == 2) {
[901] Fix | Delete
$parts = explode(';', trim($raw[1]));
[902] Fix | Delete
array_pop($parts);
[903] Fix | Delete
$parts = array_map('strtolower', $parts);
[904] Fix | Delete
$stat = array();
[905] Fix | Delete
$mode = '';
[906] Fix | Delete
foreach ($parts as $part) {
[907] Fix | Delete
[908] Fix | Delete
list($key, $val) = explode('=', $part, 2);
[909] Fix | Delete
[910] Fix | Delete
switch ($key) {
[911] Fix | Delete
case 'type':
[912] Fix | Delete
if (strpos($val, 'dir') !== false) {
[913] Fix | Delete
$stat['mime'] = 'directory';
[914] Fix | Delete
} else if (strpos($val, 'link') !== false) {
[915] Fix | Delete
$stat['mime'] = 'symlink';
[916] Fix | Delete
break(2);
[917] Fix | Delete
} else {
[918] Fix | Delete
$stat['mime'] = $this->mimetype($path);
[919] Fix | Delete
}
[920] Fix | Delete
break;
[921] Fix | Delete
[922] Fix | Delete
case 'size':
[923] Fix | Delete
$stat['size'] = $val;
[924] Fix | Delete
break;
[925] Fix | Delete
[926] Fix | Delete
case 'modify':
[927] Fix | Delete
$ts = mktime(intval(substr($val, 8, 2)), intval(substr($val, 10, 2)), intval(substr($val, 12, 2)), intval(substr($val, 4, 2)), intval(substr($val, 6, 2)), substr($val, 0, 4));
[928] Fix | Delete
$stat['ts'] = $ts;
[929] Fix | Delete
break;
[930] Fix | Delete
[931] Fix | Delete
case 'unix.mode':
[932] Fix | Delete
$mode = strval($val);
[933] Fix | Delete
break;
[934] Fix | Delete
[935] Fix | Delete
case 'unix.uid':
[936] Fix | Delete
$stat['owner'] = $val;
[937] Fix | Delete
break;
[938] Fix | Delete
[939] Fix | Delete
case 'unix.gid':
[940] Fix | Delete
$stat['group'] = $val;
[941] Fix | Delete
break;
[942] Fix | Delete
[943] Fix | Delete
case 'perm':
[944] Fix | Delete
$val = strtolower($val);
[945] Fix | Delete
$stat['read'] = (int)preg_match('/e|l|r/', $val);
[946] Fix | Delete
$stat['write'] = (int)preg_match('/w|m|c/', $val);
[947] Fix | Delete
if (!preg_match('/f|d/', $val)) {
[948] Fix | Delete
$stat['locked'] = 1;
[949] Fix | Delete
}
[950] Fix | Delete
break;
[951] Fix | Delete
}
[952] Fix | Delete
}
[953] Fix | Delete
[954] Fix | Delete
if (empty($stat['mime'])) {
[955] Fix | Delete
return array();
[956] Fix | Delete
}
[957] Fix | Delete
[958] Fix | Delete
// do not use MLST to get stat of symlink
[959] Fix | Delete
if ($stat['mime'] === 'symlink') {
[960] Fix | Delete
$this->MLSTsupprt = false;
[961] Fix | Delete
$res = $this->_stat($path);
[962] Fix | Delete
$this->MLSTsupprt = true;
[963] Fix | Delete
return $res;
[964] Fix | Delete
}
[965] Fix | Delete
[966] Fix | Delete
if ($stat['mime'] === 'directory') {
[967] Fix | Delete
$stat['size'] = 0;
[968] Fix | Delete
}
[969] Fix | Delete
[970] Fix | Delete
if ($mode) {
[971] Fix | Delete
$stat['perm'] = '';
[972] Fix | Delete
if ($mode[0] === '0') {
[973] Fix | Delete
$mode = substr($mode, 1);
[974] Fix | Delete
}
[975] Fix | Delete
[976] Fix | Delete
$perm = array();
[977] Fix | Delete
for ($i = 0; $i <= 2; $i++) {
[978] Fix | Delete
$perm[$i] = array(false, false, false);
[979] Fix | Delete
$n = isset($mode[$i]) ? $mode[$i] : 0;
[980] Fix | Delete
[981] Fix | Delete
if ($n - 4 >= 0) {
[982] Fix | Delete
$perm[$i][0] = true;
[983] Fix | Delete
$n = $n - 4;
[984] Fix | Delete
$stat['perm'] .= 'r';
[985] Fix | Delete
} else {
[986] Fix | Delete
$stat['perm'] .= '-';
[987] Fix | Delete
}
[988] Fix | Delete
[989] Fix | Delete
if ($n - 2 >= 0) {
[990] Fix | Delete
$perm[$i][1] = true;
[991] Fix | Delete
$n = $n - 2;
[992] Fix | Delete
$stat['perm'] .= 'w';
[993] Fix | Delete
} else {
[994] Fix | Delete
$stat['perm'] .= '-';
[995] Fix | Delete
}
[996] Fix | Delete
[997] Fix | Delete
if ($n - 1 == 0) {
[998] Fix | Delete
$perm[$i][2] = true;
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function