+ // get extra files that the user wants to add to the Freesite\r
+ filename=name+"-files.txt";\r
+ infile=fopen(filename.c_str(),"r+b");\r
+ if(infile)\r
+ {\r
+ std::vector<std::string> files;\r
+\r
+ fseek(infile,0,SEEK_END);\r
+ long len=ftell(infile);\r
+ fseek(infile,0,SEEK_SET);\r
+\r
+ std::vector<unsigned char> data;\r
+ data.resize(len);\r
+ fread(&data[0],1,data.size(),infile);\r
+ fclose(infile);\r
+\r
+ // split on \r and \n - on systems with \r\n line endings there will be blank entries, but we'll just skip those\r
+ std::string filecontent(data.begin(),data.end());\r
+ StringFunctions::SplitMultiple(filecontent,"\r\n",files);\r
+\r
+ for(std::vector<std::string>::iterator i=files.begin(); i!=files.end(); i++)\r
+ {\r
+ if((*i)!="" && (*i).find("index.htm")==std::string::npos && (*i).find("trustlist.htm")==std::string::npos && (*i).find("files.htm")==std::string::npos)\r
+ {\r
+ filename=(*i);\r
+ infile=fopen(filename.c_str(),"r+b");\r
+ if(infile)\r
+ {\r
+ fseek(infile,0,SEEK_END);\r
+ len=ftell(infile);\r
+ fseek(infile,0,SEEK_SET);\r
+\r
+ data.resize(len);\r
+ fread(&data[0],1,data.size(),infile);\r
+ fclose(infile);\r
+\r
+ filecontent="";\r
+ filecontent.append(data.begin(),data.end());\r
+\r
+ // strip off path from filename\r
+ while(filename.find_first_of("/")!=std::string::npos)\r
+ {\r
+ filename.erase(0,filename.find_first_of("/")+1);\r
+ }\r
+\r
+ if(filecontent.size()>0)\r
+ {\r
+ pages[filename]=filecontent;\r
+ }\r
+\r
+ }\r
+ else\r
+ {\r
+ m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"SiteInserter::GeneratePages could not include user file "+(*i));\r
+ }\r
+ }\r
+ }\r
+\r
+ }\r
+\r