analizators/1643
This commit is contained in:
parent
2029c34f9c
commit
3d635a4824
@ -28,6 +28,7 @@
|
||||
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
|
||||
#endregion
|
||||
|
||||
@ -95,7 +96,8 @@ namespace ASC.Common.Security.Authorizing
|
||||
if (denyActions == null || denyActions.Length == 0) throw new ArgumentNullException(nameof(denyActions));
|
||||
if (actions.Length != denySubjects.Length || actions.Length != denyActions.Length)
|
||||
throw new ArgumentException();
|
||||
var reasons = "";
|
||||
|
||||
var sb = new StringBuilder();
|
||||
for (var i = 0; i < actions.Length; i++)
|
||||
{
|
||||
var action = actions[i];
|
||||
@ -109,8 +111,9 @@ namespace ASC.Common.Security.Authorizing
|
||||
reason = $"{action.Name}: access denied.";
|
||||
if (i != actions.Length - 1)
|
||||
reason += ", ";
|
||||
reasons += reason;
|
||||
sb.Append(reason);
|
||||
}
|
||||
var reasons = sb.ToString();
|
||||
var sactions = "";
|
||||
Array.ForEach(actions, action => { sactions += action.ToString() + ", "; });
|
||||
var message = $"\"{(subject is IRole ? "role:" : "") + subject.Name}\" access denied \"{sactions}\". Cause: {reasons}.";
|
||||
|
@ -1004,10 +1004,11 @@ namespace ASC.Notify.Cron
|
||||
protected virtual ValueSet GetValue(int v, string s, int i)
|
||||
{
|
||||
var c = s[i];
|
||||
var s1 = v.ToString(CultureInfo.InvariantCulture);
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(v.ToString(CultureInfo.InvariantCulture));
|
||||
while (c >= '0' && c <= '9')
|
||||
{
|
||||
s1 += c;
|
||||
sb.Append(c);
|
||||
i++;
|
||||
if (i >= s.Length)
|
||||
{
|
||||
@ -1024,7 +1025,7 @@ namespace ASC.Notify.Cron
|
||||
{
|
||||
val.Pos = i + 1;
|
||||
}
|
||||
val.TheValue = Convert.ToInt32(s1, CultureInfo.InvariantCulture);
|
||||
val.TheValue = Convert.ToInt32(sb.ToString(), CultureInfo.InvariantCulture);
|
||||
return val;
|
||||
}
|
||||
|
||||
|
@ -294,6 +294,7 @@ namespace ASC.Data.Backup.Tasks
|
||||
|
||||
while ((commandText = await reader.ReadLineAsync()) != null)
|
||||
{
|
||||
var sb = new StringBuilder(commandText);
|
||||
while (!commandText.EndsWith(delimiter))
|
||||
{
|
||||
var newline = await reader.ReadLineAsync();
|
||||
@ -301,9 +302,9 @@ namespace ASC.Data.Backup.Tasks
|
||||
{
|
||||
break;
|
||||
}
|
||||
commandText += newline;
|
||||
sb.Append(newline);
|
||||
}
|
||||
|
||||
commandText = sb.ToString();
|
||||
try
|
||||
{
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
|
||||
@ -48,25 +49,27 @@ namespace ASC.Notify.Textile
|
||||
|
||||
public void ApplyFormating(NoticeMessage message)
|
||||
{
|
||||
var body = string.Empty;
|
||||
var sb = new StringBuilder();
|
||||
if (!string.IsNullOrEmpty(message.Subject))
|
||||
{
|
||||
body += VelocityArguments.Replace(message.Subject, ArgMatchReplace) + Environment.NewLine;
|
||||
sb.AppendLine(VelocityArguments.Replace(message.Subject, ArgMatchReplace));
|
||||
message.Subject = string.Empty;
|
||||
}
|
||||
if (string.IsNullOrEmpty(message.Body)) return;
|
||||
var lines = message.Body.Split(new[] { Environment.NewLine, "\n" }, StringSplitOptions.None);
|
||||
|
||||
for (var i = 0; i < lines.Length - 1; i++)
|
||||
{
|
||||
ref var line = ref lines[i];
|
||||
if (string.IsNullOrEmpty(line)) { body += Environment.NewLine; continue; }
|
||||
if (string.IsNullOrEmpty(line)) { sb.AppendLine(); continue; }
|
||||
line = VelocityArguments.Replace(line, ArgMatchReplace);
|
||||
body += LinkReplacer.Replace(line, EvalLink) + Environment.NewLine;
|
||||
sb.AppendLine(LinkReplacer.Replace(line, EvalLink));
|
||||
}
|
||||
|
||||
ref var lastLine = ref lines[^1];
|
||||
lastLine = VelocityArguments.Replace(lastLine, ArgMatchReplace);
|
||||
body += LinkReplacer.Replace(lastLine, EvalLink);
|
||||
sb.Append(LinkReplacer.Replace(lastLine, EvalLink));
|
||||
var body = sb.ToString();
|
||||
body = TextileReplacer.Replace(HttpUtility.HtmlDecode(body), ""); //Kill textile markup
|
||||
body = BrReplacer.Replace(body, Environment.NewLine);
|
||||
body = ClosedTagsReplacer.Replace(body, Environment.NewLine);
|
||||
|
@ -11,6 +11,7 @@
|
||||
#endregion
|
||||
|
||||
#region Using Statements
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
#endregion
|
||||
|
||||
@ -39,7 +40,7 @@ namespace Textile.Blocks
|
||||
{ @"\b ?[([](C|c)[])]", "©" } // copyright
|
||||
};
|
||||
|
||||
var output = "";
|
||||
var sb = new StringBuilder();
|
||||
|
||||
if (!Regex.IsMatch(line, "<.*>"))
|
||||
{
|
||||
@ -48,13 +49,14 @@ namespace Textile.Blocks
|
||||
{
|
||||
line = Regex.Replace(line, glyphs[i, 0], glyphs[i, 1]);
|
||||
}
|
||||
output = line;
|
||||
sb.Append(line);
|
||||
}
|
||||
else
|
||||
{
|
||||
var splits = Regex.Split(line, "(<.*?>)");
|
||||
var offtags = "code|pre|notextile";
|
||||
var codepre = false;
|
||||
|
||||
foreach (var split in splits)
|
||||
{
|
||||
var modifiedSplit = split;
|
||||
@ -82,11 +84,11 @@ namespace Textile.Blocks
|
||||
//line = line.Replace("&#", "&#");
|
||||
}
|
||||
|
||||
output += modifiedSplit;
|
||||
sb.Append(modifiedSplit);
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
using ASC.Common;
|
||||
@ -195,7 +196,8 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations
|
||||
var toFolderId = toFolder.ID;
|
||||
var isToFolder = Equals(toFolderId, DaoFolderId);
|
||||
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(Result);
|
||||
foreach (var folderId in folderIds)
|
||||
{
|
||||
CancellationToken.ThrowIfCancellationRequested();
|
||||
@ -243,7 +245,7 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations
|
||||
|
||||
if (ProcessedFolder(folderId))
|
||||
{
|
||||
Result += string.Format("folder_{0}{1}", newFolder.ID, SPLIT_CHAR);
|
||||
sb.Append($"folder_{newFolder.ID}{SPLIT_CHAR}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -263,7 +265,7 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations
|
||||
FolderDao.DeleteFolder(folder.ID);
|
||||
if (ProcessedFolder(folderId))
|
||||
{
|
||||
Result += string.Format("folder_{0}{1}", newFolder.ID, SPLIT_CHAR);
|
||||
sb.Append($"folder_{newFolder.ID}{SPLIT_CHAR}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -284,7 +286,7 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations
|
||||
|
||||
if (ProcessedFolder(folderId))
|
||||
{
|
||||
Result += string.Format("folder_{0}{1}", newFolderId, SPLIT_CHAR);
|
||||
sb.Append($"folder_{newFolderId}{SPLIT_CHAR}");
|
||||
}
|
||||
}
|
||||
else if (!FilesSecurity.CanDelete(folder))
|
||||
@ -316,7 +318,7 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations
|
||||
|
||||
if (ProcessedFolder(folderId))
|
||||
{
|
||||
Result += string.Format("folder_{0}{1}", newFolderId, SPLIT_CHAR);
|
||||
sb.Append($"folder_{newFolderId}{SPLIT_CHAR}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -353,10 +355,11 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations
|
||||
|
||||
if (ProcessedFolder(folderId))
|
||||
{
|
||||
Result += string.Format("folder_{0}{1}", newFolderId, SPLIT_CHAR);
|
||||
sb.Append($"folder_{newFolderId}{SPLIT_CHAR}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Result = sb.ToString();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -382,7 +385,8 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations
|
||||
var fileDao = scope.ServiceProvider.GetService<IFileDao<TTo>>();
|
||||
var fileTracker = scope.ServiceProvider.GetService<FileTrackerHelper>();
|
||||
|
||||
var toFolderId = toFolder.ID;
|
||||
var toFolderId = toFolder.ID;
|
||||
var sb = new StringBuilder();
|
||||
foreach (var fileId in fileIds)
|
||||
{
|
||||
CancellationToken.ThrowIfCancellationRequested();
|
||||
@ -432,7 +436,7 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations
|
||||
|
||||
if (ProcessedFile(fileId))
|
||||
{
|
||||
Result += string.Format("file_{0}{1}", newFile.ID, SPLIT_CHAR);
|
||||
sb.Append($"file_{newFile.ID}{SPLIT_CHAR}");
|
||||
}
|
||||
}
|
||||
catch
|
||||
@ -480,7 +484,7 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations
|
||||
|
||||
if (ProcessedFile(fileId))
|
||||
{
|
||||
Result += string.Format("file_{0}{1}", newFileId, SPLIT_CHAR);
|
||||
sb.Append($"file_{newFileId}{SPLIT_CHAR}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -535,7 +539,7 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations
|
||||
filesMessageService.Send(newFile, toFolder, _headers, MessageAction.FileCopiedWithOverwriting, newFile.Title, parentFolder.Title, toFolder.Title);
|
||||
if (ProcessedFile(fileId))
|
||||
{
|
||||
Result += string.Format("file_{0}{1}", newFile.ID, SPLIT_CHAR);
|
||||
sb.Append($"file_{newFile.ID}{SPLIT_CHAR}");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -544,7 +548,7 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations
|
||||
{
|
||||
if (ProcessedFile(fileId))
|
||||
{
|
||||
Result += string.Format("file_{0}{1}", newFile.ID, SPLIT_CHAR);
|
||||
sb.Append($"file_{newFile.ID}{SPLIT_CHAR}");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -568,7 +572,7 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations
|
||||
|
||||
if (ProcessedFile(fileId))
|
||||
{
|
||||
Result += string.Format("file_{0}{1}", newFile.ID, SPLIT_CHAR);
|
||||
sb.Append($"file_{newFile.ID}{SPLIT_CHAR}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -589,7 +593,7 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations
|
||||
}
|
||||
ProgressStep(fileId: FolderDao.CanCalculateSubitems(fileId) ? default : fileId);
|
||||
}
|
||||
|
||||
Result = sb.ToString();
|
||||
return needToMark;
|
||||
}
|
||||
|
||||
|
@ -299,12 +299,12 @@ namespace ASC.Web.Core.Users
|
||||
{
|
||||
var length = RandomNumberGenerator.GetInt32(minLength, maxLength + 1);
|
||||
|
||||
var pwd = string.Empty;
|
||||
var sb = new StringBuilder();
|
||||
while (length-- > 0)
|
||||
{
|
||||
pwd += noise[RandomNumberGenerator.GetInt32(noise.Length - 1)];
|
||||
sb.Append(noise[RandomNumberGenerator.GetInt32(noise.Length - 1)]);
|
||||
}
|
||||
return pwd;
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
internal static string GenerateErrorMessage(PasswordSettings passwordSettings)
|
||||
|
Loading…
Reference in New Issue
Block a user