changed: winix 'upload' function is a file manager now
we're using an jquery upload plugin added: Item struct has new rows: hash, hash_type, file_size, sort_index added: css mount parameter you can specify css files there, and javascript wysiwyg editors (ckeditor, tinymce) can make use of it changed: post parsers can parse post variables with the same name (a postfix is added in such a case) added: common_dir parameter to the config this is a path to common directory (directory with common static files) it is needed to the 'css' mount parameter git-svn-id: svn://ttmath.org/publicrep/winix/trunk@746 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -9,12 +9,27 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fstream>
|
||||
#include "misc.h"
|
||||
#include "log.h"
|
||||
#include "templates/templates.h"
|
||||
#include "utf8.h"
|
||||
|
||||
|
||||
|
||||
namespace misc_private
|
||||
{
|
||||
std::ifstream get_file_content;
|
||||
std::string get_file_content_ansi;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int Toi(const std::string & str, int base)
|
||||
{
|
||||
return Toi(str.c_str(), base);
|
||||
@@ -805,6 +820,50 @@ bool RenameFile(const std::wstring & from, const std::wstring & to)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool GetUTF8File(const char * file_path, std::wstring & content, bool clear_content)
|
||||
{
|
||||
using namespace misc_private;
|
||||
|
||||
if( clear_content )
|
||||
content.clear();
|
||||
|
||||
get_file_content.clear();
|
||||
get_file_content.open(file_path, std::ios_base::in | std::ios_base::binary);
|
||||
|
||||
if( !get_file_content )
|
||||
return false;
|
||||
|
||||
Ezc::UTF8ToWide(get_file_content, content);
|
||||
get_file_content.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool GetUTF8File(const wchar_t * file_path, std::wstring & content, bool clear_content)
|
||||
{
|
||||
using namespace misc_private;
|
||||
|
||||
Ezc::WideToUTF8(file_path, get_file_content_ansi);
|
||||
return GetUTF8File(get_file_content_ansi.c_str(), content, clear_content);
|
||||
}
|
||||
|
||||
|
||||
bool GetUTF8File(const std::string & file_path, std::wstring & content, bool clear_content)
|
||||
{
|
||||
return GetUTF8File(file_path.c_str(), content, clear_content);
|
||||
}
|
||||
|
||||
|
||||
bool GetUTF8File(const std::wstring & file_path, std::wstring & content, bool clear_content)
|
||||
{
|
||||
return GetUTF8File(file_path.c_str(), content, clear_content);
|
||||
}
|
||||
|
||||
|
||||
// if there is not an extension it returns a pointer to the last '\0' character
|
||||
const wchar_t * GetFileExt(const wchar_t * name)
|
||||
{
|
||||
@@ -1012,7 +1071,24 @@ void QEncode(const std::wstring & in, std::string & out, bool clear)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
deleting all post temporary files
|
||||
*/
|
||||
void RemovePostFileTmp(PostFileTab & post_file_tab)
|
||||
{
|
||||
PostFileTab::iterator i = post_file_tab.begin();
|
||||
|
||||
for( ; i != post_file_tab.end() ; ++i )
|
||||
{
|
||||
const std::wstring & tmp_filename = i->second.tmp_filename;
|
||||
|
||||
if( !tmp_filename.empty() && RemoveFile(tmp_filename) )
|
||||
log << log3 << "Deleted tmp file: " << tmp_filename << logend;
|
||||
else
|
||||
if( !tmp_filename.empty() )
|
||||
log << "swinka" << logend; //!!usunac
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user