2 // This file is part of the aMule Project.
4 // Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org )
5 // Copyright (c) 2005-2008 Froenchenko Leonid ( lfroen@gmail.com / http://www.amule.org )
7 // Any parts of this program derived from the xMule, lMule or eMule project,
8 // or contributed by third-party developers are copyrighted by their
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #ifndef _PHP_CORE_LIB_H_
26 #define _PHP_CORE_LIB_H_
29 * This is interface to CPP parts of amuleweb
34 class CWriteStrBuffer
{
35 std::list
<char *> m_buf_list
;
47 void Write(const char *s
, int len
= -1);
48 void CopyAll(char *dst_buffer
);
49 int Length() { return m_total_length
; }
55 class CPhPLibContext
{
56 PHP_SYN_NODE
*m_syn_tree_top
;
57 PHP_SCOPE_TABLE m_global_scope
;
59 CWriteStrBuffer
*m_curr_str_buffer
;
61 CWebServerBase
*m_server
;
63 // parse file and take a "snapshot" of global vars
64 CPhPLibContext(CWebServerBase
*server
, const char *file
);
65 CPhPLibContext(CWebServerBase
*server
, char *php_buf
, int len
);
68 // init global vars, so parser/execution can start
70 void Execute(CWriteStrBuffer
*);
73 static void Printf(const char *str
, ...) __attribute__ ((__format__ (__printf__
, 1, 2)));
75 static void Printf(const char *str
, ...);
77 static void Print(const char *str
);
79 static CPhPLibContext
*g_curr_context
;
81 #ifndef PHP_STANDALONE_EN
82 CWebServerBase
*WebServer() { return m_server
; }
88 CPhpFilter(CWebServerBase
*server
, CSession
*sess
,
89 const char *file
, CWriteStrBuffer
*buff
);
94 void php_init_core_lib();
95 void php_init_amule_lib();
97 void load_session_vars(const char *target
, std::map
<std::string
, std::string
> &varmap
);
98 void save_session_vars(std::map
<std::string
, std::string
> &varmap
);
100 #endif //_PHP_CORE_LIB_H_
101 // File_checked_for_headers