/* +----------------------------------------------------------------------+ | PHP HTML Embedded Scripting Language Version 3.0 | +----------------------------------------------------------------------+ | Copyright (c) 1997,1998 PHP Development Team (See Credits file) | +----------------------------------------------------------------------+ | This program is free software; you can redistribute it and/or modify | | it under the terms of the GNU General Public License as published by | | the Free Software Foundation; either version 2 of the License, or | | (at your option) any later version. | | | | This program is distributed in the hope that it will be useful, | | but WITHOUT ANY WARRANTY; without even the implied warranty of | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | GNU General Public License for more details. | | | | You should have received a copy of the GNU General Public License | | along with this program; if not, write to the Free Software | | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | +----------------------------------------------------------------------+ | Authors: Uwe Steinmann | | | +----------------------------------------------------------------------+ */ /* $Id$ */ #if COMPILE_DL #include "dl/phpdl.h" #endif #include #if !(WIN32|WINNT) #include "config.h" #endif #include "php.h" #include "ext/standard/head.h" #if HYPERWAVE #include "hw.h" #if APACHE # ifndef DEBUG # undef palloc # endif #endif hw_module php3_hw_module; function_entry hw_functions[] = { {"hw_connect", php3_hw_connect, NULL}, {"hw_pconnect", php3_hw_pconnect, NULL}, {"hw_close", php3_hw_close, NULL}, {"hw_root", php3_hw_root, NULL}, {"hw_info", php3_hw_info, NULL}, {"hw_connection_info", php3_hw_connection_info, NULL}, {"hw_error", php3_hw_error, NULL}, {"hw_errormsg", php3_hw_errormsg, NULL}, {"hw_getparentsobj", php3_hw_getparentsobj, NULL}, {"hw_getparents", php3_hw_getparents, NULL}, {"hw_children", php3_hw_children, NULL}, {"hw_childrenobj", php3_hw_childrenobj, NULL}, {"hw_getchildcoll", php3_hw_getchildcoll, NULL}, {"hw_getchildcollobj", php3_hw_getchildcollobj, NULL}, {"hw_getobject", php3_hw_getobject, NULL}, {"hw_getandlock", php3_hw_getandlock, NULL}, {"hw_unlock", php3_hw_unlock, NULL}, {"hw_gettext", php3_hw_gettext, NULL}, {"hw_edittext", php3_hw_edittext, NULL}, {"hw_getcgi", php3_hw_getcgi, NULL}, {"hw_getremote", php3_hw_getremote, NULL}, {"hw_getremotechildren", php3_hw_getremotechildren, NULL}, {"hw_pipedocument", php3_hw_pipedocument, NULL}, {"hw_pipecgi", php3_hw_pipecgi, NULL}, {"hw_insertdocument", php3_hw_insertdocument, NULL}, {"hw_mv", php3_hw_mv, NULL}, {"hw_cp", php3_hw_cp, NULL}, {"hw_deleteobject", php3_hw_deleteobject, NULL}, {"hw_changeobject", php3_hw_changeobject, NULL}, {"hw_docbyanchor", php3_hw_docbyanchor, NULL}, {"hw_docbyanchorobj", php3_hw_docbyanchorobj, NULL}, {"hw_getobjectbyquery", php3_hw_getobjectbyquery, NULL}, {"hw_getobjectbyqueryobj", php3_hw_getobjectbyqueryobj, NULL}, {"hw_getobjectbyquerycoll", php3_hw_getobjectbyquerycoll, NULL}, {"hw_getobjectbyquerycollobj", php3_hw_getobjectbyquerycollobj,NULL}, {"hw_getchilddoccoll", php3_hw_getchilddoccoll, NULL}, {"hw_getchilddoccollobj", php3_hw_getchilddoccollobj, NULL}, {"hw_getanchors", php3_hw_getanchors, NULL}, {"hw_getanchorsobj", php3_hw_getanchorsobj, NULL}, {"hw_getusername", php3_hw_getusername, NULL}, {"hw_setlinkroot", php3_hw_setlinkroot, NULL}, {"hw_identify", php3_hw_identify, NULL}, {"hw_free_document", php3_hw_free_document, NULL}, {"hw_new_document", php3_hw_new_document, NULL}, {"hw_output_document", php3_hw_output_document, NULL}, {"hw_outputdocument", php3_hw_output_document, NULL}, {"hw_document_size", php3_hw_document_size, NULL}, {"hw_documentsize", php3_hw_document_size, NULL}, {"hw_document_attributes", php3_hw_document_attributes, NULL}, {"hw_documentattributes", php3_hw_document_attributes, NULL}, {"hw_document_bodytag", php3_hw_document_bodytag, NULL}, {"hw_documentbodytag", php3_hw_document_bodytag, NULL}, {"hw_document_content", php3_hw_document_content, NULL}, {"hw_objrec2array", php3_hw_objrec2array, NULL}, {"hw_array2objrec", php3_hw_array2objrec, NULL}, {"hw_incollections", php3_hw_incollections, NULL}, {"hw_inscoll", php3_hw_inscoll, NULL}, {"hw_insertobject", php3_hw_insertobject, NULL}, {"hw_insdoc", php3_hw_insdoc, NULL}, {"hw_getsrcbydestobj", php3_hw_getsrcbydestobj, NULL}, {"hw_getrellink", php3_hw_getrellink, NULL}, {"hw_who", php3_hw_who, NULL}, {"hw_stat", php3_hw_stat, NULL}, {"hw_dummy", php3_hw_dummy, NULL}, {NULL, NULL, NULL} }; php3_module_entry hw_module_entry = { "HyperWave", hw_functions, php3_minit_hw, NULL, NULL, NULL, php3_info_hw, 0, 0, 0, NULL }; void print_msg(hg_msg *msg, char *str, int txt); #if COMPILE_DL DLEXPORT php3_module_entry *get_module(void) { return &hw_module_entry; } #endif void _close_hw_link(hw_connection *conn) { if(conn->hostname) free(conn->hostname); if(conn->username) free(conn->username); close(conn->socket); free(conn); php3_hw_module.num_links--; } void _close_hw_plink(hw_connection *conn) { if(conn->hostname) free(conn->hostname); if(conn->username) free(conn->username); close(conn->socket); free(conn); php3_hw_module.num_links--; php3_hw_module.num_persistent--; } void _free_hw_document(hw_document *doc) { if(doc->data) free(doc->data); if(doc->attributes) free(doc->attributes); if(doc->bodytag) free(doc->bodytag); free(doc); } /* creates an array in return value and frees all memory * Also adds as an assoc. array at the end of the return array with * statistics. */ int make_return_objrec(pval **return_value, char **objrecs, int count) { pval stat_arr; int i; int hidden, collhead, fullcollhead, total; int collheadnr, fullcollheadnr; if (array_init(*return_value) == FAILURE) { /* Ups, failed! Let's at least free the memory */ for(i=0; i