/** * @access private * @param string $mailRootpath * @return bool */ function _parse($mailRootpath) { $result = true; $wmtab = $mailRootpath . '/' . WEBMAILCONFIGTAB; $ctrtab = $mailRootpath . '/ctrlaccounts.tab'; if (@file_exists($wmtab)) { $file = @file($wmtab); if ($file && count($file) > 0) { foreach ($file as $fileLine) { $fileLine = trim($fileLine); if (strlen($fileLine) == 0 || $fileLine[0] == '#') { continue; } $array = explode("\t", trim($fileLine)); if (is_array($array) && count($array) > 1) { $name = trim($array[0], '"'); $value = trim($array[1], '"'); switch ($name) { case 'CtrlPort': $this->AdminPort = (int) $value; break; case 'SmtpPort': $this->OutPort = (int) $value; break; } } } } else { $result = false; setGlobalError('Empty file: ' . $wmtab); } } else { $result = false; setGlobalError('Can\'t find file: ' . $wmtab); } if ($result) { if (@file_exists($ctrtab)) { $file = @file($ctrtab); if ($file && count($file) > 0) { foreach ($file as $fileLine) { $fileLine = trim($fileLine); if (strlen($fileLine) == 0 || $fileLine[0] == '#') { continue; } $array = explode("\t", trim($fileLine)); if (is_array($array) && count($array) == 2) { $this->AdminLogin = trim($array[0], '"'); $this->AdminPassword = ConvertUtils::WmServerDeCrypt(trim($array[1], '"')); break; } } } else { $result = false; setGlobalError('Empty file: ' . $ctrtab); } } else { $result = false; setGlobalError('Can\'t find file: ' . $ctrtab); } } return $result; }
/** * @access private * @return bool */ function _parse($fileName) { if (file_exists($fileName)) { $file = @file($fileName); if ($file) { foreach ($file as $fileLine) { $fileLine = trim($fileLine); if (strlen($fileLine) == 0 || $fileLine[0] == '#') { continue; } $array = explode("\t", trim($fileLine)); if (is_array($array) && count($array) > 1) { $name = trim($array[0], '"'); $value = trim($array[1], '"'); switch ($name) { case 'CtrlPort': $this->AdminPort = (int) $value; break; case 'SmtpPort': $this->OutPort = (int) $value; break; case 'Login': $this->AdminLogin = $value; break; case 'Password': $this->AdminPassword = ConvertUtils::WmServerDeCrypt($value); break; } } } return true; } } else { setGlobalError('Can\'t find file: ' . $fileName); } return false; }