2008-12-10 05:42:49 +01:00
|
|
|
/*
|
2010-02-28 01:08:10 +01:00
|
|
|
* This file is a part of Winix
|
2008-12-10 05:42:49 +01:00
|
|
|
* and is not publicly distributed
|
|
|
|
*
|
2010-02-28 22:33:06 +01:00
|
|
|
* Copyright (c) 2008-2010, Tomasz Sowa
|
2008-12-10 05:42:49 +01:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2009-04-21 22:50:55 +02:00
|
|
|
#ifndef headerfilecmslucoremisc
|
|
|
|
#define headerfilecmslucoremisc
|
2008-12-10 05:42:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <sstream>
|
2009-03-23 00:54:15 +01:00
|
|
|
#include <ctime>
|
2010-06-03 19:38:18 +02:00
|
|
|
#include <cstdio>
|
2010-10-24 01:12:47 +02:00
|
|
|
#include "item.h"
|
2010-05-20 20:28:19 +02:00
|
|
|
|
2008-12-10 05:42:49 +01:00
|
|
|
|
|
|
|
void ToString(std::string & s, int value);
|
|
|
|
void ToString(std::string & s, long value);
|
|
|
|
int ChangeLocalChar(unsigned char c);
|
2008-12-30 02:05:03 +01:00
|
|
|
|
|
|
|
bool CorrectUrlChar(char c);
|
2009-12-30 21:46:12 +01:00
|
|
|
void CorrectUrlDots(std::string & url);
|
|
|
|
void CorrectUrlChars(std::string & url);
|
|
|
|
void CorrectUrlOnlyAllowedChar(std::string & url);
|
2008-12-30 02:05:03 +01:00
|
|
|
|
|
|
|
void HtmlEscape(std::ostringstream & out, const std::string & in);
|
2009-06-05 22:29:06 +02:00
|
|
|
void HtmlEscapeFormTxt(std::ostringstream & out, const std::string & in);
|
2008-12-30 02:05:03 +01:00
|
|
|
std::string HtmlEscape(const std::string & in);
|
2009-06-05 22:29:06 +02:00
|
|
|
std::string HtmlEscapeFormTxt(const std::string & in);
|
|
|
|
|
2010-02-15 01:31:14 +01:00
|
|
|
const char * DateToStr(int year, int month, int day);
|
2009-03-23 00:54:15 +01:00
|
|
|
const char * DateToStr(int year, int month, int day, int hour, int min, int sec);
|
2010-10-24 01:12:47 +02:00
|
|
|
const char * DateToStr(const tm * ptm);
|
|
|
|
const char * DateToStr(const tm & rtm);
|
2009-03-23 00:54:15 +01:00
|
|
|
const char * DateToStr(time_t t);
|
2010-10-24 01:12:47 +02:00
|
|
|
const char * DateToStrWithoutHours(const tm * ptm);
|
|
|
|
const char * DateToStrWithoutHours(const tm & rtm);
|
2010-07-27 22:41:56 +02:00
|
|
|
const char * DateToStrWithoutHours(time_t t);
|
2009-11-21 00:09:52 +01:00
|
|
|
|
|
|
|
const char * DateToStrCookie(int year, int month, int day, int hour, int min, int sec);
|
2010-10-24 01:12:47 +02:00
|
|
|
const char * DateToStrCookie(const tm * ptm);
|
|
|
|
const char * DateToStrCookie(const tm & rtm);
|
2009-11-21 00:09:52 +01:00
|
|
|
const char * DateToStrCookie(time_t t);
|
|
|
|
|
2009-04-16 03:59:42 +02:00
|
|
|
const char * IpToStr(unsigned int ip_);
|
2008-12-10 05:42:49 +01:00
|
|
|
|
2009-06-05 22:29:06 +02:00
|
|
|
bool IsWhite(int s);
|
|
|
|
void TrimWhite(std::string & s);
|
2009-12-30 21:46:12 +01:00
|
|
|
void Trim(std::string & s, char c);
|
|
|
|
int ToSmall(int c);
|
2009-06-05 22:29:06 +02:00
|
|
|
void ToSmall(std::string & s);
|
2009-11-17 00:36:38 +01:00
|
|
|
const char * SkipWhite(const char * s);
|
2009-11-18 02:58:38 +01:00
|
|
|
const char * ToStr(int value);
|
|
|
|
|
2009-12-30 21:46:12 +01:00
|
|
|
bool IsSubString(const char * short_str, const char * long_str);
|
2010-10-19 02:31:20 +02:00
|
|
|
bool IsSubString(const std::string & short_str, const std::string & long_str);
|
2009-12-30 21:46:12 +01:00
|
|
|
bool IsSubStringNoCase(const char * short_str, const char * long_str);
|
2010-10-19 02:31:20 +02:00
|
|
|
bool IsSubStringNoCase(const std::string & short_str, const std::string & long_str);
|
2010-02-13 00:16:13 +01:00
|
|
|
bool EqualNoCase(const char * str1, const char * str2);
|
2010-10-02 01:20:03 +02:00
|
|
|
bool EqualNoCase(const std::string & str1, const std::string & str2);
|
2009-06-05 22:29:06 +02:00
|
|
|
|
2009-10-01 00:31:20 +02:00
|
|
|
bool ValidateEmail(const std::string & email);
|
|
|
|
|
2010-01-28 16:39:01 +01:00
|
|
|
bool IsFile(const char * file);
|
|
|
|
bool IsFile(const std::string & file);
|
2010-02-19 00:30:22 +01:00
|
|
|
bool CreateDir(const char * dir, int priv);
|
|
|
|
bool CreateDir(const std::string & dir, int priv);
|
2010-03-15 02:47:26 +01:00
|
|
|
bool CreateDirs(const char * base_dir, const char * dirs, int priv);
|
|
|
|
bool CreateDirs(const std::string & base_dir, const std::string & dirs, int priv);
|
2010-01-28 16:39:01 +01:00
|
|
|
|
2010-06-03 19:38:18 +02:00
|
|
|
bool CopyFile(FILE * in, FILE * out);
|
|
|
|
bool CopyFile(const char * src, const char * dst);
|
|
|
|
bool CopyFile(const std::string & src, const std::string & dst);
|
|
|
|
|
2010-02-13 00:16:13 +01:00
|
|
|
const char * GetFileExt(const char * name);
|
2010-02-22 23:52:09 +01:00
|
|
|
Item::Auth SelectFileType(const char * file_name);
|
2010-01-28 16:39:01 +01:00
|
|
|
|
2010-10-24 01:12:47 +02:00
|
|
|
time_t Time(const tm & par);
|
|
|
|
time_t Time(const tm * par);
|
|
|
|
tm Time(time_t par);
|
|
|
|
|
2008-12-10 05:42:49 +01:00
|
|
|
#endif
|