Backend
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
#ifndef CFG_H
|
||||
#define CFG_H
|
||||
|
||||
#include "php_mermsemr_config.h"
|
||||
|
||||
void CfgReadConfig();
|
||||
long CfgReadLong(const char* key);
|
||||
//std::string CfgReadString(const char* key);
|
||||
const char* CfgReadChar(const char* key);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,280 @@
|
||||
#ifndef __dew_cgi_lib
|
||||
#define __dew_cgi_lib
|
||||
|
||||
#include "php_tmpl_prefix.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <utime.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/timeb.h>
|
||||
#include <sys/time.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h> // for tolower(char)
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <sqltypes.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "clog.h"
|
||||
#include "list.h"
|
||||
#include "cvariables.h"
|
||||
|
||||
|
||||
#define CGI_FLAG_CLEAR (char*)-1
|
||||
|
||||
#define EMAIL_PREFIX TMPL_PREFIX
|
||||
|
||||
enum { METHOD_NONE, METHOD_GET, METHOD_POST };
|
||||
enum { SEQ_NONE, SEQ_REVERSE };
|
||||
|
||||
int Min0(int a, int b, bool & EOS); // Returns the smaller of the two; if it's < 0, returns 0
|
||||
// a = how many to copy; b = limit;
|
||||
|
||||
void strncpy_(char * dst, char * src, int n);
|
||||
|
||||
int GetParam(char * params, char _name[], char value[], int valuelen, char ** end = NULL);
|
||||
|
||||
void CatFile( char * fname, FILE * fout );
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Classes *
|
||||
* *
|
||||
* - Class CVariables defines a set of routines for handling internal *
|
||||
* variables, which are stored by using a linked list *
|
||||
* *
|
||||
* - Class CGIList implements the functionality in template rendering *
|
||||
* by which one can define lists of unknown length from within *
|
||||
* a template. *
|
||||
* *
|
||||
* - Class C_CGI_Form is the most essential class for the CGI interface. *
|
||||
* It enables to obtain variables passed from the browser *
|
||||
* and renders complex templates using CVariables and CGIList *
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
|
||||
|
||||
// The following deals with getting variables from forms
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char * mask, * explanation;
|
||||
|
||||
} pattern_t;
|
||||
|
||||
|
||||
typedef
|
||||
enum { CGI_STRING, CGI_RADIO,
|
||||
CGI_SELECT,
|
||||
CGI_SELECT_LOOKUP,
|
||||
CGI_CHECKBOX,
|
||||
CGI_CHECKBOXLIST, // bit-encoded ULONG
|
||||
CGI_LONG,
|
||||
CGI_FLOAT,
|
||||
CGI_CHECKBOXLIST_ARRAY, // array of ULONGs
|
||||
CGI_RADIO_INT,
|
||||
CGI_SELECT_MUL, // multiple select box
|
||||
CGI_RADIO_INT2, // CGI_RADIO_INT that uses first two letters of the variable name for referencing values
|
||||
CGI_AMOUNT, // currency amount, converts to unsigned long
|
||||
}
|
||||
CGI_VAR_TYPE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
CGI_VAR_TYPE type;
|
||||
|
||||
// Matching
|
||||
|
||||
int minlen, maxlen;
|
||||
pattern_t *pattern; // ext regular expression; NULL for skip
|
||||
|
||||
char **radio; // for radio buttons, NULL otherwise
|
||||
unsigned char nradio; // number of elements
|
||||
|
||||
// return portion
|
||||
|
||||
void *target; // Where the result should be stored
|
||||
int size; // Don't exceed this !
|
||||
|
||||
// corresponding SQL type
|
||||
int sql_type;
|
||||
|
||||
// more return data
|
||||
bool match;
|
||||
|
||||
|
||||
} CGI_Variable;
|
||||
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class CGIList;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char * pre, * post;
|
||||
int pre_n, post_n;
|
||||
} Tprepost;
|
||||
|
||||
|
||||
class C_CGI_Form : public CVariables {
|
||||
public:
|
||||
friend class CGIList;
|
||||
|
||||
C_CGI_Form( char * _dir, char * _template_file, char * _global_template=NULL, int _argc=0, char **_argv = NULL );
|
||||
// Instantiates a C_CGI_Form object.
|
||||
// _dir - template directory
|
||||
// _template_file - initial/default template file
|
||||
// _global_template - used to encapsulate templates in a global template
|
||||
// _arc - argc from main()
|
||||
// _argv - argv from main()
|
||||
|
||||
|
||||
|
||||
~C_CGI_Form( );
|
||||
|
||||
void Email( char * fname, char * from=NULL );
|
||||
|
||||
bool Form( FILE * fout ); // Render output from current template into opened file 'fout'
|
||||
bool Form( FILE * fout, char * template_file );
|
||||
|
||||
char * FormFile( char * fname ); // Render output from current template into 'fname'
|
||||
|
||||
char * FormBuffer( char * buf );
|
||||
|
||||
/* bool FormBuffer( char * buf, FILE * fout, char * listname = NULL, int listi = 0 );
|
||||
// Render output from current template into buffer*/
|
||||
char * RFormBuffer( char * buf, char * listname = NULL, int listi = 0 );
|
||||
// Render output from current template into buffer using recursion
|
||||
|
||||
#ifdef WITH_LANGUAGE
|
||||
char *translate( char * buf, const char *template_file );
|
||||
#endif
|
||||
|
||||
// int GetParam( char name[], char value[], int valuelen );
|
||||
// Scan 'params' for 'name' and return its value in 'value'
|
||||
int GetParam( char name[], char value[], int valuelen, char ** end = NULL, char *start = NULL );
|
||||
int GetParamMul( char name[], TList ** list );
|
||||
|
||||
int GetScreen( char * screens[], int n, const char * scrs = NULL );
|
||||
// Returns current screen index as passed by the browser
|
||||
// and looked up in screens[]
|
||||
int GetCommand( char * commands[], int n );
|
||||
// Returns current command index as passed by the browser
|
||||
// and looked up in commands[]
|
||||
|
||||
void Template( char * _template_file )
|
||||
// Sets the default template to '_template_file'
|
||||
{
|
||||
free( template_file );
|
||||
template_file = (char*)malloc( strlen(TMPL_PREFIX)+1+strlen(_template_file)+1 );
|
||||
sprintf( template_file, "%s/%s", TMPL_PREFIX, _template_file );
|
||||
}
|
||||
|
||||
void GlobalTemplate( char * _template_file )
|
||||
// Sets the global template to '_template_file'
|
||||
{
|
||||
if ( global_template ) free( global_template );
|
||||
global_template = strdup(_template_file);
|
||||
}
|
||||
// void ParseGlobalTemplate(); // Parse the global template file and set 'sectionX' variables
|
||||
void ParseGlobalTemplate( char * fname = NULL );
|
||||
bool ParseNewTemplate( char * fname = NULL );
|
||||
|
||||
void MatchVariable( CGI_Variable * var, bool optional = false, bool flag_if_mismatch = true );
|
||||
// Provides CGI variable mapping and matching functionality
|
||||
// can match against regular expressions etc
|
||||
void SetVariable( CGI_Variable * var );
|
||||
// Sets a variable that may be used in a template
|
||||
void Flag( CGI_Variable * var );
|
||||
// Mark variable as invalid input
|
||||
void Flag( char * var, char * explanation = NULL );
|
||||
// Mark variable as invalid input
|
||||
|
||||
void ClearVariable( CGI_Variable var );
|
||||
|
||||
void GetNextVariable( TList * &cur, char * &c1, char * &c, char * listname, int listi );
|
||||
CGIList * lists[50];
|
||||
int nlists;
|
||||
|
||||
char * params;
|
||||
|
||||
char * template_file;
|
||||
char * global_template;
|
||||
|
||||
unsigned char method, sequence;
|
||||
|
||||
private:
|
||||
char * dir;
|
||||
char * form;
|
||||
|
||||
#ifdef WITH_LANGUAGE
|
||||
char language[10];
|
||||
#endif
|
||||
int argc;
|
||||
char** argv;
|
||||
|
||||
};
|
||||
|
||||
class CGIList
|
||||
{
|
||||
public:
|
||||
friend class C_CGI_Form;
|
||||
|
||||
CGIList( C_CGI_Form * _form, char * name );
|
||||
|
||||
// Instantiates a CGI_List object
|
||||
// _form points to the parent form object
|
||||
// name - name of the list as used in template
|
||||
|
||||
~CGIList() { free( listname ); if (form) form->lists[listn] = 0; };
|
||||
|
||||
int CloseElement() { return ++n; };
|
||||
// Move on to the next element in the list.
|
||||
|
||||
void LetStr( char * var, char * value );
|
||||
// Set a CGI list variable using the list name and element number as part of the name
|
||||
|
||||
void LetStrf( char * var, const char * format, ... );
|
||||
|
||||
void LetInt16( char * var, int value );
|
||||
// Set a CGI list variable using the list name and element number as part of the name
|
||||
|
||||
char * GetVariable( char * var, char * result, int size );
|
||||
// Obtain a CGI list variable value using the list name and element number as part of the name
|
||||
|
||||
void LetStr( char * var, const char * format, ... );
|
||||
|
||||
int n;
|
||||
private:
|
||||
C_CGI_Form * form;
|
||||
int listn;
|
||||
char * listname;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CInputError : public CVariables {
|
||||
public:
|
||||
|
||||
void Add( bool text, const char * name, const char * explanation, ... );
|
||||
char * Get( const char * name, bool *text );
|
||||
void Log();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,191 @@
|
||||
#ifndef __CLOG_H__
|
||||
#define __CLOG_H__
|
||||
|
||||
#include "php_mermsemr_log.h"
|
||||
#include "php_filelog_max_level.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <stdarg.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
inline std::string NowTime();
|
||||
|
||||
enum TLogLevel {logERROR, logWARNING, logINFO, logDEBUG, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4, logSQL, FLOG_MAX};
|
||||
|
||||
void logfmt( TLogLevel level, const char * format, ... );
|
||||
|
||||
template <typename T>
|
||||
class Log
|
||||
{
|
||||
public:
|
||||
Log();
|
||||
virtual ~Log();
|
||||
std::ostringstream& Get(TLogLevel level = logINFO);
|
||||
public:
|
||||
static TLogLevel& ReportingLevel();
|
||||
static std::string ToString(TLogLevel level);
|
||||
static TLogLevel FromString(const std::string& level);
|
||||
protected:
|
||||
std::ostringstream os;
|
||||
private:
|
||||
Log(const Log&);
|
||||
Log& operator =(const Log&);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
Log<T>::Log()
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::ostringstream& Log<T>::Get(TLogLevel level)
|
||||
{
|
||||
os << "- " << NowTime();
|
||||
os << " " << ToString(level);
|
||||
os << " [" << getpid() << "]: ";
|
||||
os << std::string(level > logDEBUG ? level - logDEBUG : 0, '\t');
|
||||
return os;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
Log<T>::~Log()
|
||||
{
|
||||
os << std::endl;
|
||||
T::Output(os.str());
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
TLogLevel& Log<T>::ReportingLevel()
|
||||
{
|
||||
static TLogLevel reportingLevel = FLOG_MAX;
|
||||
return reportingLevel;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::string Log<T>::ToString(TLogLevel level)
|
||||
{
|
||||
static const char* const buffer[] = {"ERROR", "WARNING", "INFO", "DEBUG", "DEBUG1", "DEBUG2", "DEBUG3", "DEBUG4", "SQL", "FLOG_MAX"};
|
||||
return buffer[level];
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
TLogLevel Log<T>::FromString(const std::string& level)
|
||||
{
|
||||
if (level == "FLOG_MAX")
|
||||
return FLOG_MAX;
|
||||
if (level == "SQL")
|
||||
return logSQL;
|
||||
if (level == "DEBUG4")
|
||||
return logDEBUG4;
|
||||
if (level == "DEBUG3")
|
||||
return logDEBUG3;
|
||||
if (level == "DEBUG2")
|
||||
return logDEBUG2;
|
||||
if (level == "DEBUG1")
|
||||
return logDEBUG1;
|
||||
if (level == "DEBUG")
|
||||
return logDEBUG;
|
||||
if (level == "INFO")
|
||||
return logINFO;
|
||||
if (level == "WARNING")
|
||||
return logWARNING;
|
||||
if (level == "ERROR")
|
||||
return logERROR;
|
||||
Log<T>().Get(logWARNING) << "Unknown logging level '" << level << "'. Using INFO level as default.";
|
||||
return logINFO;
|
||||
}
|
||||
|
||||
class Output2FILE
|
||||
{
|
||||
public:
|
||||
static FILE*& Stream();
|
||||
static void Output(const std::string& msg);
|
||||
};
|
||||
|
||||
inline FILE*& Output2FILE::Stream()
|
||||
{
|
||||
static FILE* pStream = stderr;
|
||||
return pStream;
|
||||
}
|
||||
|
||||
inline void Output2FILE::Output(const std::string& msg)
|
||||
{
|
||||
FILE* pStream = Stream();
|
||||
if (!pStream)
|
||||
return;
|
||||
fprintf(pStream, "%s", msg.c_str());
|
||||
fflush(pStream);
|
||||
}
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
||||
# if defined (BUILDING_FILELOG_DLL)
|
||||
# define FILELOG_DECLSPEC __declspec (dllexport)
|
||||
# elif defined (USING_FILELOG_DLL)
|
||||
# define FILELOG_DECLSPEC __declspec (dllimport)
|
||||
# else
|
||||
# define FILELOG_DECLSPEC
|
||||
# endif // BUILDING_DBSIMPLE_DLL
|
||||
#else
|
||||
# define FILELOG_DECLSPEC
|
||||
#endif // _WIN32
|
||||
|
||||
class FILELOG_DECLSPEC FILELog : public Log<Output2FILE> {};
|
||||
//typedef Log<Output2FILE> FILELog;
|
||||
|
||||
#ifndef FILELOG_MAX_LEVEL
|
||||
#define FILELOG_MAX_LEVEL FLOG_MAX
|
||||
#endif
|
||||
|
||||
#define FILE_LOG(level) \
|
||||
if (level > FILELOG_MAX_LEVEL) ;\
|
||||
else if (level > FILELog::ReportingLevel() || !Output2FILE::Stream()) ; \
|
||||
else FILELog().Get(level)
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
inline std::string NowTime()
|
||||
{
|
||||
const int MAX_LEN = 200;
|
||||
char buffer[MAX_LEN];
|
||||
if (GetTimeFormatA(LOCALE_USER_DEFAULT, 0, 0,
|
||||
"HH':'mm':'ss", buffer, MAX_LEN) == 0)
|
||||
return "Error in NowTime()";
|
||||
|
||||
char result[100] = {0};
|
||||
static DWORD first = GetTickCount();
|
||||
std::sprintf(result, "%s.%03ld", buffer, (long)(GetTickCount() - first) % 1000);
|
||||
return result;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
inline std::string NowTime()
|
||||
{
|
||||
char buffer[11];
|
||||
time_t t;
|
||||
time(&t);
|
||||
tm r = {0};
|
||||
strftime(buffer, sizeof(buffer), "%X", localtime_r(&t, &r));
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, 0);
|
||||
char result[100] = {0};
|
||||
std::sprintf(result, "%s.%03ld", buffer, (long)tv.tv_usec / 1000);
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif //WIN32
|
||||
|
||||
|
||||
#endif //__LOG_H__
|
||||
|
||||
/*
|
||||
vi:ts=2
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/* config.h. Generated from config.h.in by configure. */
|
||||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
|
||||
/* Whether to build mermsemr_api as dynamic module */
|
||||
#define COMPILE_DL_MERMSEMR_API 1
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#define HAVE_DLFCN_H 1
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
/* #undef NO_MINUS_C_MINUS_O */
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT ""
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME ""
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING ""
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME ""
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION ""
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef __mx_creditcards_h__
|
||||
#define __mx_creditcards_h__
|
||||
|
||||
#include "vars.h"
|
||||
|
||||
long save_creditcard(CVars in, CVars &out);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
#ifndef __cvariables__
|
||||
#define __cvariables__
|
||||
|
||||
#include "stdarg.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#define MAX_CGI_VAR_LEN 50
|
||||
|
||||
typedef struct _L_Variables
|
||||
{
|
||||
char name[MAX_CGI_VAR_LEN+1];
|
||||
char * value;
|
||||
int opts; // options? used by some decendants
|
||||
struct _L_Variables * next;
|
||||
|
||||
} L_Variables;
|
||||
|
||||
|
||||
|
||||
class CVariables
|
||||
{
|
||||
public:
|
||||
friend class CGIList;
|
||||
|
||||
CVariables( );
|
||||
|
||||
~CVariables( );
|
||||
|
||||
void RenameVariable( const char * name, const char * newname );
|
||||
void LetInt16( char * var, const int value ); // Set the variable to an integer value
|
||||
void LetStr( const char * var, const char * value ); // Set the variable to a string value
|
||||
void LetStrf( char * var, const char * format, ... );
|
||||
void vLetStrf( char * var, const char * format, va_list ap );
|
||||
void LetStr( char * var, const char * value, int len );
|
||||
// Set the variable to a string value and truncate to len
|
||||
|
||||
void StrCat( char * var, const char * format, ... );
|
||||
void StrCatf( char * var, const char * format, ... );
|
||||
|
||||
char * GetVariable( const char * var ); // Obtain the variable value and return its temp location
|
||||
char * GetVariable( const char * var, char * result, int size );
|
||||
// Obtain the variable value and return it in 'result'
|
||||
char * GetVariable( const char * var, bool test, char * section = "" );
|
||||
long GetVariableLong( char * name, bool *valid = NULL );
|
||||
long GetVariableLong( char * name, bool test, char * section = "" );
|
||||
bool GetBool( char * var, bool test = false, char * section = "" );
|
||||
|
||||
void PrintVars( FILE * f = stdout ); // Print out all variables to file pointed to by 'f'
|
||||
|
||||
void Cleanup();
|
||||
|
||||
L_Variables * var, * var_top;
|
||||
|
||||
L_Variables * FindVariable( const char * var, bool create=false );
|
||||
// Obtains the next variable during the template parsing process
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef __EXCEPTIONS_H__
|
||||
#define __EXCEPTIONS_H__
|
||||
|
||||
#include "vars.h"
|
||||
|
||||
class bad_parameter{
|
||||
public:
|
||||
|
||||
bad_parameter( CVars &out, const char *name );
|
||||
};
|
||||
|
||||
class err : public std::exception
|
||||
{
|
||||
|
||||
public:
|
||||
err( char *msg );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef __mx_function_agents_h__
|
||||
#define __mx_function_agents_h__
|
||||
|
||||
#include "vars.h"
|
||||
|
||||
long medTrDeviceList(CVars in, CVars &out);
|
||||
long medTrCreateAgent(CVars in, CVars &out);
|
||||
long TranspLoginAdmin(CVars in, CVars &out);
|
||||
long TransporterSessionCheck(long uid, const char *sessionid, int create);
|
||||
long medTrTransporterTransportList(CVars in, CVars &out);
|
||||
long medTrLoadIntepreter(CVars in, CVars &out);
|
||||
long medTrCreateIntepreter(CVars in, CVars &out);
|
||||
long medTrCreateTransporter(CVars in, CVars &out);
|
||||
long medTrTransporterLocationtList(CVars in, CVars &out);
|
||||
long medTrTransporterTranslatortList(CVars in, CVars &out);
|
||||
long medTrUpdateItepreter(CVars in, CVars &out);
|
||||
long medTrLoadTransporter(CVars in, CVars &out);
|
||||
long medTrUpdateTransporter(CVars in, CVars &out);
|
||||
long medTrInterpreterLanguage(CVars in, CVars &out);
|
||||
long medTrInterpreterLangList(CVars in, CVars &out);
|
||||
void GenerateAgentFolder(unsigned long agent_id, char * number, int sz);
|
||||
long medTrAgentLangList(CVars in, CVars &out);
|
||||
long medAssignTranspoter(CVars in, CVars &out);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#ifndef __mx_function_backoffice_h__
|
||||
#define __mx_function_backoffice_h__
|
||||
|
||||
#include "vars.h"
|
||||
|
||||
long LoginBkoAdmin(CVars in, CVars &out);
|
||||
long createBkoAdmin(CVars in, CVars &out);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef __mx_function_cron_h__
|
||||
#define __mx_function_cron_h__
|
||||
|
||||
#include "vars.h"
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef __mx_function_driver_h__
|
||||
#define __mx_function_driver_h__
|
||||
|
||||
#include "vars.h"
|
||||
|
||||
long medTrDriverFunctions(CVars in, CVars &out);
|
||||
long medTrCreateDriver(CVars in, CVars &out);
|
||||
long medTrDriverList(CVars in, CVars &out);
|
||||
long medTrDriverUpdate(CVars in, CVars &out);
|
||||
long medTrLoadDriver(CVars in, CVars &out);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef __mx_function_invoice_h__
|
||||
#define __mx_function_invoice_h__
|
||||
|
||||
#include "vars.h"
|
||||
|
||||
long medTrInvoiceFunctions(CVars in, CVars &out);
|
||||
long medTrGetTransportInvoice(CVars in, CVars &out);
|
||||
long medTrGetMemberInvoice(CVars in, CVars &out);
|
||||
long getMemberInvoiceID( long transport_id );
|
||||
long medTrInvoice(CVars in, CVars &out);
|
||||
long medTSendInvoice(CVars in, CVars &out);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef __mx_function_members_h__
|
||||
#define __mx_function_members_h__
|
||||
|
||||
#include "vars.h"
|
||||
long DeletAallCards(CVars in, CVars &out);
|
||||
long medTMemberLogin(CVars in, CVars &out);
|
||||
long medTrCreateMember(CVars in, CVars &out);
|
||||
long medTrUpdateProfile(CVars in, CVars &out);
|
||||
long kleenNewLundryPickUp(CVars in, CVars &out);
|
||||
long SessionCheck(long uid, const char *sessionid, int create );
|
||||
long medTrUpdateStartProfile(CVars in, CVars &out);
|
||||
long getServiceDetail(long service_id, CVars &out);
|
||||
long medTrMemberTransportList(CVars in, CVars &out);
|
||||
long medTrMemberTransportById(CVars in, CVars &out);
|
||||
long medTrLanguageList(CVars in, CVars &out);
|
||||
long medTrMemberServiceById(CVars in, CVars &out);
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef __mx_function_users_h__
|
||||
#define __mx_function_users_h__
|
||||
|
||||
#include "vars.h"
|
||||
|
||||
long passwordReset(CVars in, CVars &out);
|
||||
long startPassReset(CVars in, CVars &out);
|
||||
long confirmPassReset(CVars in, CVars &out);
|
||||
long completePassReset(CVars in, CVars &out);
|
||||
long userDeleteCard(CVars in, CVars &out);
|
||||
long kleenDryCleanList(CVars in, CVars &out);
|
||||
long getUserCCList(CVars in, CVars &out);
|
||||
long manageUserCCList(CVars in, CVars &out);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
/*-
|
||||
* HMAC-SHA-224/256/384/512 implementation
|
||||
* Last update: 06/15/2005
|
||||
* Issue date: 06/15/2005
|
||||
*
|
||||
* Copyright (C) 2005 Olivier Gay <olivier.gay@a3.epfl.ch>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _HMAC_SHA2_H
|
||||
#define _HMAC_SHA2_H
|
||||
|
||||
#include "sha2.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
sha224_ctx ctx_inside;
|
||||
sha224_ctx ctx_outside;
|
||||
|
||||
/* for hmac_reinit */
|
||||
sha224_ctx ctx_inside_reinit;
|
||||
sha224_ctx ctx_outside_reinit;
|
||||
|
||||
unsigned char block_ipad[SHA224_BLOCK_SIZE];
|
||||
unsigned char block_opad[SHA224_BLOCK_SIZE];
|
||||
} hmac_sha224_ctx;
|
||||
|
||||
typedef struct {
|
||||
sha256_ctx ctx_inside;
|
||||
sha256_ctx ctx_outside;
|
||||
|
||||
/* for hmac_reinit */
|
||||
sha256_ctx ctx_inside_reinit;
|
||||
sha256_ctx ctx_outside_reinit;
|
||||
|
||||
unsigned char block_ipad[SHA256_BLOCK_SIZE];
|
||||
unsigned char block_opad[SHA256_BLOCK_SIZE];
|
||||
} hmac_sha256_ctx;
|
||||
|
||||
typedef struct {
|
||||
sha384_ctx ctx_inside;
|
||||
sha384_ctx ctx_outside;
|
||||
|
||||
/* for hmac_reinit */
|
||||
sha384_ctx ctx_inside_reinit;
|
||||
sha384_ctx ctx_outside_reinit;
|
||||
|
||||
unsigned char block_ipad[SHA384_BLOCK_SIZE];
|
||||
unsigned char block_opad[SHA384_BLOCK_SIZE];
|
||||
} hmac_sha384_ctx;
|
||||
|
||||
typedef struct {
|
||||
sha512_ctx ctx_inside;
|
||||
sha512_ctx ctx_outside;
|
||||
|
||||
/* for hmac_reinit */
|
||||
sha512_ctx ctx_inside_reinit;
|
||||
sha512_ctx ctx_outside_reinit;
|
||||
|
||||
unsigned char block_ipad[SHA512_BLOCK_SIZE];
|
||||
unsigned char block_opad[SHA512_BLOCK_SIZE];
|
||||
} hmac_sha512_ctx;
|
||||
|
||||
void hmac_sha224_init(hmac_sha224_ctx *ctx, unsigned char *key,
|
||||
unsigned int key_size);
|
||||
void hmac_sha224_reinit(hmac_sha224_ctx *ctx);
|
||||
void hmac_sha224_update(hmac_sha224_ctx *ctx, unsigned char *message,
|
||||
unsigned int message_len);
|
||||
void hmac_sha224_final(hmac_sha224_ctx *ctx, unsigned char *mac,
|
||||
unsigned int mac_size);
|
||||
void hmac_sha224(unsigned char *key, unsigned int key_size,
|
||||
unsigned char *message, unsigned int message_len,
|
||||
unsigned char *mac, unsigned mac_size);
|
||||
|
||||
void hmac_sha256_init(hmac_sha256_ctx *ctx, unsigned char *key,
|
||||
unsigned int key_size);
|
||||
void hmac_sha256_reinit(hmac_sha256_ctx *ctx);
|
||||
void hmac_sha256_update(hmac_sha256_ctx *ctx, unsigned char *message,
|
||||
unsigned int message_len);
|
||||
void hmac_sha256_final(hmac_sha256_ctx *ctx, unsigned char *mac,
|
||||
unsigned int mac_size);
|
||||
void hmac_sha256(unsigned char *key, unsigned int key_size,
|
||||
unsigned char *message, unsigned int message_len,
|
||||
unsigned char *mac, unsigned mac_size);
|
||||
|
||||
void hmac_sha384_init(hmac_sha384_ctx *ctx, unsigned char *key,
|
||||
unsigned int key_size);
|
||||
void hmac_sha384_reinit(hmac_sha384_ctx *ctx);
|
||||
void hmac_sha384_update(hmac_sha384_ctx *ctx, unsigned char *message,
|
||||
unsigned int message_len);
|
||||
void hmac_sha384_final(hmac_sha384_ctx *ctx, unsigned char *mac,
|
||||
unsigned int mac_size);
|
||||
void hmac_sha384(unsigned char *key, unsigned int key_size,
|
||||
unsigned char *message, unsigned int message_len,
|
||||
unsigned char *mac, unsigned mac_size);
|
||||
|
||||
void hmac_sha512_init(hmac_sha512_ctx *ctx, unsigned char *key,
|
||||
unsigned int key_size);
|
||||
void hmac_sha512_reinit(hmac_sha512_ctx *ctx);
|
||||
void hmac_sha512_update(hmac_sha512_ctx *ctx, unsigned char *message,
|
||||
unsigned int message_len);
|
||||
void hmac_sha512_final(hmac_sha512_ctx *ctx, unsigned char *mac,
|
||||
unsigned int mac_size);
|
||||
void hmac_sha512(unsigned char *key, unsigned int key_size,
|
||||
unsigned char *message, unsigned int message_len,
|
||||
unsigned char *mac, unsigned mac_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! _HMAC_SHA2_H */
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef __INPUT_H__
|
||||
#define __INPUT_H__
|
||||
|
||||
#include "vars.h"
|
||||
#include "exceptions.h"
|
||||
|
||||
void REQ_STRING( CVars &in, const char * name, int min_len, int max_len, const char *regex ) throw (bad_parameter);
|
||||
long REQ_LONG( CVars &in, const char *name, long min, long max );
|
||||
bool OptionalSpecified( CVars &in, const char * name );
|
||||
|
||||
#define OPTIONAL(mapname, var) \
|
||||
if ( OptionalSpecified(mapname,var) )
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef __storeface_list_h__
|
||||
#define __storeface_list_h__
|
||||
|
||||
typedef struct _list
|
||||
{
|
||||
char * text;
|
||||
struct _list * next;
|
||||
} TList;
|
||||
|
||||
|
||||
|
||||
void DestroyList( TList * top );
|
||||
|
||||
TList * Add( TList * list, char * text, long size );
|
||||
|
||||
TList * AddF( TList * list, char * format, ... );
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef __mx_medTEmails_h__
|
||||
#define __mx_medTEmails_h__
|
||||
|
||||
#include "vars.h"
|
||||
|
||||
long member_email_calls(long action, CVars in, CVars &out);
|
||||
long transporter_email_calls(long action, CVars in, CVars &out);
|
||||
long agent_email_calls(long action, CVars in, CVars &out);
|
||||
long cron_email_calls(long action, CVars in, CVars &out);
|
||||
long alert_email_calls(long action, CVars in, CVars &out);
|
||||
long email_test(CVars in, CVars &out);
|
||||
long provider_email_calls(long action, CVars in, CVars &out);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef __mx_medTUpload_h__
|
||||
#define __mx_medTUpload_h__
|
||||
|
||||
#include "vars.h"
|
||||
|
||||
long medtrans_upload(CVars in, CVars &out);
|
||||
long medtrans_download(CVars in, CVars &out);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef __mx_medTrBackOffice_h__
|
||||
#define __mx_medTrBackOffice_h__
|
||||
|
||||
#include "vars.h"
|
||||
|
||||
long backoffice_calls(CVars in, CVars &out);
|
||||
long cron_call(CVars in, CVars &out);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef __mx_medTrMembers_h__
|
||||
#define __mx_medTrMembers_h__
|
||||
|
||||
#include "vars.h"
|
||||
|
||||
long members_call(CVars in, CVars &out);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifndef __mx_medTrTransporter_h__
|
||||
#define __mx_medTrTransporter_h__
|
||||
|
||||
#include "vars.h"
|
||||
|
||||
long trasnporter_call(CVars in, CVars &out);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef MERMSEMR_API_MERMSEMR_H
|
||||
#define MERMSEMR_API_MERMSEMR_H
|
||||
|
||||
#include "vars.h"
|
||||
|
||||
// A very simple mermsemr class
|
||||
class MermsEmr {
|
||||
public:
|
||||
MermsEmr();
|
||||
~MermsEmr();
|
||||
long mermsemr_api(CVars in, CVars &out);
|
||||
const char* cfgReadChar(const char *parameter);
|
||||
long cfgReadLong(const char *parameter);
|
||||
void logMessage(const char *message);
|
||||
private:
|
||||
FILE* pFile;
|
||||
int db;
|
||||
};
|
||||
|
||||
#endif /* MERMSEMR_API_MERMSEMR_H */
|
||||
@@ -0,0 +1,459 @@
|
||||
#ifndef MERMSEMR_API_H
|
||||
#define MERMSEMR_API_H
|
||||
|
||||
enum {
|
||||
DIR_TARGET, DIR_SOURCE};
|
||||
|
||||
enum {
|
||||
FLAG_INIT, FLAG_START, FLAG_CANCEL, FLAG_FAIL, FLAG_OK
|
||||
};
|
||||
|
||||
enum {
|
||||
WHAT_NEW_CARDADD, WHAT_PICKUP_INITIALPAYMENT
|
||||
};
|
||||
|
||||
enum {
|
||||
PARTNER_STRIPE
|
||||
};
|
||||
|
||||
#define PHP_API_OK 0
|
||||
#define PHP_CREATED_OK 10
|
||||
#define PHP_LOGIN_OK 100
|
||||
#define PHP_API_BAD_PARAM -1
|
||||
#define PHP_VALID_SESSION 505
|
||||
#define PHP_INVALID_SESSION 777
|
||||
|
||||
#define MODE_ADD 100
|
||||
#define MODE_UPDATE 200
|
||||
#define MODE_DELETE 300
|
||||
#define MODE_LIST 400
|
||||
|
||||
#define NEW_CARD 0
|
||||
#define EXISTING_CARD 1
|
||||
#define ACH1 2
|
||||
#define ACH2 3
|
||||
#define BALANCE 4
|
||||
#define INSURANCE 5
|
||||
#define INVOICED 6
|
||||
|
||||
#define INVOICE_PREVIEW 100
|
||||
#define INVOICE_FINAL 200
|
||||
|
||||
#define TRNASPORTER 1
|
||||
#define TRANSLATOR 2
|
||||
|
||||
|
||||
#define MODE_CONFIRM_ASSIGNMENT 100
|
||||
#define MODE_REJECT_ASSIGNMENT 200
|
||||
#define MODE_CANCEL_ASSIGNMENT 210
|
||||
#define MODE_ACTIVATE_ASSIGNMENT 300
|
||||
#define MODE_COMPLETE_ASSIGNMENT 400
|
||||
|
||||
#define MODE_RELEASE_DRIVER_ASSIGNMENT 705
|
||||
|
||||
|
||||
|
||||
#define MEDTRANS_STRIPE_CHARGE_ONE 90004
|
||||
#define MEDTRANS_STRIPE_CHARGE_NEW 90005
|
||||
#define MEDTRANS_EMAIL_TEST 90006
|
||||
|
||||
#define MEDTRANS_PROCESS_PAYMENT 90011
|
||||
|
||||
#define MEDTRANS_UPLOADS 4505
|
||||
#define MEDTRANS_DOWNLOAD 4506
|
||||
|
||||
// MEDTRANS BACK OFFICE FUNCTION*****************
|
||||
#define MEDTRANS_BKO_START 100000
|
||||
#define MEDTRANS_BKO_LOGIN 100005
|
||||
#define MEDTRANS_BKO_CREATEUSER 100010
|
||||
#define MEDTRANS_BKO_EDITUSER 100011
|
||||
#define MEDTRANS_BKO_UPDATEMEMBER 100012
|
||||
#define MEDTRANS_BKO_ADDREASON 100020
|
||||
#define MERMSEMR_BKO_DELETEALLCARDS 100022
|
||||
#define MERMSEMR_BKO_ADDCARD 100028
|
||||
#define MEDTRANS_BKO_LANGUAGE_STATUS 100030
|
||||
|
||||
|
||||
|
||||
#define MEDTRANS_BKO_CONFIG_USER_TRANSPORT_PRICING 100100
|
||||
#define MEDTRANS_BKO_CONFIG_USER_TRANSLATOR_PRICING 100101
|
||||
#define MEDTRANS_BKO_CONFIG_USER_CONCIERGE_PRICING 100102
|
||||
#define MEDTRANS_BKO_CONFIG_AGENT_TRANSPORT_PRICING 100103
|
||||
#define MEDTRANS_BKO_CONFIG_AGENT_TRANSLATOR_PRICING 100104
|
||||
#define MEDTRANS_BKO_CONFIG_AGENT_CONCIERGE_PRICING 100105
|
||||
|
||||
#define MEDTRANS_BKO_END 199999
|
||||
// MEDTRANS USER FUNCTIONS***********************
|
||||
#define MEDTRANS_USER_START 200000
|
||||
|
||||
#define MERMSEMR_USER_DRYCLIST 200002
|
||||
#define MEDTRANS_USER_LOGIN 200005 // LOGIN USER
|
||||
#define MEDTRANS_USER_VERIFYSESSION 200007 // VERIFY SESSION
|
||||
|
||||
#define MEDTRANS_USER_CREATE 200010 // CREATE NEW USER
|
||||
#define MERMSEMR_USER_COMPLETEPROFILE 200013 // Required profile update
|
||||
|
||||
#define MEDTRANS_USER_UPDATE 200015 // UPDATING USER PROFILE
|
||||
#define MEDTRANS_USER_PROFILE 200020 // THIS CREATES THE ADDRESS ENTRY
|
||||
#define MERMSEMR_USER_SAVECARDPAYMENT 200021
|
||||
#define MERMSEMR_USER_GETCCLIST 200022
|
||||
|
||||
#define MEDTRANS_USER_NEWLUNDRYPICK 200025 // REQUEST TRANSPORT
|
||||
|
||||
#define MEDTRANS_USER_GET_TRAN_BYID 200030 // REQUEST TRANSPORT BY ID
|
||||
#define MERMSEMR_USER_GETSERVICELIST 200035 // REQUEST TRANSPORT LIST
|
||||
#define MEDTRANS_USER_LUNDRYLOCATION 200040
|
||||
|
||||
#define MEDTRANS_USER_GET_TRANSLLIST 200045 // REQUEST TRANSLATION LIST
|
||||
|
||||
#define MEDTRANS_USER_SENDINVOICE 200059
|
||||
#define MEDTRANS_USER_GET_INVOICE 200060
|
||||
#define MEDTRANS_USER_GETINVOICE 200063
|
||||
|
||||
#define MERMSEMR_USER_CONFIRMPICKUP 200064
|
||||
|
||||
#define MERMSEMR_USER_GETSERVICEITEM 200065
|
||||
#define MEDTRANS_USER_GETCCLIST 200066
|
||||
//#define MEDTRANS_USER_START_PASSRESET 200067
|
||||
//#define MEDTRANS_USER_CONFIRM_RESET 200068
|
||||
//#define MEDTRANS_USER_COMPLETE_PASSRESET 200069
|
||||
|
||||
#define MEDTRANS_USER_PASSRESET 200067
|
||||
|
||||
#define MERMSEMR_USER_DELETECARD 200075
|
||||
|
||||
|
||||
#define RESET_START 100
|
||||
#define RESET_CONFIRM 200
|
||||
#define RESET_COMPLETE 300
|
||||
|
||||
|
||||
|
||||
#define MEDTRANS_USER_END 299999
|
||||
// MEDTRANS INTERPRETERS ***************************
|
||||
#define MEDTRANS_INTERP_START 300000
|
||||
|
||||
|
||||
|
||||
#define MEDTRANS_INTERP_END 399999
|
||||
// MEDTRANS TRANLATORS ***************************
|
||||
#define MEDTRANS_TRANSP_START 400000
|
||||
|
||||
#define MEDTRANS_TRANSP_LOGIN 400005
|
||||
#define MEDTRANS_LOAD_AGENT 400006
|
||||
|
||||
#define MEDTRANS_TRANSP_VERIFYSESSION 400007
|
||||
|
||||
#define MEDTRANS_TRANSP_CREATE 400010
|
||||
#define MEDTRANS_TRANSP_ADDLOCATION 400020
|
||||
#define MEDTRANS_TRANSP_LISTLOCATION 400021
|
||||
#define MEDTRANS_TRANSP_EDITLOCATION 400022
|
||||
|
||||
#define MEDTRANS_TRANSP_AGENTPROFILE 400024
|
||||
|
||||
#define MEDTRANS_TRANSP_ADDDEVICE 400030
|
||||
|
||||
#define MEDTRANS_TRANSP_GET_TRANSLIST 400040
|
||||
#define MEDTRANS_TRANSP_GET_TRANSPORTER 400041
|
||||
#define MEDTRANS_TRANSP_SET_TRANSSTATUS 400042
|
||||
|
||||
#define MEDTRANS_TRANSP_GETREASON 400043
|
||||
|
||||
#define MEDTRANS_TRANSP_GET_TRANSLATOR 400044
|
||||
#define MEDTRANS_TRANSP_ADD_TRANSLATOR 400045
|
||||
#define MEDTRANS_TRANSP_LIST_TRANSLATOR 400046
|
||||
#define MEDTRANS_TRANSP_EDIT_TRANSLATOR 400047
|
||||
#define MEDTRANS_TRANSP_MANAGELANGUAGE 400049
|
||||
#define MEDTRANS_TRANSP_LANGUAGELIST 400050
|
||||
|
||||
|
||||
|
||||
#define MEDTRANS_TRANSP_AGENTLANGUAGE 400051 // LANGUAGE SUPPORTED BY AGENT
|
||||
#define MEDTRANS_TRANSP_GET_TRANSLATORLIST 400052
|
||||
|
||||
#define MEDTRANS_TRANSL_SET_TRANSSTATUS 400055
|
||||
|
||||
#define MEDTRANS_TRANSP_DRIVERSCALL 400060
|
||||
#define MEDTRANS_TRANSP_GETINVOICE 400070
|
||||
|
||||
|
||||
#define MEDTRANS_TRANSP_DEVICELIST 405000
|
||||
|
||||
#define TRANSPORT_ASSIGN 100
|
||||
#define TRANSLATE_ASSIGN 200
|
||||
|
||||
|
||||
#define PENDING 0
|
||||
|
||||
#define CONFIRMED 2
|
||||
#define CANCELLED 3
|
||||
|
||||
#define ASSIGNED 4
|
||||
|
||||
#define INPROGRESS 7 // 8,9
|
||||
|
||||
|
||||
#define COMPLETED 5
|
||||
#define SETTLED 9
|
||||
|
||||
|
||||
#define MEDTRANS_TRANSP_ASSIGNTRANSPORT 400080
|
||||
#define MEDTRANS_TRANSP_ASSIGNTRANSLATOR 400085
|
||||
|
||||
#define MEDTRANS_TRANSP_CANCELTRANSLATION 470000
|
||||
|
||||
|
||||
|
||||
#define MEDTRANS_TRANSL_ASSIGNFAIL 490001
|
||||
|
||||
|
||||
#define MEDTRANS_TRANSP_END 499999
|
||||
//***********************************************
|
||||
#define MEDTRANS_PROVIDER_START 500000
|
||||
|
||||
#define MEDTRANS_PROVIDER_CREATE 500010
|
||||
#define MEDTRANS_PROVIDER_LOGIN 500020
|
||||
#define MEDTRANS_PROVIDER_VERIFYSESSION 500021
|
||||
|
||||
#define MEDTRANS_PROVIDER_PROVISION 500022
|
||||
#define MEDTRANS_PROVIDER_SETSTATUS 500023
|
||||
|
||||
#define MEDTRANS_PROVIDER_RESETPASS 500025
|
||||
|
||||
#define MEDTRANS_PROVIDER_PROFILE 500027
|
||||
#define MEDTRANS_PROVIDER_UPDATEPROFILE 500028
|
||||
|
||||
#define MEDTRANS_PROVIDER_TANSPORTLIST 500060
|
||||
#define MEDTRANS_PROVIDER_TRANSLATEIST 500065
|
||||
|
||||
#define MEDTRANS_PROVIDER_END 599999
|
||||
|
||||
//status options
|
||||
#define PROVIDER_DECLINE 3
|
||||
#define PROVIDER_CONFIRM 4
|
||||
#define PROVIDER_COMPLETED 5
|
||||
#define PROVIDER_STARTED 6
|
||||
|
||||
// MEDTRANS CRONS ***************************
|
||||
#define MEDTRANS_CRON_START 900000
|
||||
|
||||
#define CRON_USER_REMINDER 900001
|
||||
#define CRON_TRANSPORTER_REMINDER 900002
|
||||
#define CRON_INTERPRETER_REMINDER 900003
|
||||
#define CRON_PROCESS_DISTANCE 900501
|
||||
|
||||
#define CRON_PROCESS_AUTOASSIGN 900510
|
||||
|
||||
|
||||
#define MEDTRANS_CRON_END 999999
|
||||
|
||||
|
||||
|
||||
|
||||
#define PAYMENT_MODE 100
|
||||
#define REFUND_MODE 333
|
||||
|
||||
#define OFFER_ACCEPT 100
|
||||
#define OFFER_REJECT 333
|
||||
#define OFFER_CANCEL 222
|
||||
|
||||
#define CONTRACT_NOTIFY_COMPLETE 4
|
||||
#define CONTRACT_REQUEST_CANCEL 3
|
||||
#define CONTRACT_ACCEPT_COMPLETE 5
|
||||
#define CONTRACT_REJECT_COMPLETE 1
|
||||
|
||||
#define SM_PENDING 1
|
||||
#define SM_CANCEL 3
|
||||
#define SM_FAILED 4
|
||||
#define SM_COMPLETED 5
|
||||
|
||||
|
||||
// define email series here
|
||||
#define ACCOUNT_CREATED_MAIL 100
|
||||
#define ACCOUNT_CREATED_ALERT 101
|
||||
#define ACCOUNT_CONTACT_MAIL 102
|
||||
#define ACCOUNT_CONTACT_ALERT 103
|
||||
#define ACCOUNT_PASSWORD_RESET 104
|
||||
#define ACCOUNT_LOGIN_ALERT 105
|
||||
#define ACCOUNT_RESEND_PENDING 106
|
||||
|
||||
|
||||
|
||||
#define ACCOUNT_SENDMONEY_ALERT 120
|
||||
#define ACCOUNT_START_SENDMONEY 121
|
||||
#define ACCOUNT_COMPLETE_SENDMONEY 122
|
||||
|
||||
|
||||
#define JOBS_CREATED_MAIL 200
|
||||
#define JOBS_INDIVIDUAL_OFFER_MAIL 201
|
||||
#define JOBS_GROUP_OFFER_MAIL 202
|
||||
#define JOBS_MESSAGE_ADDED 203
|
||||
|
||||
#define JOBS_OFFER_ACCEPT_MAIL 207
|
||||
#define JOBS_OFFER_REJECT_MAIL 208
|
||||
#define JOBS_OFFER_CANCEL_MAIL 209
|
||||
|
||||
|
||||
//#define JOBS_CREATED_MAIL 202
|
||||
//#define JOBS_CREATED_MAIL 203
|
||||
|
||||
|
||||
#define PROJ_CREATED_MAIL 300
|
||||
//#define PROJ_CREATED_MAIL 301
|
||||
//#define PROJ_CREATED_MAIL 302
|
||||
//#define PROJ_CREATED_MAIL 303
|
||||
|
||||
|
||||
|
||||
//========================
|
||||
|
||||
|
||||
#define MERMSEMR_SESSION_CHECK 299
|
||||
#define MERMSEMR_USER_LOGIN 300
|
||||
#define MERMSEMR_USER_LOGOUT 301
|
||||
#define MERMSEMR_CREATE_ACCOUNT 320
|
||||
|
||||
//**************************************************************
|
||||
#define MERMSEMR_BKO_START 10000
|
||||
|
||||
#define MERMSEMR_BKO_LOGIN 10010
|
||||
#define MERMSEMR_BKO_CREATEUSER 10015
|
||||
#define MERMSEMR_BKO_UPDATEUSER 10020
|
||||
|
||||
|
||||
#define MERMSEMR_BKO_MEMBERADD 100025
|
||||
#define MERMSEMR_BKO_MEMBERUPDT 100026
|
||||
|
||||
#define MERMSEMR_BKO_END 10999
|
||||
//**************************************************************
|
||||
#define MERMSEMR_ACCOUNT_START 11000
|
||||
|
||||
#define MERMSEMR_ACCOUNT_TESTEMAIL 11001
|
||||
#define MERMSEMR_ACCOUNT_PENDING 11010
|
||||
#define MERMSEMR_VERIFY_PENDING_LINK 11015
|
||||
#define MERMSEMR_ACCOUNT_RESETPASS 11016
|
||||
|
||||
#define MERMSEMR_DELETE_PENDING_LINK 11018
|
||||
#define MERMSEMR_RESEND_PENDING_LINK 11019
|
||||
|
||||
#define MERMSEMR_ACCOUNT_CREATEACC 11020
|
||||
#define MERMSEMR_ACCOUNT_LOGIN 11025
|
||||
#define MERMSEMR_FACEBOOK_LOGIN 11026
|
||||
#define MERMSEMR_SEND_CONTACTUS 11030
|
||||
#define MERMSEMR_LOG_MEMBER 11040
|
||||
|
||||
|
||||
#define MERMSEMR_ACCOUNT_END 11999
|
||||
//**************************************************************
|
||||
#define MERMSEMR_GROUP_START 12000
|
||||
|
||||
#define MERMSEMR_GROUP_CREATEGROUP 12010
|
||||
#define MERMSEMR_GROUP_INVITEGROUP 12015
|
||||
#define MERMSEMR_GROUP_ACCEPTGROUP 12020
|
||||
|
||||
#define MERMSEMR_GROUP_END 12999
|
||||
//**************************************************************
|
||||
#define MERMSEMR_JOBS_START 13000
|
||||
|
||||
#define MERMSEMR_JOB_CREATEJOB 13010
|
||||
|
||||
#define MERMSEMR_JOB_GROUP_MEMBER 13015
|
||||
#define MERMSEMR_JOB_DELETE_GROUPMEMBER 13017
|
||||
|
||||
#define MERMSEMR_JOB_CREATE_GROUP 13020
|
||||
#define MERMSEMR_JOB_DELETE_GROUP 13023
|
||||
|
||||
|
||||
#define MERMSEMR_JOB_OFFER_INDVI 13030
|
||||
#define MERMSEMR_JOB_OFFER_GROUP 13031
|
||||
|
||||
#define MERMSEMR_JOB_OFFER_CONCLUDE 13035
|
||||
|
||||
|
||||
#define MERMSEMR_JOBS_END 13999
|
||||
//**************************************************************
|
||||
#define MERMSEMR_CONTRACT_START 14000
|
||||
|
||||
#define MERMSEMR_CONTRACT_MESSAGE 14010
|
||||
#define MERMSEMR_CONTRACT_STATUS 14015
|
||||
#define MERMSEMR_CONTRACT_END 14999
|
||||
//**************************************************************
|
||||
|
||||
#define MERMSEMR_SMONEY_START 33000
|
||||
|
||||
#define MERMSEMR_SMONEY_ADDRECIPIENT 33010
|
||||
#define MERMSEMR_SMONEY_MEMBER 33020
|
||||
#define MERMSEMR_SMONEY_PROCFEE 33025
|
||||
|
||||
#define MERMSEMR_SMONEY_END 33999
|
||||
//**************************************************************
|
||||
|
||||
|
||||
|
||||
#define MERMSEMR_LOGIN_SHOP 50501
|
||||
#define MERMSEMR_LOGIN_ADMIN 50502
|
||||
#define MERMSEMR_LOGIN_MANAGER 50503
|
||||
|
||||
#define MERMSEMR_SURVEY_DATA 55000
|
||||
#define MERMSEMR_ADD_SURVEY 55050
|
||||
#define MERMSEMR_LOAD_SURVEY 55055
|
||||
|
||||
|
||||
#define MERMSEMR_COMPLETE_SENDMONEY_INTERSW 555
|
||||
#define MERMSEMR_GETBILLER_INTERSW 556
|
||||
#define MERMSEMR_BILL_PAYMENT_ADVICE_INTERSW 557
|
||||
|
||||
#define MERMSEMR_INTERSW_GETBILLER 556
|
||||
#define MERMSEMR_INTERSW_BILL_PAYMENT_ADVICE 557
|
||||
#define MERMSEMR_INTERSW_GETBILLERPAYMENTINTEMS 558
|
||||
#define MERMSEMR_INTERSW_GETBILLERCATEGORIES 559
|
||||
#define MERMSEMR_INTERSW_DO_TRANSFER 560
|
||||
#define MERMSEMR_INTERSW_QUERY_TRANSACTION 561
|
||||
|
||||
#define MERMSEMR_ADD_MONEYRECIPIENT 600
|
||||
|
||||
#define MERMSEMR_CREATE_USER_ACCOUNT 700
|
||||
#define MERMSEMR_USER_ACCOUNT_LOGIN 710
|
||||
#define MERMSEMR_START_PASSWORDRESET 720
|
||||
#define MERMSEMR_COMPLETE_PASSWORDRESET 730
|
||||
|
||||
#define MERMSEMR_START_ADDMONEY 770
|
||||
#define MERMSEMR_COMPLETE_ADDMONEY 775
|
||||
|
||||
#define MERMSEMR_ADD_MOBILE_TOPUPNUM 900
|
||||
#define MERMSEMR_PROMO_CALL 990
|
||||
|
||||
|
||||
#define MERMSEMR_STOREFACE_GET_ACCOUNT_BALANCE 891
|
||||
|
||||
#define MERMSEMR_LOG_ENTRY 900000
|
||||
#define MERMSEMR_CREDIT_TOPUP 900010
|
||||
|
||||
|
||||
|
||||
#define MERMSEMR_TOPUP_ORDER 900020
|
||||
#define MERMSEMR_TOPUP_ORDER_PURCHASE 900030
|
||||
#define MERMSEMR_PAYPAL_IPNMSG 900090
|
||||
|
||||
|
||||
|
||||
#define MERMSEMR_BULKTOPUP_ORDER 700010
|
||||
#define MERMSEMR_BULKTOPUP_ITEM 700020
|
||||
#define MERMSEMR_BULKTOPUP_ITEMUPDATE 700030
|
||||
#define MERMSEMR_BULKTOPUP_DELIVER 700040
|
||||
|
||||
|
||||
#define MERMSEMR_BALANCE_TOPUP_ORDER 800020
|
||||
#define MERMSEMR_BALANCE_TOPUP_PURCHASE 800030
|
||||
#define MERMSEMR_BALANCE_TOPUP_PAYMENT 800040
|
||||
|
||||
#define VIRTUAL_AIRTOPUP 70011
|
||||
|
||||
#define PAY_MODE_BALANCE 0
|
||||
#define PAY_MODE_CCARD 1
|
||||
#define PAY_MODE_BONUS 9
|
||||
|
||||
#define APPROVED_BALANCE 5
|
||||
#define DISAPROVE_BALANCE 3
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef MERMSEMR_API_MAIN_H
|
||||
#define MERMSEMR_API_MAIN_H
|
||||
|
||||
#include "vars.h"
|
||||
|
||||
long mermsemr_api_main(CVars in, CVars &out);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef __mx_payments_h__
|
||||
#define __mx_payments_h__
|
||||
|
||||
#include "vars.h"
|
||||
|
||||
|
||||
typedef enum { TT_DEPOSIT, TT_REVERSAL, TT_AUTH, TT_CAPTURE, TT_VOID, TT_VBV_ENROLL,TT_PARES_AUTH, TT_FORCE, TT_VERIFY_ONLY,TT_RECUR_ACTIVATE,TT_RECUR_SUSPEND,TT_RECUR_DELETE,TT_UNKNOWN} ETType;
|
||||
|
||||
enum { TD_F_OK, TD_F_REVERSED, TD_F_CANCELLED, TD_F_ERROR };
|
||||
|
||||
#define TD_F_VOIDED TD_F_CANCELLED
|
||||
|
||||
enum { WHAT_PAYMENT, WHAT_RECHARGE, WHAT_BILLCANCEL, WHAT_PURCHASE, WHAT_BALANCE_PAYMENT, WHAT_SMS_PAYMENT, WHAT_DONATION_PAYMENT, WHAT_SM_BALANCE, WHAT_SM_NEWCARD, WHAT_SM_EXISTCARD, WHAT_BANK_DEPOSIT ,WHAT_TOPUP_BALANCE,WHAT_DIR_TOPUP_CC, WHAT_DIR_TOPUP_BAL };
|
||||
|
||||
extern char * WHATs[];
|
||||
|
||||
enum { CORE_INIT_O, CORE_SRC_SENT, CORE_SRC_RET, CORE_DEST_SENT, CORE_DEST_RET, CORE_DONE,CORE_INIT, CORE_PENDING_PHONE_VERIFICATION, CORE_FAILED_VERIFICATION };
|
||||
|
||||
enum { CORE_F_INIT_O, CORE_F_OK, CORE_F_ERROR, CORE_F_CANCELLED, CORE_F_FRAUD_CANCELLED,CORE_F_INIT, CORE_F_PENDING_VERIFICATION, CORE_F_AUTHOURIZED };
|
||||
|
||||
|
||||
long medTVerifyPaymentType(CVars in, CVars &out);
|
||||
long medTConductInitialPayment(CVars in, CVars &out);
|
||||
long kleenConfirmPickup(CVars in, CVars &out);
|
||||
void Confirmation( unsigned long payment_id, char * number, int sz );
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef __PGSQL_H__
|
||||
#define __PGSQL_H__
|
||||
|
||||
#include <libpq-fe.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int pgsql_db_connect(const char*host,const char*name,const char*user,const char*pass,long port);
|
||||
int pgsql_exec(const char * format, ... );
|
||||
const PGresult* pgsql_query(const char * format, ... );
|
||||
int pgsql_num_rows(const PGresult *res);
|
||||
int pgsql_num_fields(const PGresult *res);
|
||||
map<const char*,const char*> pgsql_fetch_assoc(const PGresult *res, int row);
|
||||
vector<const char*> pgsql_fetch_row(const PGresult *res, int row);
|
||||
void pgsql_close();
|
||||
char* pgsql_uitoa(unsigned n, char *s, int radix);
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
vi:ts=2
|
||||
*/
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifndef __PGSQL_WRAPPER_H__
|
||||
#define __PGSQL_WRAPPER_H__
|
||||
|
||||
#include "exceptions.h"
|
||||
|
||||
enum { DBS_ALL=0, DBS_VALID=1, DBS_STREAM=2 };
|
||||
|
||||
class CEscape;
|
||||
|
||||
#define NEED_ESC CEscape __esc( cmd );
|
||||
#define esc( param ) __esc.Escape( param )
|
||||
|
||||
#define ESCAPE_MAX_VARS 50
|
||||
|
||||
void map_to_cvars(map<const char *,const char *>f, CVars &rec);
|
||||
void load_db_record( const char * table, CVars &rec, const char * where, ... );
|
||||
long load_db_record( CVars &rec, const char * query, ... );
|
||||
long insert_db_record( int mode, const char *table, const char *seq, CVars &rec );
|
||||
void update_db_record( int mode, const char * table, CVars &rec, long id, const char * where=NULL, ... ) throw ( bad_parameter );
|
||||
void v_update_db_record( int mode, const char * table, CVars &rec, const char *index, long id, const char * where=NULL, va_list ap=NULL ) throw ( bad_parameter );
|
||||
void update_db_record( int mode, const char * table, CVars &rec, const char *index, long id, const char * where=NULL, ... ) throw ( bad_parameter );
|
||||
long curr_val( const char *seq );
|
||||
|
||||
class CEscape
|
||||
{
|
||||
public:
|
||||
char * New( int sz );
|
||||
CEscape( char * st );
|
||||
~CEscape();
|
||||
char * Escape( const char * param );
|
||||
|
||||
private:
|
||||
char * vars[ESCAPE_MAX_VARS];
|
||||
int n;
|
||||
char * st;
|
||||
char esc[1000];
|
||||
int EscapeLength( const char * par ); // Calculate the required buffer size for escaped par
|
||||
char *EscapeReal( const char * cmd, char * _esc=NULL, int sz=0 ); // Escape a string for SQL server
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
#define FILELOG_MAX_LEVEL 9
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef PHP_MERMSEMR_API_SAMEYE_H
|
||||
#define PHP_MERMSEMR_API_SAMEYE_H
|
||||
|
||||
#define PHP_MERMSEMR_API_SAMEYE_EXTNAME "mermsemr_api_sameye"
|
||||
#define PHP_MERMSEMR_API_SAMEYE_EXTVER "0.1"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
#include "php.h"
|
||||
}
|
||||
|
||||
extern zend_module_entry mermsemr_api_sameye_module_entry;
|
||||
#define mermsemr_api_sameye_module_ptr &mermsemr_api_sameye_module_entry
|
||||
#define phpext_mermsemr_api_sameye_ptr mermsemr_api_sameye_module_ptr
|
||||
|
||||
#endif /* PHP_MERMSEMR_API_SAMEYE_H */
|
||||
@@ -0,0 +1 @@
|
||||
#define MERMSEMR_API_SAMEYE_NS "mermsemr_api_sameye"
|
||||
@@ -0,0 +1 @@
|
||||
#define MERMSEMR_API_SAMEYE_NS "mermsemr_api_sameye"
|
||||
@@ -0,0 +1 @@
|
||||
#define MERMSEMR_CONFIG "/home/sameye/mermsemr/mermsemr/etc/"
|
||||
@@ -0,0 +1 @@
|
||||
#define MERMSEMR_LOG "/home/sameye/mermsemr/mermsemr/logs/mermsemr_api_sameye.log"
|
||||
@@ -0,0 +1 @@
|
||||
#define TMPL_PREFIX "/home/sameye/mermsemr/mermsemr/email/"
|
||||
@@ -0,0 +1,49 @@
|
||||
|
||||
#ifndef __safestr_lib
|
||||
#define __safestr_lib
|
||||
#include "config.h"
|
||||
|
||||
#define SAFESTRING_COMMON_BUFFER_SIZE 1024
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
char * strsafecpy( char * dest, const char * src, int size );
|
||||
|
||||
char * strnsafecpy( char * dest, const char * src, int n, int size );
|
||||
|
||||
char * strsafecat( char * dest, const char * src, int size );
|
||||
|
||||
char * strcatf( char * dest, int size, const char * fmt, ... );
|
||||
|
||||
char * strnsafecat( char * dest, const char * src, int n, int size );
|
||||
// Append first n characters of src to dest
|
||||
|
||||
char * last_line( char * buf ); // find the last line and return the pointer to its beginning
|
||||
|
||||
char * safestrdup( const char *s );
|
||||
|
||||
char * strreverse( char *s );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
char * toupper( char * s, char * dest=0, int sz=0 );
|
||||
char * tolower( char * s, char * dest=0, int sz=0 );
|
||||
|
||||
char * toupper( const char * s, char * dest, int sz );
|
||||
char * tolower( const char * s, char * dest, int sz );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//int GetParam(char * params, char _name[], char value[], int valuelen, char ** end = 0 );
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* FIPS 180-2 SHA-224/256/384/512 implementation
|
||||
* Last update: 02/02/2007
|
||||
* Issue date: 04/30/2005
|
||||
*
|
||||
* Copyright (C) 2005, 2007 Olivier Gay <olivier.gay@a3.epfl.ch>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef SHA2_H
|
||||
#define SHA2_H
|
||||
|
||||
#define SHA224_DIGEST_SIZE ( 224 / 8)
|
||||
#define SHA256_DIGEST_SIZE ( 256 / 8)
|
||||
#define SHA384_DIGEST_SIZE ( 384 / 8)
|
||||
#define SHA512_DIGEST_SIZE ( 512 / 8)
|
||||
|
||||
#define SHA256_BLOCK_SIZE ( 512 / 8)
|
||||
#define SHA512_BLOCK_SIZE (1024 / 8)
|
||||
#define SHA384_BLOCK_SIZE SHA512_BLOCK_SIZE
|
||||
#define SHA224_BLOCK_SIZE SHA256_BLOCK_SIZE
|
||||
|
||||
#ifndef SHA2_TYPES
|
||||
#define SHA2_TYPES
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned int uint32;
|
||||
typedef unsigned long long uint64;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
unsigned int tot_len;
|
||||
unsigned int len;
|
||||
unsigned char block[2 * SHA256_BLOCK_SIZE];
|
||||
uint32 h[8];
|
||||
} sha256_ctx;
|
||||
|
||||
typedef struct {
|
||||
unsigned int tot_len;
|
||||
unsigned int len;
|
||||
unsigned char block[2 * SHA512_BLOCK_SIZE];
|
||||
uint64 h[8];
|
||||
} sha512_ctx;
|
||||
|
||||
typedef sha512_ctx sha384_ctx;
|
||||
typedef sha256_ctx sha224_ctx;
|
||||
|
||||
void sha224_init(sha224_ctx *ctx);
|
||||
void sha224_update(sha224_ctx *ctx, const unsigned char *message,
|
||||
unsigned int len);
|
||||
void sha224_final(sha224_ctx *ctx, unsigned char *digest);
|
||||
void sha224(const unsigned char *message, unsigned int len,
|
||||
unsigned char *digest);
|
||||
|
||||
void sha256_init(sha256_ctx * ctx);
|
||||
void sha256_update(sha256_ctx *ctx, const unsigned char *message,
|
||||
unsigned int len);
|
||||
void sha256_final(sha256_ctx *ctx, unsigned char *digest);
|
||||
void sha256(const unsigned char *message, unsigned int len,
|
||||
unsigned char *digest);
|
||||
|
||||
void sha384_init(sha384_ctx *ctx);
|
||||
void sha384_update(sha384_ctx *ctx, const unsigned char *message,
|
||||
unsigned int len);
|
||||
void sha384_final(sha384_ctx *ctx, unsigned char *digest);
|
||||
void sha384(const unsigned char *message, unsigned int len,
|
||||
unsigned char *digest);
|
||||
|
||||
void sha512_init(sha512_ctx *ctx);
|
||||
void sha512_update(sha512_ctx *ctx, const unsigned char *message,
|
||||
unsigned int len);
|
||||
void sha512_final(sha512_ctx *ctx, unsigned char *digest);
|
||||
void sha512(const unsigned char *message, unsigned int len,
|
||||
unsigned char *digest);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !SHA2_H */
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef __SHA512_H__
|
||||
#define __SHA512_H__
|
||||
|
||||
#include<string>
|
||||
using namespace std;
|
||||
|
||||
string hash_sha512_cpp(string msg_arr);
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef __smtp_lib
|
||||
#define __smtp_lib
|
||||
|
||||
#include "php_tmpl_prefix.h"
|
||||
|
||||
#define EMAIL_PREFIX TMPL_PREFIX
|
||||
|
||||
int SMTP2( const char * _server, const char * _from, char * _to, char * _body, const char * _domain, const char * _user, const char * _pass, const char * _name);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef __STRIPE_H__
|
||||
#define __STRIPE_H__
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
void remove_all_chars(char* str, char c);
|
||||
long stripe_tokenize_card(const char *key, const char *ccnum, const char *ccexpm, const char *ccexpy, const char *cccvc, char *token, size_t token_size);
|
||||
long stripe_get_all_cards(const char *key, char *customer, vector <string> *ccids, vector <string> *ccdigits, vector <string> *ccexpm, vector <string> *ccexpy);
|
||||
long stripe_get_card(const char *key, char *customer, const char *ccdigits, const char *ccexpm, const char *ccexpy, char *card, size_t card_size);
|
||||
long stripe_create_card(const char *key, char *customer, char *token, char *card, size_t card_size);
|
||||
long stripe_charge_token(const char *key, char *token, int amount, const char *currency, const char *description, const char *metadata, char *id, size_t id_size);
|
||||
long stripe_create_customer(const char *key, char *token, const char *email, const char *description, const char *metadata, char *id, size_t id_size);
|
||||
long stripe_charge_customer(const char *key, char *customer, int amount, const char *currency, const char *description, const char *metadata, char *id, size_t id_size);
|
||||
long stripe_update_customer(const char *key, char *customer, const char *entity, const char *entity_value, const char *result, char *data, size_t data_size);
|
||||
long stripe_charge_real(const char *key, const char *entity_name, char *entity, int amount, const char *currency, const char *description, const char *metadata, char *id, size_t id_size);
|
||||
string stripe_get_card_type(const char *card);
|
||||
|
||||
/*
|
||||
* https://stripe.com/docs/api/curl#create_card
|
||||
* https://stripe.com/docs/testing#cards
|
||||
* https://dashboard.stripe.com
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef __stripe_charge_h__
|
||||
#define __stripe_charge_h__
|
||||
|
||||
#include "vars.h"
|
||||
|
||||
long stripe_save_card(CVars in, CVars &out);
|
||||
long stripe_one_time_charge(CVars in, CVars &out);
|
||||
long stripe_new_customer_charge(CVars in, CVars &out);
|
||||
long stripe_charge_member(CVars in, CVars &out);
|
||||
long stripe_charge_member_paymentid(CVars in, CVars &out);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef __timer_h__
|
||||
#define __timer_h__
|
||||
|
||||
|
||||
class CTimer
|
||||
{
|
||||
public:
|
||||
CTimer( );
|
||||
|
||||
void init();
|
||||
bool timeout( unsigned long t );
|
||||
void wake( unsigned long );
|
||||
unsigned long elapsed( );
|
||||
|
||||
private:
|
||||
unsigned long prev;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef __UTIL_H__
|
||||
#define __UTIL_H__
|
||||
|
||||
bool reg_match( const char * input, const char * regexp, char * ret=NULL, int sz=0, int * pos = NULL );
|
||||
//char * urlencode(const char * buf); // Encode a string using URL-encoding
|
||||
char * urlencode(const char * buf, char *, int ); // Encode a string using URL-encoding
|
||||
//char * urldecode( char * buf); // Decode a string using URL-encoding
|
||||
char * urldecode( char * buf, char *, int ); // Decode a string using URL-encoding
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,125 @@
|
||||
#ifndef __vars_h__
|
||||
#define __vars_h__
|
||||
|
||||
|
||||
#pragma interface
|
||||
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
|
||||
using std::string;
|
||||
using std::map;
|
||||
|
||||
/*
|
||||
struct hash_str
|
||||
{
|
||||
inline size_t string_hf(const string& str)
|
||||
{ return hash(str.c_str()); }
|
||||
};
|
||||
|
||||
struct MyHASHER : public hash<const char*>{
|
||||
size_t operator(string a_string){
|
||||
return (*this)( a_string.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct eqstr
|
||||
{
|
||||
bool operator()(const char* s1, const char* s2) const
|
||||
{
|
||||
return strcmp(s1, s2) == 0;
|
||||
}
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
class varstring : public string
|
||||
{
|
||||
public:
|
||||
varstring();
|
||||
varstring( const varstring &c );
|
||||
varstring( const string &c );
|
||||
varstring( const char* c, int len);
|
||||
varstring( const char *c );
|
||||
|
||||
long Long() const;
|
||||
double Double();
|
||||
varstring& operator=( const char* c );
|
||||
void operator=( long l );
|
||||
void operator=( const string c );
|
||||
varstring& operator=( const varstring &c );
|
||||
operator long(); // type conversion
|
||||
operator const char*(); // type conversion
|
||||
|
||||
bool valid() const;
|
||||
void set_valid( bool validated = true );
|
||||
|
||||
bool db() const;
|
||||
void set_db( bool validated = true );
|
||||
|
||||
bool binary() const;
|
||||
void set_binary( bool binary = true );
|
||||
|
||||
friend class CVars;
|
||||
|
||||
private:
|
||||
bool validated;
|
||||
bool db_var; // is this variable to be used in DB updates
|
||||
bool binary_var;
|
||||
};
|
||||
|
||||
/*
|
||||
class string_key : public string
|
||||
{
|
||||
public:
|
||||
string_key& operator=( const char* c );
|
||||
void operator=( long l );
|
||||
void operator=( const string c );
|
||||
|
||||
string_key();
|
||||
string_key( const char *c );
|
||||
|
||||
bool valid() const;
|
||||
void set_valid( bool validated = true );
|
||||
|
||||
private:
|
||||
bool validated;
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
typedef
|
||||
// hash_map<const char*, char*, hash<const char*>, eqstr>
|
||||
// map< string_key, varstring >
|
||||
map< const string, varstring >
|
||||
CVars1;
|
||||
|
||||
|
||||
|
||||
class CVars : public CVars1
|
||||
{
|
||||
public:
|
||||
CVars() : CVars1() {};
|
||||
|
||||
CVars& operator<<( char const *name ); // schedule for db processing
|
||||
CVars& operator>>( char const *name ); // ignore db processing for this variable
|
||||
|
||||
void ClearDB();
|
||||
|
||||
long serialize( unsigned char *&buf ); // this will serialize the data into buf and return the resulting size
|
||||
// it is the responsibility of the caller to free the buffer with free()
|
||||
int deserialize( unsigned char *buf, long buf_sz ); // this will initialize the current instance by de-serializing the data from buf
|
||||
// returns number of elements de-serialized
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user