コード例 #1
0
ファイル: oauth.c プロジェクト: ColumPaget/daytime
void OAuthParseForm(char *HTML, char *SubmitType, char **SubmitURL, ListNode *HiddenVals, ListNode *QueryVals)
{
char *TagName=NULL, *TagData=NULL, *Type=NULL, *Name=NULL, *Value=NULL, *ptr;

ptr=XMLGetTag(HTML,NULL,&TagName,&TagData);
while (ptr)
{
if (strcmp(TagName,"input")==0)	
{
	ParseTagData(TagName,TagData,&Type,&Name,&Value);

  if (strcasecmp(Type,"hidden")==0) SetVar(HiddenVals,Name,Value);
  if (strcasecmp(Type,"submit")==0) SetVar(HiddenVals,Name,Value);
  if (strcasecmp(Type,"text")==0) SetVar(QueryVals,Name,Value);
  if (strcasecmp(Type,"password")==0) SetVar(QueryVals,Name,Value);
}

if (strcmp(TagName,"form")==0)	
{
	ParseTagData(TagName,TagData,&Type,&Name,SubmitURL);
}


ptr=XMLGetTag(ptr,NULL,&TagName,&TagData);
}

DestroyString(TagName);
DestroyString(TagData);
DestroyString(Type);
DestroyString(Name);
DestroyString(Value);
}
コード例 #2
0
int LoadFromIOC(const char *XML, int Flags)
{
char *TagType=NULL, *TagData=NULL, *ptr;
char *ID=NULL;
int count=0;
TFingerprint *FP;

ptr=XMLGetTag(XML,NULL,&TagType,&TagData);
while (ptr)
{
	if (strcasecmp(TagType,"short_description")==0) ptr=XMLGetTag(ptr,NULL,&TagType,&ID);
	if (
			(strcasecmp(TagType,"content")==0) &&
			(strcasecmp(TagData,"type=\"md5\"")==0)
		)
	{
		ptr=XMLGetTag(ptr,NULL,&TagType,&TagData);
		FP=TFingerprintCreate(TagData, "md5", ID, "");
		if (MatchAdd(FP, ID, Flags)) count++;
	}
	ptr=XMLGetTag(ptr,NULL,&TagType,&TagData);
}

DestroyString(ID);
DestroyString(TagType);
DestroyString(TagData);

return(count);
}
コード例 #3
0
ファイル: idrive.c プロジェクト: ColumPaget/FileFerry
void IDriveParseResponse(char *Data, ListNode *Vars)
{
char *TagName=NULL, *TagData=NULL, *ptr;

ptr=XMLGetTag(Data,NULL,&TagName,&TagData);
while (ptr)
{
IDriveParseResponseItem(TagData, Vars);
ptr=XMLGetTag(ptr,NULL,&TagName,&TagData);
}

DestroyString(TagName);
DestroyString(TagData);
}
コード例 #4
0
ファイル: idrive.c プロジェクト: ColumPaget/FileFerry
int IDriveLoadDir(TFileStore *FS, char *InPattern, ListNode *Items, int Flags)
{
int result;
char *Tempstr=NULL, *XML=NULL;
char *TagName=NULL, *TagData=NULL, *ptr;
TFileInfo *FI;
HTTPInfoStruct *Info;
ListNode *Vars;

	Tempstr=MCopyStr(Tempstr,"https://",FS->Host,"/evs/browseFolder?uid=",FS->Logon,"&pwd=",FS->Passwd,"&p=",FS->CurrDir,NULL);

	FS->S=HTTPMethod("POST",Tempstr,"","","","",0);
	Tempstr=STREAMReadDocument(Tempstr, FS->S, TRUE);
	
	ptr=XMLGetTag(Tempstr,NULL,&TagName,&TagData);
	while (ptr)
	{
		if (strcmp(TagName,"item")==0) 
		{
				FI=IDriveReadFileEntry(TagData);
				if (Items) ListAddNamedItem(Items,FI->Name,FI);
		}

		ptr=XMLGetTag(ptr,NULL,&TagName,&TagData);
	}

STREAMClose(FS->S);
FS->S=NULL;

Tempstr=MCopyStr(Tempstr,"https://",FS->Host,"/evs/getAccountQuota?uid=",FS->Logon,"&pwd=",FS->Passwd,NULL);
FS->S=HTTPMethod("POST",Tempstr,"","","","",0);
Tempstr=STREAMReadDocument(Tempstr, FS->S, TRUE);

Vars=ListCreate();
IDriveParseResponse(Tempstr,Vars);

FS->BytesAvailable=strtod(GetVar(Vars,"totalquota"),NULL);
FS->BytesUsed=strtod(GetVar(Vars,"usedquota"),NULL);

ListDestroy(Vars,DestroyString);

DestroyString(TagName);
DestroyString(TagData);
DestroyString(Tempstr);
DestroyString(XML);

return(TRUE);
}
コード例 #5
0
ファイル: Markup.c プロジェクト: ColumPaget/daytime
char *HtmlGetTag(char *Input, char **TagType, char **TagData)
{
if (! Input) return(NULL);
if (*Input=='\0') return(NULL);

return(XMLGetTag(Input, NULL, TagType, TagData));
}
コード例 #6
0
ファイル: ChrootHelper.c プロジェクト: ColumPaget/Alaya
//Sanitize is more than 'Clean', it clears out any HTML string
char *SanitizeStr(char *Buffer, char *Data)
{
char *TagNamespace=NULL, *TagType=NULL, *TagData=NULL, *ptr;
char *RetStr=NULL, *Tempstr=NULL;

ptr=XMLGetTag(Data, &TagNamespace, &TagType, &TagData);
while (ptr)
{
	if (StrLen(TagType)==0) Tempstr=CatStr(Tempstr,TagData);
	else
	{
		if (
				ListFindNamedItem(Settings.SanitizeArgumentsAllowedTags,TagType) ||
				((*TagType=='/') && ListFindNamedItem(Settings.SanitizeArgumentsAllowedTags,TagType+1))
			)
		{
			if (StrLen(TagNamespace)) Tempstr=MCatStr(Tempstr,"<",TagNamespace,":",TagType,NULL);
			else Tempstr=MCatStr(Tempstr,"<",TagType,NULL);
			if (StrLen(TagData)) Tempstr=MCatStr(Tempstr," ",TagData,NULL);
			Tempstr=CatStr(Tempstr,">");
		}
	}


ptr=XMLGetTag(ptr, &TagNamespace, &TagType, &TagData);
}

RetStr=HTTPQuote(Buffer,Tempstr);

DestroyString(TagNamespace);
DestroyString(Tempstr);
DestroyString(TagType);
DestroyString(TagData);


return(RetStr);
}