+++ /dev/null
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Brad House <brad@mainstreetsoftworks.com> |
- | Chris Faulhaber <jedgar@fxp.org> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if PHP_WIN32
-#include "config.w32.h"
-#else
-#include <php_config.h>
-#endif
-
-#if HAVE_MCVE
-
-/* standard php include(s) */
-#include "ext/standard/head.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/info.h"
-
-/* local include(s) */
-#include <mcve.h>
-
-/* local php include(s) */
-#include "php_mcve.h"
-
-/* {{{ globals */
-static int le_conn; /* connection resource */
-static int le_user; /* store add/edit/get user information */
-
-static int mcve_init; /* For Safe Memory Deallocation */
-/* }}} */
-
-/* {{{ extension definition structures */
-function_entry mcve_functions[] = {
- PHP_FE(m_initengine, NULL)
- PHP_FE(m_initconn, NULL)
- PHP_FE(m_deleteresponse, NULL)
- PHP_FE(m_destroyconn, NULL)
- PHP_FE(m_setdropfile, NULL)
- PHP_FE(m_setip, NULL)
- PHP_FE(m_setssl, NULL)
-#if BRAD_0
-#if LIBMONETRA_VERSION >= 050000
- PHP_FE(m_setssl_cafile, NULL)
- PHP_FE(m_responsekeys, NULL)
-#endif
-#endif
- PHP_FE(m_setssl_files, NULL)
- PHP_FE(m_settimeout, NULL)
- PHP_FE(m_setblocking, NULL)
- PHP_FE(m_verifyconnection, NULL)
- PHP_FE(m_verifysslcert, NULL)
- PHP_FE(m_maxconntimeout, NULL)
- PHP_FE(m_connectionerror, NULL)
- PHP_FE(m_deletetrans, NULL)
- PHP_FE(m_connect, NULL)
- PHP_FE(m_transnew, NULL)
- PHP_FE(m_transparam, NULL)
-#if LIBMONETRA_VERSION >= 050000
- PHP_FE(m_transkeyval, NULL)
- PHP_FE(m_validateidentifier, NULL)
-#endif
- PHP_FE(m_transsend, NULL)
- PHP_FE(m_ping, NULL)
- PHP_FE(m_responseparam, NULL)
- PHP_FE(m_returnstatus, NULL)
- PHP_FE(m_returncode, NULL)
- PHP_FE(m_transactionssent, NULL)
- PHP_FE(m_transactionitem, NULL)
- PHP_FE(m_transactionbatch, NULL)
- PHP_FE(m_transactionid, NULL)
- PHP_FE(m_transactionauth, NULL)
- PHP_FE(m_transactiontext, NULL)
- PHP_FE(m_transactionavs, NULL)
- PHP_FE(m_transactioncv, NULL)
- PHP_FE(m_getuserparam, NULL)
- PHP_FE(m_monitor, NULL)
- PHP_FE(m_transinqueue, NULL)
- PHP_FE(m_checkstatus, NULL)
- PHP_FE(m_completeauthorizations, second_arg_force_ref)
- PHP_FE(m_sale, NULL)
- PHP_FE(m_preauth, NULL)
- PHP_FE(m_void, NULL)
- PHP_FE(m_preauthcompletion, NULL)
- PHP_FE(m_force, NULL)
- PHP_FE(m_override, NULL)
- PHP_FE(m_return, NULL)
- PHP_FE(m_iscommadelimited, NULL)
- PHP_FE(m_parsecommadelimited, NULL)
- PHP_FE(m_getcommadelimited, NULL)
- PHP_FE(m_getcell, NULL)
- PHP_FE(m_getcellbynum, NULL)
- PHP_FE(m_numcolumns, NULL)
- PHP_FE(m_numrows, NULL)
- PHP_FE(m_getheader, NULL)
- PHP_FE(m_destroyengine, NULL)
- PHP_FE(m_settle, NULL)
- PHP_FE(m_gut, NULL)
- PHP_FE(m_gl, NULL)
- PHP_FE(m_gft, NULL)
- PHP_FE(m_qc, NULL)
- PHP_FE(m_ub, NULL)
- PHP_FE(m_chkpwd, NULL)
- PHP_FE(m_bt, NULL)
- PHP_FE(m_uwait, NULL)
- PHP_FE(m_text_code, NULL)
- PHP_FE(m_text_avs, NULL)
- PHP_FE(m_text_cv, NULL)
- PHP_FE(m_chngpwd, NULL)
- PHP_FE(m_listusers, NULL)
- PHP_FE(m_adduser, NULL)
- PHP_FE(m_enableuser, NULL)
- PHP_FE(m_disableuser, NULL)
- PHP_FE(m_getuserarg, NULL)
- PHP_FE(m_adduserarg, NULL)
- PHP_FE(m_deleteusersetup, NULL)
- PHP_FE(m_initusersetup, NULL)
- PHP_FE(m_deluser, NULL)
- PHP_FE(m_edituser, NULL)
- PHP_FE(m_liststats, NULL)
- /* Backwards compatability functions below */
- PHP_FE(mcve_initengine, NULL)
- PHP_FE(mcve_initconn, NULL)
- PHP_FE(mcve_deleteresponse, NULL)
- PHP_FE(mcve_destroyconn, NULL)
- PHP_FE(mcve_setdropfile, NULL)
- PHP_FE(mcve_setip, NULL)
- PHP_FE(mcve_setssl, NULL)
- PHP_FE(mcve_setssl_files, NULL)
- PHP_FE(mcve_settimeout, NULL)
- PHP_FE(mcve_setblocking, NULL)
- PHP_FE(mcve_verifyconnection, NULL)
- PHP_FE(mcve_verifysslcert, NULL)
- PHP_FE(mcve_maxconntimeout, NULL)
- PHP_FE(mcve_connectionerror, NULL)
- PHP_FE(mcve_deletetrans, NULL)
- PHP_FE(mcve_connect, NULL)
- PHP_FE(mcve_transnew, NULL)
- PHP_FE(mcve_transparam, NULL)
- PHP_FE(mcve_transsend, NULL)
- PHP_FE(mcve_ping, NULL)
- PHP_FE(mcve_responseparam, NULL)
- PHP_FE(mcve_returnstatus, NULL)
- PHP_FE(mcve_returncode, NULL)
- PHP_FE(mcve_transactionssent, NULL)
- PHP_FE(mcve_transactionitem, NULL)
- PHP_FE(mcve_transactionbatch, NULL)
- PHP_FE(mcve_transactionid, NULL)
- PHP_FE(mcve_transactionauth, NULL)
- PHP_FE(mcve_transactiontext, NULL)
- PHP_FE(mcve_transactionavs, NULL)
- PHP_FE(mcve_transactioncv, NULL)
- PHP_FE(mcve_getuserparam, NULL)
- PHP_FE(mcve_monitor, NULL)
- PHP_FE(mcve_transinqueue, NULL)
- PHP_FE(mcve_checkstatus, NULL)
- PHP_FE(mcve_completeauthorizations, second_arg_force_ref)
- PHP_FE(mcve_sale, NULL)
- PHP_FE(mcve_preauth, NULL)
- PHP_FE(mcve_void, NULL)
- PHP_FE(mcve_preauthcompletion, NULL)
- PHP_FE(mcve_force, NULL)
- PHP_FE(mcve_override, NULL)
- PHP_FE(mcve_return, NULL)
- PHP_FE(mcve_iscommadelimited, NULL)
- PHP_FE(mcve_parsecommadelimited, NULL)
- PHP_FE(mcve_getcommadelimited, NULL)
- PHP_FE(mcve_getcell, NULL)
- PHP_FE(mcve_getcellbynum, NULL)
- PHP_FE(mcve_numcolumns, NULL)
- PHP_FE(mcve_numrows, NULL)
- PHP_FE(mcve_getheader, NULL)
- PHP_FE(mcve_destroyengine, NULL)
- PHP_FE(mcve_settle, NULL)
- PHP_FE(mcve_gut, NULL)
- PHP_FE(mcve_gl, NULL)
- PHP_FE(mcve_gft, NULL)
- PHP_FE(mcve_qc, NULL)
- PHP_FE(mcve_ub, NULL)
- PHP_FE(mcve_chkpwd, NULL)
- PHP_FE(mcve_bt, NULL)
- PHP_FE(mcve_uwait, NULL)
- PHP_FE(mcve_text_code, NULL)
- PHP_FE(mcve_text_avs, NULL)
- PHP_FE(mcve_text_cv, NULL)
- PHP_FE(mcve_chngpwd, NULL)
- PHP_FE(mcve_listusers, NULL)
- PHP_FE(mcve_adduser, NULL)
- PHP_FE(mcve_enableuser, NULL)
- PHP_FE(mcve_disableuser, NULL)
- PHP_FE(mcve_getuserarg, NULL)
- PHP_FE(mcve_adduserarg, NULL)
- PHP_FE(mcve_deleteusersetup, NULL)
- PHP_FE(mcve_initusersetup, NULL)
- PHP_FE(mcve_deluser, NULL)
- PHP_FE(mcve_edituser, NULL)
- PHP_FE(mcve_liststats, NULL)
- { NULL, NULL, NULL }
-};
-
-zend_module_entry mcve_module_entry = {
-#if ZEND_MODULE_API_NO >= 20010901
- STANDARD_MODULE_HEADER,
-#endif
- "mcve", /* module name */
- mcve_functions, /* struct of functions (see above) */
- PHP_MINIT(mcve), /* module initialization functions */
- NULL, /* module shutdown functions */
- NULL, /* request initialization functions */
- NULL, /* request shutdown functions */
- PHP_MINFO(mcve), /* declare the info function for phpinfo() */
-#if ZEND_MODULE_API_NO >= 20010901
- PHP_MCVE_VERSION, /* declare MCVE version number */
-#endif
- STANDARD_MODULE_PROPERTIES
-};
-
-/* }}} */
-
-/* declare the module for dynamic loading */
-#ifdef COMPILE_DL_MCVE
-ZEND_GET_MODULE(mcve)
-# ifdef PHP_WIN32
-# include "zend_arg_defs.c"
-# endif
-#endif
-
-/* {{{ MCVE_CONN destructor */
-static void _free_mcve_conn(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- MCVE_CONN *conn;
-
- conn = (MCVE_CONN *)rsrc->ptr;
- MCVE_DestroyConn(conn);
- efree(conn);
-}
-/* }}} */
-
-/* {{{ module initialization */
-PHP_MINIT_FUNCTION(mcve)
-{
- /* register the MCVE_CONN destructor */
- le_conn = zend_register_list_destructors_ex(_free_mcve_conn, NULL, "mcve connection", module_number);
-
- /* Key definitions for Transaction Parameters */
- REGISTER_LONG_CONSTANT("MC_TRANTYPE", MC_TRANTYPE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USERNAME", MC_USERNAME, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_PASSWORD", MC_PASSWORD, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ACCOUNT", MC_ACCOUNT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRACKDATA", MC_TRACKDATA, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_EXPDATE", MC_EXPDATE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_STREET", MC_STREET, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ZIP", MC_ZIP, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_CV", MC_CV, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_COMMENTS", MC_COMMENTS, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_CLERKID", MC_CLERKID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_STATIONID", MC_STATIONID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_APPRCODE", MC_APPRCODE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_AMOUNT", MC_AMOUNT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_PTRANNUM", MC_PTRANNUM, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TTID", MC_TTID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER", MC_USER, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_PWD", MC_PWD, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ACCT", MC_ACCT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_BDATE", MC_BDATE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_EDATE", MC_EDATE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_BATCH", MC_BATCH, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_FILE", MC_FILE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN", MC_ADMIN, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_AUDITTYPE", MC_AUDITTYPE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_CUSTOM", MC_CUSTOM, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_EXAMOUNT", MC_EXAMOUNT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_EXCHARGES", MC_EXCHARGES, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_RATE", MC_RATE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_RENTERNAME", MC_RENTERNAME, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_RETURNCITY", MC_RETURNCITY, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_RETURNSTATE", MC_RETURNSTATE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_RETURNLOCATION", MC_RETURNLOCATION, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_PRIORITY", MC_PRIORITY, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_INQUIRY", MC_INQUIRY, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_CARDTYPES", MC_CARDTYPES, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_SUB", MC_SUB, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_MARKER", MC_MARKER, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_DEVICETYPE", MC_DEVICETYPE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ERRORCODE", MC_ERRORCODE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_NEWBATCH", MC_NEWBATCH, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_CURR", MC_CURR, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_DESCMERCH", MC_DESCMERCH, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_DESCLOC", MC_DESCLOC, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ORIGTYPE", MC_ORIGTYPE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_PIN", MC_PIN, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_VOIDORIGTYPE", MC_VOIDORIGTYPE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TIMESTAMP", MC_TIMESTAMP, MCVE_CONST);
-
- /* Args for priorities */
- REGISTER_LONG_CONSTANT("MC_PRIO_HIGH", MC_PRIO_HIGH, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_PRIO_NORMAL", MC_PRIO_NORMAL, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_PRIO_LOW", MC_PRIO_LOW, MCVE_CONST);
-
- /* Args for adding a user */
- REGISTER_LONG_CONSTANT("MC_USER_PROC", MC_USER_PROC, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_USER", MC_USER_USER, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_PWD", MC_USER_PWD, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_INDCODE", MC_USER_INDCODE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_MERCHID", MC_USER_MERCHID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_BANKID", MC_USER_BANKID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_TERMID", MC_USER_TERMID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_CLIENTNUM", MC_USER_CLIENTNUM, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_STOREID", MC_USER_STOREID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_AGENTID", MC_USER_AGENTID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_CHAINID", MC_USER_CHAINID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_ZIPCODE", MC_USER_ZIPCODE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_TIMEZONE", MC_USER_TIMEZONE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_MERCHCAT", MC_USER_MERCHCAT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_MERNAME", MC_USER_MERNAME, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_MERCHLOC", MC_USER_MERCHLOC, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_STATECODE", MC_USER_STATECODE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_PHONE", MC_USER_PHONE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_SUB", MC_USER_SUB, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_CARDTYPES", MC_USER_CARDTYPES, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_MODE", MC_USER_MODE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_VNUMBER", MC_USER_VNUMBER, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_ROUTINGID", MC_USER_ROUTINGID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_PPROPERTY", MC_USER_PPROPERTY, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_PID", MC_USER_PID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_PIDPWD", MC_USER_PIDPWD, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_SMID", MC_USER_SMID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_SMIDPWD", MC_USER_SMIDPWD, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_USDDIV", MC_USER_USDDIV, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_AUDDIV", MC_USER_AUDDIV, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_DKKDIV", MC_USER_DKKDIV, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_GBPDIV", MC_USER_GBPDIV, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_HKDDIV", MC_USER_HKDDIV, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_JPYDIV", MC_USER_JPYDIV, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_NZDDIV", MC_USER_NZDDIV, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_NOKDIV", MC_USER_NOKDIV, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_SGDDIV", MC_USER_SGDDIV, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_ZARDIV", MC_USER_ZARDIV, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_SEKDIV", MC_USER_SEKDIV, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_CHFDIV", MC_USER_CHFDIV, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_CADDIV", MC_USER_CADDIV, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_USER_DIVNUM", MC_USER_DIVNUM, MCVE_CONST);
-
- /* Values for cardtypes */
- REGISTER_LONG_CONSTANT("MC_CARD_VISA", MC_CARD_VISA, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_CARD_MC", MC_CARD_MC, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_CARD_AMEX", MC_CARD_AMEX, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_CARD_DISC", MC_CARD_DISC, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_CARD_JCB", MC_CARD_JCB, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_CARD_CB", MC_CARD_CB, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_CARD_DC", MC_CARD_DC, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_CARD_GIFT", MC_CARD_GIFT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_CARD_OTHER", MC_CARD_OTHER, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_CARD_ALL", MC_CARD_ALL, MCVE_CONST);
-
- /* Values for modes */
- REGISTER_LONG_CONSTANT("MC_MODE_AUTH", MC_MODE_AUTH, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_MODE_SETTLE", MC_MODE_SETTLE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_MODE_BOTH", MC_MODE_BOTH, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_MODE_ALL", MC_MODE_ALL, MCVE_CONST);
-
- /* Values for EXCHARGES */
- REGISTER_LONG_CONSTANT("MC_EXCHARGES_REST", MC_EXCHARGES_REST, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_EXCHARGES_GIFT", MC_EXCHARGES_GIFT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_EXCHARGES_MINI", MC_EXCHARGES_MINI, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_EXCHARGES_TELE", MC_EXCHARGES_TELE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_EXCHARGES_OTHER", MC_EXCHARGES_OTHER, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_EXCHARGES_LAUND", MC_EXCHARGES_LAUND, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_EXCHARGES_NONE", MC_EXCHARGES_NONE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_EXCHARGES_GAS", MC_EXCHARGES_GAS, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_EXCHARGES_MILE", MC_EXCHARGES_MILE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_EXCHARGES_LATE", MC_EXCHARGES_LATE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_EXCHARGES_1WAY", MC_EXCHARGES_1WAY, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_EXCHARGES_VIOL", MC_EXCHARGES_VIOL, MCVE_CONST);
-
- /* Value definitions for Transaction Types */
- REGISTER_LONG_CONSTANT("MC_TRAN_SALE", MC_TRAN_SALE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_REDEMPTION", MC_TRAN_REDEMPTION, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_PREAUTH", MC_TRAN_PREAUTH, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_VOID", MC_TRAN_VOID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_PREAUTHCOMPLETE", MC_TRAN_PREAUTHCOMPLETE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_FORCE", MC_TRAN_FORCE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_OVERRIDE", MC_TRAN_OVERRIDE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_RETURN", MC_TRAN_RETURN, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_RELOAD", MC_TRAN_RELOAD, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_CREDIT", MC_TRAN_CREDIT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_SETTLE", MC_TRAN_SETTLE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_INCREMENTAL", MC_TRAN_INCREMENTAL, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_REVERSAL", MC_TRAN_REVERSAL, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_ACTIVATE", MC_TRAN_ACTIVATE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_BALANCEINQ", MC_TRAN_BALANCEINQ, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_CASHOUT", MC_TRAN_CASHOUT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_TOREVERSAL", MC_TRAN_TOREVERSAL, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_SETTLERFR", MC_TRAN_SETTLERFR, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_ISSUE", MC_TRAN_ISSUE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_TIP", MC_TRAN_TIP, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_MERCHRETURN", MC_TRAN_MERCHRETURN, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_IVRREQ", MC_TRAN_IVRREQ, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_IVRRESP", MC_TRAN_IVRRESP, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_ADMIN", MC_TRAN_ADMIN, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_PING", MC_TRAN_PING, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_CHKPWD", MC_TRAN_CHKPWD, MCVE_CONST);
-
- /* Engine Admin Transaction Types */
- REGISTER_LONG_CONSTANT("MC_TRAN_CHNGPWD", MC_TRAN_CHNGPWD, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_LISTSTATS", MC_TRAN_LISTSTATS, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_LISTUSERS", MC_TRAN_LISTUSERS, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_GETUSERINFO", MC_TRAN_GETUSERINFO, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_ADDUSER", MC_TRAN_ADDUSER, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_EDITUSER", MC_TRAN_EDITUSER, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_DELUSER", MC_TRAN_DELUSER, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_ENABLEUSER", MC_TRAN_ENABLEUSER, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_DISABLEUSER", MC_TRAN_DISABLEUSER, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_IMPORT", MC_TRAN_IMPORT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_EXPORT", MC_TRAN_EXPORT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_ERRORLOG", MC_TRAN_ERRORLOG, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_CLEARERRORLOG", MC_TRAN_CLEARERRORLOG, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_TRAN_GETSUBACCTS", MC_TRAN_GETSUBACCTS, MCVE_CONST);
-
- /* Value definitions for Admin Types */
- REGISTER_LONG_CONSTANT("MC_ADMIN_GUT", MC_ADMIN_GUT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_GL", MC_ADMIN_GL, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_GFT", MC_ADMIN_GFT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_BT", MC_ADMIN_BT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_UB", MC_ADMIN_UB, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_QC", MC_ADMIN_QC, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_RS", MC_ADMIN_RS, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_CTH", MC_ADMIN_CTH, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_CFH", MC_ADMIN_CFH, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_FORCESETTLE", MC_ADMIN_FORCESETTLE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_SETBATCHNUM", MC_ADMIN_SETBATCHNUM, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_RENUMBERBATCH", MC_ADMIN_RENUMBERBATCH, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_FIELDEDIT", MC_ADMIN_FIELDEDIT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MC_ADMIN_CLOSEBATCH", MC_ADMIN_CLOSEBATCH, MCVE_CONST);
-
- REGISTER_LONG_CONSTANT("M_UNUSED", MCVE_UNUSED, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_NEW", MCVE_NEW, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_PENDING", MCVE_PENDING, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_DONE", MCVE_DONE, MCVE_CONST);
-
- REGISTER_LONG_CONSTANT("M_GOOD", MCVE_GOOD, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_BAD", MCVE_BAD, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_STREET", MCVE_STREET, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_ZIP", MCVE_ZIP, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_UNKNOWN", MCVE_UNKNOWN, MCVE_CONST);
-
- REGISTER_LONG_CONSTANT("M_ERROR", MCVE_ERROR, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_FAIL", MCVE_FAIL, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_SUCCESS", MCVE_SUCCESS, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_AUTH", MCVE_AUTH, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_DENY", MCVE_DENY, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_CALL", MCVE_CALL, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_DUPL", MCVE_DUPL, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_PKUP", MCVE_PKUP, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_RETRY", MCVE_RETRY, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_SETUP", MCVE_SETUP, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_TIMEOUT", MCVE_TIMEOUT, MCVE_CONST);
-
- REGISTER_LONG_CONSTANT("M_SALE", MCVE_SALE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_PREAUTH", MCVE_PREAUTH, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_FORCE", MCVE_FORCE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_OVERRIDE", MCVE_OVERRIDE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_RETURN", MCVE_RETURN, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_SETTLE", MCVE_SETTLE, MCVE_CONST);
-
- REGISTER_LONG_CONSTANT("M_PROC", MCVE_PROC, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_USER", MCVE_USER, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_PWD", MCVE_PWD, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_INDCODE", MCVE_INDCODE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_MERCHID", MCVE_MERCHID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_BANKID", MCVE_BANKID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_TERMID", MCVE_TERMID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_CLIENTNUM", MCVE_CLIENTNUM, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_STOREID", MCVE_STOREID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_AGENTID", MCVE_AGENTID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_CHAINID", MCVE_CHAINID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_ZIPCODE", MCVE_ZIPCODE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_TIMEZONE", MCVE_TIMEZONE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_MERCHCAT", MCVE_MERCHCAT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_MERNAME", MCVE_MERNAME, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_MERCHLOC", MCVE_MERCHLOC, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_STATECODE", MCVE_STATECODE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("M_SERVICEPHONE", MCVE_SERVICEPHONE, MCVE_CONST);
-
- /* COMPATABILITY VARIABLES */
- REGISTER_LONG_CONSTANT("MCVE_UNUSED", MCVE_UNUSED, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_NEW", MCVE_NEW, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_PENDING", MCVE_PENDING, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_DONE", MCVE_DONE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_GOOD", MCVE_GOOD, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_BAD", MCVE_BAD, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_STREET", MCVE_STREET, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_ZIP", MCVE_ZIP, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_UNKNOWN", MCVE_UNKNOWN, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_ERROR", MCVE_ERROR, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_FAIL", MCVE_FAIL, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_SUCCESS", MCVE_SUCCESS, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_AUTH", MCVE_AUTH, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_DENY", MCVE_DENY, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_CALL", MCVE_CALL, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_DUPL", MCVE_DUPL, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_PKUP", MCVE_PKUP, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_RETRY", MCVE_RETRY, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_SETUP", MCVE_SETUP, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_TIMEOUT", MCVE_TIMEOUT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_SALE", MCVE_SALE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_PREAUTH", MCVE_PREAUTH, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_FORCE", MCVE_FORCE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_OVERRIDE", MCVE_OVERRIDE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_RETURN", MCVE_RETURN, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_SETTLE", MCVE_SETTLE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_PROC", MCVE_PROC, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_USER", MCVE_USER, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_PWD", MCVE_PWD, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_INDCODE", MCVE_INDCODE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_MERCHID", MCVE_MERCHID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_BANKID", MCVE_BANKID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_TERMID", MCVE_TERMID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_CLIENTNUM", MCVE_CLIENTNUM, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_STOREID", MCVE_STOREID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_AGENTID", MCVE_AGENTID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_CHAINID", MCVE_CHAINID, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_ZIPCODE", MCVE_ZIPCODE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_TIMEZONE", MCVE_TIMEZONE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_MERCHCAT", MCVE_MERCHCAT, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_MERNAME", MCVE_MERNAME, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_MERCHLOC", MCVE_MERCHLOC, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_STATECODE", MCVE_STATECODE, MCVE_CONST);
- REGISTER_LONG_CONSTANT("MCVE_SERVICEPHONE", MCVE_SERVICEPHONE, MCVE_CONST);
-
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ module information */
-PHP_MINFO_FUNCTION(mcve)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "mcve/monetra support", "enabled");
- php_info_print_table_row(2, "version", PHP_MCVE_VERSION);
- php_info_print_table_end();
-}
-/* }}} */
-
-
-/* {{{ proto int m_initengine(string location)
- Ready the client for IP/SSL Communication */
-PHP_FUNCTION(m_initengine)
-{
- int ret;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(arg);
-
- if (mcve_init) {
- MCVE_DestroyEngine();
- }
- ret = MCVE_InitEngine(Z_STRVAL_PP(arg));
- mcve_init = 1;
-
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ proto resource m_initconn(void)
- Create and initialize an MCVE_CONN structure */
-PHP_FUNCTION(m_initconn)
-{
- MCVE_CONN *conn;
-
- conn = emalloc(sizeof(MCVE_CONN));
-
- MCVE_InitConn(conn);
-
-/* Since the identifiers are pointer addresses, we need to validate it by
- * checking our linked list in PHP, since we don't want to cause segfaults */
-#if LIBMONETRA_VERSION >= 050000
- M_ValidateIdentifier(conn, 1);
-#endif
- ZEND_REGISTER_RESOURCE(return_value, conn, le_conn);
-}
-/* }}} */
-
-
-/* {{{ proto bool m_deleteresponse(resource conn, int identifier)
- Delete specified transaction from MCVE_CONN structure */
-PHP_FUNCTION(m_deleteresponse)
-{
- MCVE_CONN *conn;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- MCVE_DeleteResponse(conn, Z_LVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool m_deletetrans(resource conn, int identifier)
- Delete specified transaction from MCVE_CONN structure */
-PHP_FUNCTION(m_deletetrans)
-{
- MCVE_CONN *conn;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection",
- le_conn);
-
- convert_to_long_ex(arg2);
-
- MCVE_DeleteTrans(conn, Z_LVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void m_destroyconn(resource conn)
- Destroy the connection and MCVE_CONN structure */
-PHP_FUNCTION(m_destroyconn)
-{
-#if 0
- MCVE_CONN *conn;
-#endif
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
-/* If MCVE_DestroyConn() is called within a PHP script, the Resource handle is
- never cleared, as there does not appear to be an UNREGISTER or DESTROY resource
- call in the Zend API. What happens is this uninitialized memory location is
- passed again to the MCVE_DestroyConn() function at script exit (cleanup), and
- causes weird stuff. So we just go ahead and let the PHP garbage collector call
- our _free_mcve_conn() we registered (le_conn) to clean up */
-#if 0
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg, -1, "mcve connection", le_conn);
-
- MCVE_DestroyConn(conn);
-#endif
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int m_setdropfile(resource conn, string directory)
- Set the connection method to Drop-File */
-PHP_FUNCTION(m_setdropfile)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
-
- retval = MCVE_SetDropFile(conn, Z_STRVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_setip(resource conn, string host, int port)
- Set the connection method to IP */
-PHP_FUNCTION(m_setip)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
-
- retval = MCVE_SetIP(conn, Z_STRVAL_PP(arg2), Z_LVAL_PP(arg3));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_setssl(resource conn, string host, int port)
- Set the connection method to SSL */
-PHP_FUNCTION(m_setssl)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
-
- retval = MCVE_SetSSL(conn, Z_STRVAL_PP(arg2), Z_LVAL_PP(arg3));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-#if BRAD_0
-#if LIBMONETRA_VERSION >= 050000
-/* {{{ proto int m_setssl_cafile(resource conn, string cafile)
- Set SSL CA (Certificate Authority) file for verification of server
- certificate
-*/
-PHP_FUNCTION(m_setssl_cafile)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
- convert_to_string_ex(arg2);
-
- retval = M_SetSSL_CAfile(conn, Z_STRVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-#endif
-#endif
-
-/* {{{ proto int m_setssl_files(resource conn, string sslkeyfile, string sslcertfile)
- Set certificate key files and certificates if server requires client certificate
- verification
-*/
-PHP_FUNCTION(m_setssl_files)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2, **arg3;
-
-#ifndef LIBMONETRA_BELOW_4_2
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-#else
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-#endif
-
- convert_to_string_ex(arg2);
-
-#ifndef LIBMONETRA_BELOW_4_2
- convert_to_string_ex(arg3);
- retval = MCVE_SetSSL_Files(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
-#else
- convert_to_string_ex(arg1);
- retval = MCVE_SetSSL_Files(Z_STRVAL_PP(arg1), Z_STRVAL_PP(arg2));
-#endif
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_settimeout(resource conn, int seconds)
- Set maximum transaction time (per trans)
-*/
-PHP_FUNCTION(m_settimeout)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_SetTimeout(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_setblocking(resource conn, int tf)
- Set blocking/non-blocking mode for connection
-*/
-PHP_FUNCTION(m_setblocking)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_SetBlocking(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto bool m_verifyconnection(resource conn, int tf)
- Set whether or not to PING upon connect to verify connection
-*/
-PHP_FUNCTION(m_verifyconnection)
-{
- MCVE_CONN *conn;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- MCVE_VerifyConnection(conn, Z_LVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool m_verifysslcert(resource conn, int tf)
- Set whether or not to verify the server ssl certificate
-*/
-PHP_FUNCTION(m_verifysslcert)
-{
- MCVE_CONN *conn;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- MCVE_VerifySSLCert(conn, Z_LVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool m_maxconntimeout(resource conn, int secs)
- The maximum amount of time the API will attempt a connection to MCVE
-*/
-PHP_FUNCTION(m_maxconntimeout)
-{
- MCVE_CONN *conn;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- MCVE_MaxConnTimeout(conn, Z_LVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int m_connect(resource conn)
- Establish the connection to MCVE */
-PHP_FUNCTION(m_connect)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg, -1, "mcve connection", le_conn);
-
- retval = MCVE_Connect(conn);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto string m_connectionerror(resource conn)
- Get a textual representation of why a connection failed */
-PHP_FUNCTION(m_connectionerror)
-{
- MCVE_CONN *conn;
- const char *retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg, -1, "mcve connection", le_conn);
-
- retval = MCVE_ConnectionError(conn);
-
- if (retval == NULL) {
- RETVAL_STRING("",1);
- } else {
- RETVAL_STRING(estrdup(retval), 0);
- }
-}
-/* }}} */
-
-/* {{{ proto int m_transactionssent(resource conn)
- Check to see if outgoing buffer is clear */
-PHP_FUNCTION(m_transactionssent)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg, -1, "mcve connection", le_conn);
-
- retval = MCVE_TransactionsSent(conn);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_ping(resource conn)
- Send a ping request to MCVE */
-PHP_FUNCTION(m_ping)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg, -1, "mcve connection", le_conn);
-
- retval = MCVE_Ping(conn);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_transnew(resource conn)
- Start a new transaction */
-PHP_FUNCTION(m_transnew)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg, -1, "mcve connection", le_conn);
-
- retval = MCVE_TransNew(conn);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-#if LIBMONETRA_VERSION >= 050000
-/* {{{ proto int m_validateidentifier(resource conn, int tf)
- Whether or not to validate the passed identifier on any transaction it is passed to
-*/
-PHP_FUNCTION(m_validateidentifier)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
- retval = M_ValidateIdentifier(conn, (int)Z_LVAL_PP(arg2));
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_transkeyval(resource conn, long identifier, string key, string value)
- Add key/value pair to a transaction. Replaces deprecated transparam() */
-PHP_FUNCTION(m_transkeyval)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2, **arg3, **arg4;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_string_ex(arg4);
-
- retval = M_TransKeyVal(conn, (long)Z_LVAL_PP(arg2), Z_STRVAL_PP(arg3), Z_STRVAL_PP(arg4));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-#endif
-
-/* {{{ proto int m_transparam(resource conn, long identifier, int key, ...)
- Add a parameter to a transaction (deprecated) */
-PHP_FUNCTION(m_transparam)
-{
- MCVE_CONN *conn;
- int retval;
- int key;
- zval **arg1, **arg2, **arg3, **arg4, **arg5;
-
- if (ZEND_NUM_ARGS() == 4) {
- if (zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE)
- WRONG_PARAM_COUNT;
- } else if (ZEND_NUM_ARGS() == 5) {
- if (zend_get_parameters_ex(5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE)
- WRONG_PARAM_COUNT;
- } else {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg3);
-
- key = Z_LVAL_PP(arg3);
-
- if (key == MC_CUSTOM && ZEND_NUM_ARGS() != 5)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- switch (key) {
- /* Typecast to MCVE_int64 */
- case MC_TTID:
- convert_to_long_ex(arg4);
- retval = MCVE_TransParam(conn, (long)Z_LVAL_PP(arg2), key, (MCVE_int64)Z_LVAL_PP(arg4));
- break;
-
- /* Typecast to long */
-
- case MC_PTRANNUM:
- case MC_TIMESTAMP:
- case MC_MARKER:
- convert_to_long_ex(arg4);
- retval = MCVE_TransParam(conn, (long)Z_LVAL_PP(arg2), key, (long)Z_LVAL_PP(arg4));
- break;
-
- /* Typecast to int */
- case MC_ADMIN:
- case MC_SUB:
- case MC_TRANTYPE:
- case MC_AUDITTYPE:
- case MC_EXCHARGES:
- case MC_INQUIRY:
- case MC_PRIORITY:
- case MC_CARDTYPES:
- case MC_ORIGTYPE:
- case MC_VOIDORIGTYPE:
- convert_to_long_ex(arg4);
- retval = MCVE_TransParam(conn, (long)Z_LVAL_PP(arg2), key, (int)Z_LVAL_PP(arg4));
- break;
-
- /* Typecast to double */
- case MC_AMOUNT:
- case MC_EXAMOUNT:
- case MC_RATE:
- convert_to_double_ex(arg4);
- retval = MCVE_TransParam(conn, (long)Z_LVAL_PP(arg2), key, (double)Z_DVAL_PP(arg4));
- break;
-
- case MC_CUSTOM:
- convert_to_string_ex(arg4);
- convert_to_string_ex(arg5);
- retval = MCVE_TransParam(conn, (long)Z_LVAL_PP(arg2), key, Z_STRVAL_PP(arg4), Z_STRVAL_PP(arg5));
- break;
-
- default:
- convert_to_string_ex(arg4);
- retval = MCVE_TransParam(conn, (long)Z_LVAL_PP(arg2), key, Z_STRVAL_PP(arg4));
- break;
- }
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_transsend(resource conn, long identifier)
- Finalize and send the transaction */
-PHP_FUNCTION(m_transsend)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_TransSend(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto string m_responseparam(resource conn, long identifier, string key)
- Get a custom response parameter */
-PHP_FUNCTION(m_responseparam)
-{
- MCVE_CONN *conn;
- const char *retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
- convert_to_string_ex(arg3);
-
- retval = MCVE_ResponseParam(conn, Z_LVAL_PP(arg2), Z_STRVAL_PP(arg3));
-
- if (retval == NULL) {
- RETVAL_STRING("",1);
- } else {
- RETVAL_STRING(estrdup(retval), 0);
- }
-}
-/* }}} */
-
-#if BRAD_0
-#if LIBMONETRA_VERSION >= 050000
-/* {{{ proto array m_responsekeys(resource conn, long identifier)
- Returns array of strings which represents the keys that can be used
- for response parameters on this transaction
-*/
-PHP_FUNCTION(m_responsekeys)
-{
- MCVE_CONN *conn;
- char **retval;
- int num_keys, i;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
- convert_to_long_ex(arg2);
-
- array_init(return_value);
-
- retval=M_ResponseKeys(conn, Z_LVAL_PP(arg2), &num_keys);
- if (retval != NULL) {
- for (i=0; i<num_keys; i++)
- add_next_index_string(return_value, retval[i], 1);
- M_FreeResponseKeys(retval, num_keys);
- }
-}
-/* }}} */
-#endif
-#endif
-
-/* {{{ proto string m_getuserparam(resource conn, long identifier, int key)
- Get a user response parameter */
-PHP_FUNCTION(m_getuserparam)
-{
- MCVE_CONN *conn;
- const char *retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
-
- retval = MCVE_GetUserParam(conn, Z_LVAL_PP(arg2), Z_LVAL_PP(arg3));
-
- if (retval == NULL) {
- RETVAL_STRING("",1);
- } else {
- RETVAL_STRING(estrdup(retval), 0);
- }
-}
-/* }}} */
-
-/* {{{ proto int m_returnstatus(resource conn, int identifier)
- Check to see if the transaction was successful */
-PHP_FUNCTION(m_returnstatus)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_ReturnStatus(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_returncode(resource conn, int identifier)
- Grab the exact return code from the transaction */
-PHP_FUNCTION(m_returncode)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_ReturnCode(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_transactionitem(resource conn, int identifier)
- Get the ITEM number in the associated batch for this transaction */
-PHP_FUNCTION(m_transactionitem)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_TransactionItem(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_transactionavs(resource conn, int identifier)
- Get the Address Verification return status */
-PHP_FUNCTION(m_transactionavs)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_TransactionAVS(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-
-/* {{{ proto int m_transactioncv(resource conn, int identifier)
- Get the CVC2/CVV2/CID return status */
-PHP_FUNCTION(m_transactioncv)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_TransactionCV(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_transactionbatch(resource conn, int identifier)
- Get the batch number associated with the transaction */
-PHP_FUNCTION(m_transactionbatch)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_TransactionBatch(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_transactionid(resource conn, int identifier)
- Get the unique system id for the transaction
-*/
-PHP_FUNCTION(m_transactionid)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_TransactionID(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto string m_transactionauth(resource conn, int identifier)
- Get the authorization number returned for the transaction (alpha-numeric) */
-PHP_FUNCTION(m_transactionauth)
-{
- MCVE_CONN *conn;
- const char *retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_TransactionAuth(conn, Z_LVAL_PP(arg2));
-
- if (retval == NULL) {
- RETVAL_STRING("",1);
- } else {
- RETVAL_STRING(estrdup(retval), 0);
- }
-}
-/* }}} */
-
-/* {{{ proto string m_transactiontext(resource conn, int identifier)
- Get verbiage (text) return from MCVE or processing institution */
-PHP_FUNCTION(m_transactiontext)
-{
- MCVE_CONN *conn;
- const char *retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_TransactionText(conn, Z_LVAL_PP(arg2));
- if (retval == NULL) {
- RETVAL_STRING("",1);
- } else {
- RETVAL_STRING(estrdup(retval), 0);
- }
-}
-/* }}} */
-
-/* {{{ proto int m_monitor(resource conn)
- Perform communication with MCVE (send/receive data) Non-blocking */
-PHP_FUNCTION(m_monitor)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg, -1, "mcve connection", le_conn);
-
- retval = MCVE_Monitor(conn);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_transinqueue(resource conn)
- Number of transactions in client-queue */
-PHP_FUNCTION(m_transinqueue)
-{
- MCVE_CONN *conn;
- int retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg, -1, "mcve connection", le_conn);
-
- retval = MCVE_TransInQueue(conn);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_checkstatus(resource conn, int identifier)
- Check to see if a transaction has completed */
-PHP_FUNCTION(m_checkstatus)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_CheckStatus(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_completeauthorizations(resource conn, int &array)
- Number of complete authorizations in queue, returning an array of their identifiers */
-PHP_FUNCTION(m_completeauthorizations)
-{
- MCVE_CONN *conn;
- long i, *list, listnum;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2))
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- listnum = MCVE_CompleteAuthorizations(conn, &list);
-
- if (listnum) {
- /* should use ZVAL_DESTRUCTOR */
- pval_destructor(*arg2);
- array_init(*arg2);
- for (i = 0; i < listnum; i++)
- add_index_long(*arg2, i, list[i]);
- free(list);
- }
-
- RETURN_LONG(listnum);
-}
-/* }}} */
-
-/* {{{ proto int m_sale(resource conn, string username, string password, string trackdata, string account, string expdate, float amount, string street, string zip, string cv, string comments, string clerkid, string stationid, int ptrannum)
- Send a SALE to MCVE */
-PHP_FUNCTION(m_sale)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8;
- zval **arg9, **arg10, **arg11, **arg12, **arg13, **arg14;
-
- if (ZEND_NUM_ARGS() != 14 || zend_get_parameters_ex(14, &arg1, &arg2,
- &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, &arg10, &arg11,
- &arg12, &arg13, &arg14) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_string_ex(arg4);
- convert_to_string_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_double_ex(arg7);
- convert_to_string_ex(arg8);
- convert_to_string_ex(arg9);
- convert_to_string_ex(arg10);
- convert_to_string_ex(arg11);
- convert_to_string_ex(arg12);
- convert_to_string_ex(arg13);
- convert_to_long_ex(arg14);
-
- retval = MCVE_Sale(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3),
- Z_STRVAL_PP(arg4), Z_STRVAL_PP(arg5), Z_STRVAL_PP(arg6),
- Z_DVAL_PP(arg7), Z_STRVAL_PP(arg8), Z_STRVAL_PP(arg9),
- Z_STRVAL_PP(arg10), Z_STRVAL_PP(arg11), Z_STRVAL_PP(arg12),
- Z_STRVAL_PP(arg13), Z_LVAL_PP(arg14));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_preauth(resource conn, string username, string password, string trackdata, string account, string expdate, float amount, string street, string zip, string cv, string comments, string clerkid, string stationid, int ptrannum)
- Send a PREAUTHORIZATION to MCVE */
-PHP_FUNCTION(m_preauth)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8;
- zval **arg9, **arg10, **arg11, **arg12, **arg13, **arg14;
-
- if (ZEND_NUM_ARGS() != 14 || zend_get_parameters_ex(14, &arg1, &arg2,
- &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, &arg10, &arg11,
- &arg12, &arg13, &arg14) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_string_ex(arg4);
- convert_to_string_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_double_ex(arg7);
- convert_to_string_ex(arg8);
- convert_to_string_ex(arg9);
- convert_to_string_ex(arg10);
- convert_to_string_ex(arg11);
- convert_to_string_ex(arg12);
- convert_to_string_ex(arg13);
- convert_to_long_ex(arg14);
-
- retval = MCVE_PreAuth(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3),
- Z_STRVAL_PP(arg4), Z_STRVAL_PP(arg5), Z_STRVAL_PP(arg6),
- Z_DVAL_PP(arg7), Z_STRVAL_PP(arg8), Z_STRVAL_PP(arg9),
- Z_STRVAL_PP(arg10), Z_STRVAL_PP(arg11), Z_STRVAL_PP(arg12),
- Z_STRVAL_PP(arg13), Z_LVAL_PP(arg14));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_override(resource conn, string username, string password, string trackdata, string account, string expdate, float amount, string street, string zip, string cv, string comments, string clerkid, string stationid, int ptrannum)
- Send an OVERRIDE to MCVE */
-PHP_FUNCTION(m_override)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8;
- zval **arg9, **arg10, **arg11, **arg12, **arg13, **arg14;
-
- if (ZEND_NUM_ARGS() != 14 || zend_get_parameters_ex(14, &arg1, &arg2,
- &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, &arg10, &arg11,
- &arg12, &arg13, &arg14) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_string_ex(arg4);
- convert_to_string_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_double_ex(arg7);
- convert_to_string_ex(arg8);
- convert_to_string_ex(arg9);
- convert_to_string_ex(arg10);
- convert_to_string_ex(arg11);
- convert_to_string_ex(arg12);
- convert_to_string_ex(arg13);
- convert_to_long_ex(arg14);
-
- retval = MCVE_Override(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3),
- Z_STRVAL_PP(arg4), Z_STRVAL_PP(arg5), Z_STRVAL_PP(arg6),
- Z_DVAL_PP(arg7), Z_STRVAL_PP(arg8), Z_STRVAL_PP(arg9),
- Z_STRVAL_PP(arg10), Z_STRVAL_PP(arg11), Z_STRVAL_PP(arg12),
- Z_STRVAL_PP(arg13), Z_LVAL_PP(arg14));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_void(resource conn, string username, string password, int sid, int ptrannum)
- VOID a transaction in the settlement queue */
-PHP_FUNCTION(m_void)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5;
-
- if (ZEND_NUM_ARGS() != 5 ||
- zend_get_parameters_ex(5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_long_ex(arg4);
- convert_to_long_ex(arg5);
-
- retval = MCVE_Void(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3), (MCVE_int64)Z_LVAL_PP(arg4), Z_LVAL_PP(arg5));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_preauthcompletion(resource conn, string username, string password, float finalamount, int sid, int ptrannum)
- Complete a PREAUTHORIZATION... Ready it for settlement */
-PHP_FUNCTION(m_preauthcompletion)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6;
-
- if (ZEND_NUM_ARGS() != 6 ||
- zend_get_parameters_ex(6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_long_ex(arg5);
- convert_to_long_ex(arg6);
-
- retval = MCVE_PreAuthCompletion(conn, Z_STRVAL_PP(arg2),
- Z_STRVAL_PP(arg3), Z_DVAL_PP(arg4), Z_LVAL_PP(arg5), Z_LVAL_PP(arg6));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_force(resiurce conn, string username, string password, string trackdata, string account, string expdate, float amount, string authcode, string comments, string clerkid, string stationid, int ptrannum)
- Send a FORCE to MCVE. (typically, a phone-authorization) */
-PHP_FUNCTION(m_force)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8;
- zval **arg9, **arg10, **arg11, **arg12;
-
- if (ZEND_NUM_ARGS() != 12 || zend_get_parameters_ex(12, &arg1, &arg2,
- &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, &arg10, &arg11, &arg12) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_string_ex(arg4);
- convert_to_string_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_double_ex(arg7);
- convert_to_string_ex(arg8);
- convert_to_string_ex(arg9);
- convert_to_string_ex(arg10);
- convert_to_string_ex(arg11);
- convert_to_long_ex(arg12);
-
- retval = MCVE_Force(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3),
- Z_STRVAL_PP(arg4), Z_STRVAL_PP(arg5), Z_STRVAL_PP(arg6),
- Z_DVAL_PP(arg7), Z_STRVAL_PP(arg8), Z_STRVAL_PP(arg9),
- Z_STRVAL_PP(arg10), Z_STRVAL_PP(arg11), Z_LVAL_PP(arg12));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_return(int conn, string username, string password, string trackdata, string account, string expdate, float amount, string comments, string clerkid, string stationid, int ptrannum)
- Issue a RETURN or CREDIT to MCVE */
-PHP_FUNCTION(m_return)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8;
- zval **arg9, **arg10, **arg11;
-
- if (ZEND_NUM_ARGS() != 11 || zend_get_parameters_ex(11, &arg1, &arg2,
- &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, &arg10, &arg11) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_string_ex(arg4);
- convert_to_string_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_double_ex(arg7);
- convert_to_string_ex(arg8);
- convert_to_string_ex(arg9);
- convert_to_string_ex(arg10);
- convert_to_long_ex(arg11);
-
- retval = MCVE_Return(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3),
- Z_STRVAL_PP(arg4), Z_STRVAL_PP(arg5), Z_STRVAL_PP(arg6),
- Z_DVAL_PP(arg7), Z_STRVAL_PP(arg8), Z_STRVAL_PP(arg9),
- Z_STRVAL_PP(arg10), Z_LVAL_PP(arg11));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-
-/* {{{ proto int m_settle(resource conn, string username, string password, string batch)
- Issue a settlement command to do a batch deposit */
-PHP_FUNCTION(m_settle)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_string_ex(arg4);
-
- retval = MCVE_Settle(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3), Z_STRVAL_PP(arg4));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_ub(resource conn, string username, string password)
- Get a list of all Unsettled batches */
-PHP_FUNCTION(m_ub)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
-
- retval = MCVE_Ub(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_qc(resource conn, string username, string password, string clerkid, string stationid, string comments, int ptrannum)
- Audit MCVE for a list of transactions in the outgoing queue */
-PHP_FUNCTION(m_qc)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7;
-
- if (ZEND_NUM_ARGS() != 7 ||
- zend_get_parameters_ex(7, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_string_ex(arg4);
- convert_to_string_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_long_ex(arg7);
-
- retval = MCVE_Qc(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3), Z_STRVAL_PP(arg4),
- Z_STRVAL_PP(arg5), Z_STRVAL_PP(arg6), Z_LVAL_PP(arg7));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_gut(resource conn, string username, string password, int type, string account, string clerkid, string stationid, string comments, int ptrannum, string startdate, string enddate)
- Audit MCVE for Unsettled Transactions */
-PHP_FUNCTION(m_gut)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8, **arg9, **arg10, **arg11;
-
- if (ZEND_NUM_ARGS() != 11 || zend_get_parameters_ex(11, &arg1, &arg2,
- &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, &arg10, &arg11) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_long_ex(arg4);
- convert_to_string_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_string_ex(arg7);
- convert_to_string_ex(arg8);
- convert_to_double_ex(arg9);
- convert_to_string_ex(arg10);
- convert_to_string_ex(arg11);
-
- retval = MCVE_Gut(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3), Z_LVAL_PP(arg4),
- Z_STRVAL_PP(arg5), Z_STRVAL_PP(arg6), Z_STRVAL_PP(arg7), Z_STRVAL_PP(arg8),
- Z_DVAL_PP(arg9), Z_STRVAL_PP(arg10),Z_STRVAL_PP(arg11));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_gl(int conn, string username, string password, int type, string account, string batch, string clerkid, string stationid, string comments, int ptrannum, string startdate, string enddate)
- Audit MCVE for settled transactions */
-PHP_FUNCTION(m_gl)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8, **arg9, **arg10, **arg11, **arg12;
-
- if (ZEND_NUM_ARGS() != 12 || zend_get_parameters_ex(12, &arg1, &arg2,
- &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, &arg10, &arg11, &arg12) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_long_ex(arg4);
- convert_to_string_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_string_ex(arg7);
- convert_to_string_ex(arg8);
- convert_to_string_ex(arg9);
- convert_to_double_ex(arg10);
- convert_to_string_ex(arg11);
- convert_to_string_ex(arg12);
-
- retval = MCVE_Gl(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3), Z_LVAL_PP(arg4),
- Z_STRVAL_PP(arg5), Z_STRVAL_PP(arg6), Z_STRVAL_PP(arg7), Z_STRVAL_PP(arg8),
- Z_STRVAL_PP(arg9), Z_DVAL_PP(arg10), Z_STRVAL_PP(arg11), Z_STRVAL_PP(arg12));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_gft(resource conn, string username, string password, int type, string account, string clerkid, string stationid, string comments, int ptrannum, string startdate, string enddate)
- Audit MCVE for Failed transactions
-*/
-PHP_FUNCTION(m_gft)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8, **arg9, **arg10, **arg11;
-
- if (ZEND_NUM_ARGS() != 11 || zend_get_parameters_ex(11, &arg1, &arg2,
- &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, &arg10, &arg11) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_long_ex(arg4);
- convert_to_string_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_string_ex(arg7);
- convert_to_string_ex(arg8);
- convert_to_long_ex(arg9);
- convert_to_string_ex(arg10);
- convert_to_string_ex(arg11);
-
- retval = MCVE_Gft(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3), Z_LVAL_PP(arg4),
- Z_STRVAL_PP(arg5), Z_STRVAL_PP(arg6), Z_STRVAL_PP(arg7), Z_STRVAL_PP(arg8),
- Z_LVAL_PP(arg9), Z_STRVAL_PP(arg10), Z_STRVAL_PP(arg11));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_chkpwd(resource conn, string username, string password)
- Verify Password */
-PHP_FUNCTION(m_chkpwd)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
-
- retval = MCVE_Chkpwd(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_bt(resource conn, string username, string password)
- Get unsettled batch totals */
-PHP_FUNCTION(m_bt)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
-
- retval = MCVE_Bt(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto string m_getcell(resource conn, int identifier, string column, int row)
- Get a specific cell from a comma delimited response by column name */
-PHP_FUNCTION(m_getcell)
-{
- MCVE_CONN *conn;
- const char *retval;
- zval **arg1, **arg2, **arg3, **arg4;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_long_ex(arg4);
-
- retval = MCVE_GetCell(conn, Z_LVAL_PP(arg2), Z_STRVAL_PP(arg3), Z_LVAL_PP(arg4));
-
- if (retval == NULL) {
- RETURN_STRING("", 1);
- } else {
- RETURN_STRING(estrdup(retval), 0);
- }
-}
-/* }}} */
-
-/* {{{ proto string m_getcellbynum(resource conn, int identifier, int column, int row)
- Get a specific cell from a comma delimited response by column number */
-PHP_FUNCTION(m_getcellbynum)
-{
- MCVE_CONN *conn;
- const char *retval;
- zval **arg1, **arg2, **arg3, **arg4;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
- convert_to_long_ex(arg4);
-
- retval = MCVE_GetCellByNum(conn, Z_LVAL_PP(arg2), Z_LVAL_PP(arg3), Z_LVAL_PP(arg4));
-
- if (retval == NULL) {
- RETURN_STRING("", 1);
- } else {
- RETURN_STRING(estrdup(retval), 0);
- }
-}
-/* }}} */
-
-/* {{{ proto int m_numcolumns(resource conn, int identifier)
- Number of columns returned in a comma delimited response */
-PHP_FUNCTION(m_numcolumns)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_NumColumns(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_numrows(resource conn, int identifier)
- Number of rows returned in a comma delimited response */
-PHP_FUNCTION(m_numrows)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_NumRows(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_iscommadelimited(resource conn, int identifier)
- Checks to see if response is comma delimited */
-PHP_FUNCTION(m_iscommadelimited)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_IsCommaDelimited(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_parsecommadelimited(resource conn, int identifier)
- Parse the comma delimited response so m_getcell, etc will work */
-PHP_FUNCTION(m_parsecommadelimited)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_ParseCommaDelimited(conn, Z_LVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto string m_getcommadelimited(resource conn, int identifier)
- Get the RAW comma delimited data returned from MCVE */
-PHP_FUNCTION(m_getcommadelimited)
-{
- MCVE_CONN *conn;
- const char *retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_GetCommaDelimited(conn, Z_LVAL_PP(arg2));
-
- RETURN_STRING(estrdup(retval), 0);
-}
-/* }}} */
-
-/* {{{ proto string m_getheader(resource conn, int identifier, int column_num)
- Get the name of the column in a comma-delimited response */
-PHP_FUNCTION(m_getheader)
-{
- MCVE_CONN *conn;
- const char *retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
-
- retval = MCVE_GetHeader(conn, Z_LVAL_PP(arg2), Z_LVAL_PP(arg3));
-
- RETURN_STRING(estrdup(retval), 0);
-}
-/* }}} */
-
-/* {{{ proto void m_destroyengine(void)
- Free memory associated with IP/SSL connectivity */
-PHP_FUNCTION(m_destroyengine)
-{
- MCVE_DestroyEngine();
- mcve_init = 0;
-}
-/* }}} */
-
-/* {{{ proto int m_chngpwd(resource conn, string admin_password, string new_password)
- Change the system administrator's password */
-PHP_FUNCTION(m_chngpwd)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
-
- retval = MCVE_Chngpwd(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_listusers(resource conn, string admin_password)
- List all users on MCVE system */
-PHP_FUNCTION(m_listusers)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
-
- retval = MCVE_ListUsers(conn, Z_STRVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_enableuser(resource conn, string admin_password, string username)
- Enable an inactive MCVE user account */
-PHP_FUNCTION(m_enableuser)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
-
- retval = MCVE_EnableUser(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_disableuser(resource conn, string admin_password, string username)
- Disable an active MCVE user account */
-PHP_FUNCTION(m_disableuser)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
-
- retval = MCVE_DisableUser(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_deluser(resource conn, string admin_password, string username)
- Delete an MCVE user account */
-PHP_FUNCTION(m_deluser)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
-
- retval = MCVE_DelUser(conn, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_liststats(resource conn, string admin_password)
- List statistics for all users on MCVE system */
-PHP_FUNCTION(m_liststats)
-{
- MCVE_CONN *conn;
- long retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
-
- convert_to_string_ex(arg2);
-
- retval = MCVE_ListStats(conn, Z_STRVAL_PP(arg2));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto resource m_initusersetup(void)
- Initialize structure to store user data */
-PHP_FUNCTION(m_initusersetup)
-{
- MCVE_UserSetup *usersetup;
-
- usersetup = emalloc(sizeof(MCVE_UserSetup));
-
- MCVE_InitUserSetup(usersetup);
-
- ZEND_REGISTER_RESOURCE(return_value, usersetup, le_user);
-}
-/* }}} */
-
-/* {{{ proto void m_deleteusersetup(resource usersetup)
- Deallocate data associated with usersetup structure */
-PHP_FUNCTION(m_deleteusersetup)
-{
- MCVE_UserSetup *usersetup;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(usersetup, MCVE_UserSetup *, arg, -1, "mcve user setup", le_user);
-
- MCVE_DeleteUserSetup(usersetup);
- efree(usersetup);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int m_adduserarg(resource usersetup, int argtype, string argval)
- Add a value to user configuration structure */
-PHP_FUNCTION(m_adduserarg)
-{
- MCVE_UserSetup *usersetup;
- long retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(usersetup, MCVE_UserSetup *, arg1, -1, "mcve user setup", le_user);
-
- convert_to_long_ex(arg2);
- convert_to_string_ex(arg3);
-
- retval = MCVE_AddUserArg(usersetup, Z_LVAL_PP(arg2), Z_STRVAL_PP(arg3));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto string m_getuserarg(resource usersetup, int argtype)
- Grab a value from usersetup structure */
-PHP_FUNCTION(m_getuserarg)
-{
- MCVE_UserSetup *usersetup;
- char *retval;
- zval **arg1, **arg2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(usersetup, MCVE_UserSetup *, arg1, -1, "mcve user setup", le_user);
-
- convert_to_long_ex(arg2);
-
- retval = MCVE_GetUserArg(usersetup, Z_LVAL_PP(arg2));
-
- RETURN_STRING(retval, 1);
-}
-/* }}} */
-
-/* {{{ proto int m_adduser(resource conn, string admin_password, int usersetup)
- Add an MCVE user using usersetup structure */
-PHP_FUNCTION(m_adduser)
-{
- MCVE_CONN *conn;
- MCVE_UserSetup *usersetup;
- long retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
- ZEND_FETCH_RESOURCE(usersetup, MCVE_UserSetup *, arg3, -1, "mcve user setup", le_user);
-
- convert_to_string_ex(arg2);
-
- retval = MCVE_AddUser(conn, Z_STRVAL_PP(arg2), usersetup);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int m_edituser(resource conn, string admin_password, int usersetup)
- Edit MCVE user using usersetup structure */
-PHP_FUNCTION(m_edituser)
-{
- MCVE_CONN *conn;
- MCVE_UserSetup *usersetup;
- long retval;
- zval **arg1, **arg2, **arg3;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
- ZEND_FETCH_RESOURCE(usersetup, MCVE_UserSetup *, arg3, -1, "mcve user setup", le_user);
-
- convert_to_string_ex(arg2);
-
- retval = MCVE_EditUser(conn, Z_STRVAL_PP(arg2), usersetup);
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-
-/* {{{ proto int m_uwait(long microsecs)
- Wait x microsecs */
-PHP_FUNCTION(m_uwait)
-{
- long retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(arg);
-
- retval = MCVE_uwait(Z_LVAL_PP(arg));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto string m_text_code(string code)
- Get a textual representation of the return_code */
-PHP_FUNCTION(m_text_code)
-{
- const char *retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(arg);
-
- retval = MCVE_TEXT_Code(Z_LVAL_PP(arg));
-
- if (retval == NULL) {
- RETVAL_STRING("",1);
- } else {
- RETVAL_STRING(estrdup(retval), 0);
- }
-}
-/* }}} */
-
-/* {{{ proto string m_text_avs(string code)
- Get a textual representation of the return_avs */
-PHP_FUNCTION(m_text_avs)
-{
- const char *retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(arg);
-
- retval = MCVE_TEXT_AVS(Z_LVAL_PP(arg));
-
- if (retval == NULL) {
- RETVAL_STRING("",1);
- } else {
- RETVAL_STRING(estrdup(retval), 0);
- }
-}
-/* }}} */
-
-/* {{{ proto string m_text_cv(int code)
- Get a textual representation of the return_cv */
-PHP_FUNCTION(m_text_cv)
-{
- const char *retval;
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(arg);
-
- retval = MCVE_TEXT_CV(Z_LVAL_PP(arg));
-
- if (retval == NULL) {
- RETVAL_STRING("",1);
- } else {
- RETVAL_STRING(estrdup(retval), 0);
- }
-}
-/* }}} */
-
-/* Map new funnction names to old function names for compatability */
-M_map_function(m_initengine, mcve_initengine)
-M_map_function(m_initconn, mcve_initconn)
-M_map_function(m_deleteresponse, mcve_deleteresponse)
-M_map_function(m_destroyconn, mcve_destroyconn)
-M_map_function(m_setdropfile, mcve_setdropfile)
-M_map_function(m_setip, mcve_setip)
-M_map_function(m_setssl, mcve_setssl)
-M_map_function(m_setssl_files, mcve_setssl_files)
-M_map_function(m_settimeout, mcve_settimeout)
-M_map_function(m_setblocking, mcve_setblocking)
-M_map_function(m_verifyconnection, mcve_verifyconnection)
-M_map_function(m_verifysslcert, mcve_verifysslcert)
-M_map_function(m_maxconntimeout, mcve_maxconntimeout)
-M_map_function(m_connectionerror, mcve_connectionerror)
-M_map_function(m_deletetrans, mcve_deletetrans)
-M_map_function(m_connect, mcve_connect)
-M_map_function(m_transnew, mcve_transnew)
-M_map_function(m_transparam, mcve_transparam)
-M_map_function(m_transsend, mcve_transsend)
-M_map_function(m_ping, mcve_ping)
-M_map_function(m_responseparam, mcve_responseparam)
-M_map_function(m_returnstatus, mcve_returnstatus)
-M_map_function(m_returncode, mcve_returncode)
-M_map_function(m_transactionssent, mcve_transactionssent)
-M_map_function(m_transactionitem, mcve_transactionitem)
-M_map_function(m_transactionbatch, mcve_transactionbatch)
-M_map_function(m_transactionid, mcve_transactionid)
-M_map_function(m_transactionauth, mcve_transactionauth)
-M_map_function(m_transactiontext, mcve_transactiontext)
-M_map_function(m_transactionavs, mcve_transactionavs)
-M_map_function(m_transactioncv, mcve_transactioncv)
-M_map_function(m_getuserparam, mcve_getuserparam)
-M_map_function(m_monitor, mcve_monitor)
-M_map_function(m_transinqueue, mcve_transinqueue)
-M_map_function(m_checkstatus, mcve_checkstatus)
-M_map_function(m_completeauthorizations, mcve_completeauthorizations)
-M_map_function(m_sale, mcve_sale)
-M_map_function(m_preauth, mcve_preauth)
-M_map_function(m_void, mcve_void)
-M_map_function(m_preauthcompletion, mcve_preauthcompletion)
-M_map_function(m_force, mcve_force)
-M_map_function(m_override, mcve_override)
-M_map_function(m_return, mcve_return)
-M_map_function(m_iscommadelimited, mcve_iscommadelimited)
-M_map_function(m_parsecommadelimited, mcve_parsecommadelimited)
-M_map_function(m_getcommadelimited, mcve_getcommadelimited)
-M_map_function(m_getcell, mcve_getcell)
-M_map_function(m_getcellbynum, mcve_getcellbynum)
-M_map_function(m_numcolumns, mcve_numcolumns)
-M_map_function(m_numrows, mcve_numrows)
-M_map_function(m_getheader, mcve_getheader)
-M_map_function(m_destroyengine, mcve_destroyengine)
-M_map_function(m_settle, mcve_settle)
-M_map_function(m_gut, mcve_gut)
-M_map_function(m_gl, mcve_gl)
-M_map_function(m_gft, mcve_gft)
-M_map_function(m_qc, mcve_qc)
-M_map_function(m_ub, mcve_ub)
-M_map_function(m_chkpwd, mcve_chkpwd)
-M_map_function(m_bt, mcve_bt)
-M_map_function(m_uwait, mcve_uwait)
-M_map_function(m_text_code, mcve_text_code)
-M_map_function(m_text_avs, mcve_text_avs)
-M_map_function(m_text_cv, mcve_text_cv)
-M_map_function(m_chngpwd, mcve_chngpwd)
-M_map_function(m_listusers, mcve_listusers)
-M_map_function(m_adduser, mcve_adduser)
-M_map_function(m_enableuser, mcve_enableuser)
-M_map_function(m_disableuser, mcve_disableuser)
-M_map_function(m_getuserarg, mcve_getuserarg)
-M_map_function(m_adduserarg, mcve_adduserarg)
-M_map_function(m_deleteusersetup, mcve_deleteusersetup)
-M_map_function(m_initusersetup, mcve_initusersetup)
-M_map_function(m_deluser, mcve_deluser)
-M_map_function(m_edituser, mcve_edituser)
-M_map_function(m_liststats, mcve_liststats)
-
-#endif
-
-/* END OF MCVE PHP EXTENSION */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
-
+++ /dev/null
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Dimitris Souflis, Nikos Mavroyanopoulos |
- | for Ovrimos S.A. |
- | |
- | Contact support@ovrimos.com for questions regarding this module |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_globals.h"
-#include "zend_API.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/info.h"
-
-#include <sqlcli.h> /* ovrimos header
- */
-
-#ifndef WIN32 /* stricmp is defined in sqlcli */
-# define stricmp strcasecmp
-#endif
-
-
-PHP_MINFO_FUNCTION(ovrimos)
-{
- php_printf(""Ovrimos" module<br />\n");
-}
-
-/* Main User Functions
- */
-
-/* ovrimos_connect() currently does not support secure (SSL/TLS) connections.
- * As an alternative you can use the unixODBC driver available at
- * http://www.ovrimos.com/download which supports SSL.
- * Contact support@ovrimos.com for more information.
- */
-
-/* 2001-07-27: ovrimos_close_all() function was removed in order
- * for this module to be reentrant.
- */
-
-
-/* structures introduced in order to support the old ovrimos-php-api with
- * the new multi-threaded library (old works with the old library).
- * This version is reentrant.
- *
- * The only limitation is that a connection ( as returned by ovrimos_connect())
- * may only be accessed by one thread (but this is the case in php now).
- */
-
-typedef struct {
- SQLS statement;
- int longreadlen;
- struct _CON_STATE* con_state;
-} STATEMENT;
-
-typedef struct _CON_STATE {
- SQLH connection;
- STATEMENT * statements;
- int nstatements;
-} CON_STATE;
-
-typedef STATEMENT* PSTATEMENT;
-typedef CON_STATE* PCON_STATE;
-
-static void column_to_string(SQLS stmt, int i, char *buffer, int *len, PSTATEMENT pstmt);
-
-/* {{{ proto int ovrimos_connect(string host, string db, string user, string password)
- Connect to an Ovrimos database */
-PHP_FUNCTION(ovrimos_connect)
-{
- pval *arg1, *arg2, *arg3, *arg4;
- PCON_STATE state;
- SQLH conn = 0;
-
- if (ARG_COUNT(ht) != 4
- || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg1);
- convert_to_string(arg2);
- convert_to_string(arg3);
- convert_to_string(arg4);
-
- if (!sqlConnect
- (Z_STRVAL_P(arg1), Z_STRVAL_P(arg2), Z_STRVAL_P(arg3),
- Z_STRVAL_P(arg4), &conn, 0)) {
- RETURN_LONG(0);
- }
-
- state = ecalloc( 1, sizeof(CON_STATE));
-
- state->connection = conn;
- state->statements = NULL;
- state->nstatements = 0;
-
- RETURN_LONG( (long)state);
-}
-
-/* }}} */
-
-/* {{{ proto void ovrimos_close(int connection)
- Close a connection */
-PHP_FUNCTION(ovrimos_close)
-{
- pval *arg1;
- int i;
- PCON_STATE state;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE
- || Z_TYPE_P(arg1) != IS_LONG) {
- WRONG_PARAM_COUNT;
- }
-
- state = (PCON_STATE) Z_LVAL_P(arg1);
-
- /* free all the statements associated with
- * the connection. (called results in php)
- */
-
- for (i=0;i < state->nstatements;i++) {
- if ( state->statements[i].statement!=NULL) {
- sqlFreeStmt( state->statements[i].statement);
- }
- }
- if (state->statements!=NULL)
- efree( state->statements);
-
- /* close the SQL_Handle
- */
- sqlDisconnect( state->connection);
-
- efree( state);
-
- return;
-}
-
-/* }}} */
-
-
-/* {{{ proto bool ovrimos_longreadlen(int result_id, int length)
- Handle LONG columns */
-PHP_FUNCTION(ovrimos_longreadlen)
-{
- pval *arg1, *arg2;
- PSTATEMENT stmt;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_long(arg2);
-
- stmt = (PSTATEMENT) Z_LVAL_P(arg1);
-
- stmt->longreadlen = Z_LVAL_P(arg2);
- RETURN_TRUE;
-}
-
-/* }}} */
-
-#define DEFAULT_LONGREADLEN 0
-
-/* These two functions are quite expensive. Some optimization may be
- * done in a later version.
- */
-static int local_sqlAllocStmt( PCON_STATE state, SQLH conn, SQLS *stmt, PSTATEMENT* pstmt) {
-int index, ret;
-
- ret = sqlAllocStmt( conn, stmt);
- if (!ret) return ret;
-
- state->nstatements++;
- state->statements = erealloc(state->statements, state->nstatements*sizeof( STATEMENT));
-
- index = state->nstatements - 1;
- state->statements[ index].statement = (*stmt);
- state->statements[ index].longreadlen = DEFAULT_LONGREADLEN;
- state->statements[ index].con_state = state;
-
- *pstmt = &state->statements[ index];
-
- return 1;
-}
-
-static int local_sqlFreeStmt( PSTATEMENT statement, SQLS stmt) {
-int j, i;
-PSTATEMENT new_statements;
-PCON_STATE state = statement->con_state;
-
- sqlFreeStmt( stmt);
-
- if (state->nstatements-1 == 0) {
- efree( state->statements);
- state->statements = NULL;
- state->nstatements--;
-
- return 1;
- }
-
- new_statements = safe_emalloc( (state->nstatements-1), sizeof(STATEMENT), 0);
-
- for (i=j=0;i<state->nstatements;i++) {
- if (state->statements->statement != stmt) {
- new_statements[j].statement = state->statements[i].statement;
- new_statements[j].longreadlen = state->statements[i].longreadlen;
- new_statements[j++].con_state = state->statements[i].con_state;
- }
- }
-
- efree( state->statements);
- state->statements = new_statements;
- state->nstatements--;
-
- return 1; /* true */
-}
-
-/* {{{ proto int ovrimos_prepare(int connection_id, string query)
- Prepares a statement for execution */
-PHP_FUNCTION(ovrimos_prepare)
-{
- pval *arg1, *arg2;
- SQLH conn;
- char *query;
- SQLS stmt;
- PCON_STATE state;
- PSTATEMENT pstmt;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_string(arg2);
-
- state = (PCON_STATE) Z_LVAL_P(arg1);
-
- conn = (SQLH) state->connection;
- query = Z_STRVAL_P(arg2);
-
- if (!local_sqlAllocStmt( state, conn, &stmt, &pstmt)) {
- RETURN_FALSE;
- }
- if (!sqlPrepare(stmt, query)) {
- local_sqlFreeStmt( pstmt, stmt);
- RETURN_FALSE;
- }
- if (!sqlGetOutputColDescr(stmt)) {
- local_sqlFreeStmt( pstmt, stmt);
- RETURN_FALSE;
- }
- if (!sqlGetParamDescr(stmt)) {
- local_sqlFreeStmt( pstmt, stmt);
- RETURN_FALSE;
- }
-
- /* returns a result id which is actually a
- * pointer to a STATEMENT structure;
- */
- RETURN_LONG( (long)pstmt);
-}
-
-/* }}} */
-
-/*
- * Execute prepared SQL statement. Supports only input parameters.
- */
-/* {{{ proto bool ovrimos_execute(int result_id [, array parameters_array])
- Execute a prepared statement */
-PHP_FUNCTION(ovrimos_execute)
-{
- pval *arg1, *arg2;
- SQLS stmt;
- int numArgs;
- int icol, colnb;
- PSTATEMENT pstmt;
-
- numArgs = ARG_COUNT(ht);
-
- if (getParameters(ht, numArgs, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg1);
-
- stmt = pstmt->statement;
- colnb = sqlGetParamNb(stmt);
-
- if (colnb != 0) {
- pval **tmp;
- int arr_elem;
-
- if (Z_TYPE_P(arg2) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not an array in call to ovrimos_execute()");
- RETURN_FALSE;
- }
- arr_elem = zend_hash_num_elements(Z_ARRVAL_P(arg2));
- if (arr_elem < colnb) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not enough parameters in call to ovrimos_execute(): %d instead of %d", arr_elem, colnb);
- RETURN_FALSE;
- }
-
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(arg2));
-
- for (icol = 0; icol < colnb; icol++) {
- int len;
- cvt_error err;
- bool ret;
- char *msg;
- char buffer[10240];
- sql_type to_type = sqlGetParamSQLType(stmt, icol);
- sql_type from_type;
-
- if (zend_hash_get_current_data
- (Z_ARRVAL_P(arg2), (void **) &tmp) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error getting parameter %d in call to ovrimos_execute()", icol);
- RETURN_FALSE;
- }
- convert_to_string(*tmp);
- if (Z_TYPE_PP(tmp) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error converting parameter %d to string in call to ovrimos_execute()", icol);
- RETURN_FALSE;
- }
-
- /* PHP data to param type */
- Z_TYPE(from_type) = T_VARCHAR;
- from_type.u.length = Z_STRLEN_PP(tmp);
-
- *buffer = 0;
- memcpy(buffer + 1, Z_STRVAL_PP(tmp),
- from_type.u.length);
- buffer[from_type.u.length + 1] = 0;
-
- ret =
- type_convert(buffer, &from_type, &to_type, 0,
- &err);
- switch (err) {
- case cvt_trunc:
- msg = "Data truncated";
- break;
- case cvt_range:
- msg = "Numeric value out of range";
- break;
- case cvt_prec:
- msg = "Precision lost";
- break;
- case cvt_incomp:
- msg =
- "Restricted data type attribute violation";
- break;
- case cvt_no:
- msg = "Conversion failed";
- break;
- default:
- msg = "Unknown error";
- break;
- }
- if (!ret) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error converting parameter %d: %s in call to ovrimos_execute()", icol, msg);
- RETURN_FALSE;
- }
-
- len = sql_type_size(to_type) - 1;
- if (!sqlPutParam(stmt, icol, buffer + 1, len)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could send parameter %d (%d bytes) in call to ovrimos_execute()", icol, len);
- RETURN_FALSE;
- }
- }
- }
-
- if (!sqlExec(stmt)) {
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto string ovrimos_cursor(int result_id)
- Get cursor name */
-PHP_FUNCTION(ovrimos_cursor)
-{
- char cname[126];
- pval *arg1;
- SQLS stmt;
- PSTATEMENT pstmt;
-
- if (getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
-
- pstmt = (PSTATEMENT) Z_LVAL_P(arg1);
- stmt = pstmt->statement;
-
- if (!sqlGetCursorName(stmt, cname)) {
- RETURN_FALSE;
- }
- RETURN_STRING(cname, 1);
-}
-
-/* }}} */
-
-/* This function returns a result id. The result ID is
- * a pointer to a STATEMENT structure.
- * Every result is mapped to a statement.
- */
-
-/* {{{ proto int ovrimos_exec(int connection_id, string query)
- Prepare and execute an SQL statement */
-PHP_FUNCTION(ovrimos_exec)
-{
- pval *arg1, *arg2;
- SQLH conn;
- SQLS stmt;
- int numArgs;
- char *query;
- PSTATEMENT pstmt;
- PCON_STATE state;
-
- numArgs = ARG_COUNT(ht);
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_string(arg2);
-
- state = (PCON_STATE) Z_LVAL_P(arg1);
- conn = state->connection;
- query = Z_STRVAL_P(arg2);
-
- if (!local_sqlAllocStmt( state, conn, &stmt, &pstmt)) {
- RETURN_FALSE;
- }
-
- if (!sqlExecDirect(stmt, query)) {
- local_sqlFreeStmt( pstmt, stmt);
- RETURN_FALSE;
- }
- if (!sqlGetOutputColDescr(stmt)) {
- local_sqlFreeStmt( pstmt, stmt);
- RETURN_FALSE;
- }
- if (!sqlGetParamDescr(stmt)) {
- local_sqlFreeStmt( pstmt, stmt);
- RETURN_FALSE;
- }
-
- RETURN_LONG( (long)pstmt);
-}
-
-/* }}} */
-
-/* {{{ column_to_string
- */
-static void column_to_string(SQLS stmt, int i, char *buffer, int *len, PSTATEMENT pstmt)
-{
- const char *bf = sqlColValue(stmt, i, 0);
- int longreadlen;
-
- longreadlen = pstmt->longreadlen;
-
- switch (sqlGetOutputColType(stmt, i)) {
- case T_BIGINT:
- case T_UBIGINT:{
- switch (sqlGetOutputColType(stmt, i)) {
- case T_BIGINT:
- printsint64(Read(sint64, bf), buffer);
- break;
- case T_UBIGINT:
- printuint64(Read(uint64, bf), buffer);
- break;
- }
- *len = strlen(buffer);
- }
- break;
- case T_INTEGER:
- sprintf(buffer, "%11d", Read(sint32, bf));
- *len = strlen(buffer);
- break;
- case T_UINTEGER:
- sprintf(buffer, "%10u", Read(uint32, bf));
- *len = strlen(buffer);
- break;
- case T_SMALLINT:
- sprintf(buffer, "%6hd", Read(sint16, bf));
- *len = strlen(buffer);
- break;
- case T_USMALLINT:
- sprintf(buffer, "%5hu", Read(uint16, bf));
- *len = strlen(buffer);
- break;
- case T_TINYINT:
- sprintf(buffer, "%4hd", (sint16) Read(sint8, bf));
- *len = strlen(buffer);
- break;
- case T_UTINYINT:
- sprintf(buffer, "%3hu", (uint16) Read(uint8, bf));
- *len = strlen(buffer);
- break;
- case T_BIT:
- sprintf(buffer, "%s",
- (Read(uint8, bf) == 0) ? "off" : "on");
- *len = strlen(buffer);
- break;
- case T_REAL:
- sprintf(buffer, "%9.7g", (double) Read(float, bf));
- *len = strlen(buffer);
- break;
-
- case T_FLOAT:
- case T_DOUBLE:
- sprintf(buffer, "%19.17g", Read(double, bf));
- *len = strlen(buffer);
- break;
- case T_DECIMAL:
- case T_NUMERIC:{
- int prec = sqlGetOutputColPrecision(stmt, i);
- int scale = sqlGetOutputColScale(stmt, i);
- sprintf(buffer, "%*.*f", prec + 2, scale,
- Read(double, bf));
- *len = strlen(buffer);
- } break;
- case T_CHAR:
- case T_VARCHAR:
- strcpy(buffer, bf);
- *len = strlen(buffer);
- break;
- case T_UNI_CHAR:
- case T_UNI_VARCHAR:
- uni_strcpy((uni_char *) buffer, (uni_char *) bf);
- *len = uni_strlen((uni_char *) buffer);
- break;
- case T_BINARY:{
- int sz = sqlGetOutputColLength(stmt, i);
- memcpy(buffer, bf, sz);
- *len = sz;
- } break;
-
- case T_VARBINARY:{
- int sz = Read(uint16, bf);
- memcpy(buffer, bf + 2, sz);
- *len = sz;
- } break;
-
- case T_DATE:{
- if (!sql_date_to_str((uint32 *) bf, buffer)) {
- strcpy(buffer, "Error!");
- }
- }
- break;
-
- case T_TIME:{
- int prec = sqlGetOutputColPrecision(stmt, i);
- if (!sql_time_to_str
- ((uint32 *) bf, prec, 0, buffer)) {
- strcpy(buffer, "Error!");
- }
- }
- break;
-
- case T_TIMESTAMP:{
- int prec = sqlGetOutputColPrecision(stmt, i);
- if (!sql_timestamp_to_str
- ((uint32 *) bf, prec, 0, buffer)) {
- strcpy(buffer, "Error!");
- }
-
- }
- break;
-
- case T_LONGVARCHAR:
- case T_LONGVARBINARY:{
- if (longreadlen == 0) {
- *buffer = 0;
- *len = 0;
- } else
- if (!sqlColValueLong
- (stmt, i, 0, 0, longreadlen, buffer, len)) {
- strcpy(buffer, "Error!");
- }
- }
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto bool ovrimos_fetch_into(int result_id, array result_array [, string how [, int rownumber]])
- Fetch one result row into an array
- how: 'Next' (default), 'Prev', 'First', 'Last', 'Absolute'
- */
-PHP_FUNCTION(ovrimos_fetch_into)
-{
- int numArgs;
- char *s_how;
- typedef enum { h_next = 0, h_prev, h_first, h_last, h_absolute
- } h_type;
- h_type how = h_next; /* default */
- sint32 rownum = 0;
- pval *arg_id, *arg_how = 0, *arg_row = 0, *arr, *tmp;
- SQLS stmt;
- PSTATEMENT pstmt;
- int icol, colnb;
- bool ret=0;
- numArgs = ARG_COUNT(ht);
-
- switch (numArgs) {
- case 2:
- if (getParameters(ht, 2, &arg_id, &arr) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 3:
- if (getParameters(ht, 3, &arg_id, &arr, &arg_how) ==
- FAILURE) WRONG_PARAM_COUNT;
- break;
- case 4:
- if (getParameters(ht, 4, &arg_id, &arr, &arg_how, &arg_row)
- == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg_id);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg_id);
-
- stmt = pstmt->statement;
-
- if (arg_how != 0) {
- if (Z_TYPE_P(arg_how) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Third argument not string in ovrimos_fetch_into()");
- RETURN_FALSE;
- }
- s_how = Z_STRVAL_P(arg_how);
- if (stricmp(s_how, "next") == 0) {
- how = h_next;
- } else if (stricmp(s_how, "prev") == 0) {
- how = h_prev;
- } else if (stricmp(s_how, "first") == 0) {
- how = h_first;
- } else if (stricmp(s_how, "last") == 0) {
- how = h_last;
- } else if (stricmp(s_how, "absolute") == 0) {
- how = h_absolute;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Third argument not valid in ovrimos_fetch_into()");
- RETURN_FALSE;
- }
- if (arg_row == 0 && how == h_absolute) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Fourth argument is required for ABSOLUTE in ovrimos_fetch_into()");
- RETURN_FALSE;
- }
- if (arg_row != 0) {
- convert_to_long(arg_row);
- rownum = Z_LVAL_P(arg_row);
- switch (how) {
- case h_next:
- case h_prev:
- rownum--; /* Next 1 should send FUNC_CURSOR_NEXT(0) */
- break;
- default:
- break;
- }
- }
- }
-
- if (Z_TYPE_P(arr) != IS_ARRAY) {
- array_init(arr);
- }
- switch (how) {
- case h_absolute:
- case h_first:
- ret = sqlCursorFirst(stmt, rownum);
- break;
- case h_last:
- ret = sqlCursorLast(stmt, rownum);
- break;
- case h_next:
- ret = sqlCursorNext(stmt, rownum);
- break;
- case h_prev:
- ret = sqlCursorPrev(stmt, rownum);
- break;
- }
- if (!ret) {
- RETURN_FALSE;
- }
-
- colnb = sqlGetOutputColNb(stmt);
- for (icol = 0; icol < colnb; icol++) {
- int len;
- char buffer[10240];
- tmp = (pval *) emalloc(sizeof(pval));
- tmp->refcount = 1;
- Z_TYPE_P(tmp) = IS_STRING;
- Z_STRLEN_P(tmp) = 0;
-
- /* Produce column value in 'tmp' ... */
-
- column_to_string(stmt, icol, buffer, &len, pstmt);
- Z_STRLEN_P(tmp) = len;
- Z_STRVAL_P(tmp) = estrndup(buffer, len);
-
- zend_hash_index_update(Z_ARRVAL_P(arr), icol, &tmp,
- sizeof(pval *), NULL);
- }
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto bool ovrimos_fetch_row(int result_id [, int how [, int row_number]])
- how: 'Next' (default), 'Prev', 'First', 'Last', 'Absolute'
- Fetch a row */
-PHP_FUNCTION(ovrimos_fetch_row)
-{
- int numArgs;
- char *s_how;
- typedef enum { h_next = 0, h_prev, h_first, h_last, h_absolute
- } h_type;
- h_type how = h_next; /* default */
- sint32 rownum = 0;
- pval *arg_id, *arg_how = 0, *arg_row = 0;
- SQLS stmt;
- PSTATEMENT pstmt;
- bool ret = 0;
- numArgs = ARG_COUNT(ht);
-
- switch (numArgs) {
- case 1:
- if (getParameters(ht, 1, &arg_id) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 2:
- if (getParameters(ht, 2, &arg_id, &arg_how) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 3:
- if (getParameters(ht, 3, &arg_id, &arg_how, &arg_row) ==
- FAILURE) WRONG_PARAM_COUNT;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg_id);
-
- pstmt = (PSTATEMENT) Z_LVAL_P(arg_id);
- stmt = (SQLS) pstmt->statement;
-
- if (arg_how != 0) {
- if (Z_TYPE_P(arg_how) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument not string in ovrimos_fetch_row()");
- RETURN_FALSE;
- }
- s_how = Z_STRVAL_P(arg_how);
- if (stricmp(s_how, "next") == 0) {
- how = h_next;
- } else if (stricmp(s_how, "prev") == 0) {
- how = h_prev;
- } else if (stricmp(s_how, "first") == 0) {
- how = h_first;
- } else if (stricmp(s_how, "last") == 0) {
- how = h_last;
- } else if (stricmp(s_how, "absolute") == 0) {
- how = h_absolute;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument not valid in ovrimos_fetch_row()");
- RETURN_FALSE;
- }
- if (arg_row == 0 && how == 4) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Third argument is required for ABSOLUTE in ovrimos_fetch_row()");
- RETURN_FALSE;
- }
- if (arg_row != 0) {
- convert_to_long(arg_row);
- rownum = Z_LVAL_P(arg_row);
- switch (how) {
- case h_next:
- case h_prev:
- rownum--; /* Next 1 should send FUNC_CURSOR_NEXT(0) */
- break;
- default:
- break;
- }
- }
- }
-
- switch (how) {
- case h_absolute:
- case h_first:
- ret = sqlCursorFirst(stmt, rownum);
- break;
- case h_last:
- ret = sqlCursorLast(stmt, rownum);
- break;
- case h_next:
- ret = sqlCursorNext(stmt, rownum);
- break;
- case h_prev:
- ret = sqlCursorPrev(stmt, rownum);
- break;
- }
- if (!ret) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto string ovrimos_result(int result_id, mixed field)
- Get result data */
-PHP_FUNCTION(ovrimos_result)
-{
- int numArgs = ARG_COUNT(ht);
- pval *arg_id, *arg_field;
- int icol=0, colnb;
- SQLS stmt;
- int len;
- PSTATEMENT pstmt;
- char buffer[1024];
-
- if (numArgs != 2
- || getParameters(ht, 2, &arg_id,
- &arg_field) == FAILURE) WRONG_PARAM_COUNT;
-
- convert_to_long(arg_id);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg_id);
- stmt = (SQLS) pstmt->statement;
-
- colnb = sqlGetOutputColNb(stmt);
-
- if (Z_TYPE_P(arg_field) == IS_STRING) {
- int i;
- for (i = 0; i < colnb; i++) {
- if (!stricmp
- (Z_STRVAL_P(arg_field),
- sqlGetOutputColName(stmt, i))) {
- icol = i;
- break;
- }
- }
- } else if (Z_TYPE_P(arg_field) == IS_LONG) {
- icol = Z_LVAL_P(arg_field) - 1;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument neither number nor string in ovrimos_result()");
- RETURN_FALSE;
- }
- if (icol < 0 || icol > colnb) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown column in ovrimos_result()");
- RETURN_FALSE;
- }
- column_to_string(stmt, icol, buffer, &len, pstmt);
-
- RETURN_STRINGL(buffer, len, 1);
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_result_all(int result_id [, string format])
- Print result as HTML table */
-PHP_FUNCTION(ovrimos_result_all)
-{
- long fetched = 0;
- pval *arg1, *arg2;
- int numArgs;
- SQLS stmt;
- int icol, colnb;
- PSTATEMENT pstmt;
- char buffer[1024];
- int len;
-
- numArgs = ARG_COUNT(ht);
- if (numArgs == 1) {
- if (getParameters(ht, 1, &arg1) == FAILURE)
- WRONG_PARAM_COUNT;
- } else {
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg1);
- stmt = (SQLS) pstmt->statement;
-
- colnb = sqlGetOutputColNb(stmt);
-
- /* Start table tag */
- if (numArgs == 1) {
- php_printf("<table><tr>");
- } else {
- convert_to_string(arg2);
- php_printf("<table %s ><tr>", Z_STRVAL_P(arg2));
- }
-
- for (icol = 0; icol < colnb; icol++) {
- php_printf("<th>%s</th>", sqlGetOutputColName(stmt, icol));
- }
-
- php_printf("</tr>\n");
-
- if (sqlCursorFirst(stmt, 0)) {
- do {
- fetched++;
- php_printf("<tr>");
- for (icol = 0; icol < colnb; icol++) {
- column_to_string(stmt, icol, buffer, &len, pstmt);
- php_printf("<td>%s</td>", buffer);
- }
- php_printf("</tr>\n");
- } while (sqlCursorNext(stmt, 0));
- }
- php_printf("</table>\n");
-
- RETURN_LONG(fetched);
-}
-
-/* }}} */
-
-/* {{{ proto bool ovrimos_free_result(int result_id)
- Free resources associated with a result */
-PHP_FUNCTION(ovrimos_free_result)
-{
- pval *arg1;
- SQLS stmt;
- PSTATEMENT pstmt;
-
- if (getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg1);
- stmt = (SQLS) pstmt->statement;
-
- sqlCloseCursor( stmt);
- local_sqlFreeStmt( pstmt, stmt);
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_num_rows(int result_id)
- Get number of rows in a result */
-PHP_FUNCTION(ovrimos_num_rows)
-{
- uint32 rows;
- pval *arg1;
- SQLS stmt;
- PSTATEMENT pstmt;
-
- if (getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg1);
- stmt = (SQLS) pstmt->statement;
-
-
- sqlGetRowCount(stmt, &rows);
- RETURN_LONG(rows);
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_num_fields(int result_id)
- Get number of columns in a result */
-PHP_FUNCTION(ovrimos_num_fields)
-{
- pval *arg1;
- SQLS stmt;
- PSTATEMENT pstmt;
-
- if (getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg1);
-
- stmt = (SQLS) pstmt->statement;
-
- RETURN_LONG(sqlGetOutputColNb(stmt));
-}
-
-/* }}} */
-
-/* {{{ proto string ovrimos_field_name(int result_id, int field_number)
- Get a column name */
-PHP_FUNCTION(ovrimos_field_name)
-{
- pval *arg1, *arg2;
- SQLS stmt;
- int field;
- PSTATEMENT pstmt;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_long(arg2);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg1);
-
- stmt = (SQLS) pstmt->statement;
-
-
- if (Z_LVAL_P(arg2) < 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field numbering starts at 1! in call to ovrimos_field_name()");
- RETURN_FALSE;
- }
-
- field = Z_LVAL_P(arg2) - 1;
-
- if (field >= sqlGetOutputColNb(stmt)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No field at this index (%d) in call to ovrimos_field_name()", field);
- RETURN_FALSE;
- }
-
- RETURN_STRING((char *) sqlGetOutputColName(stmt, field), 1);
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_field_type(int result_id, int field_number)
- Get the datatype of a column */
-PHP_FUNCTION(ovrimos_field_type)
-{
- pval *arg1, *arg2;
- SQLS stmt;
- int field;
- PSTATEMENT pstmt;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_long(arg2);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg1);
-
- stmt = (SQLS) pstmt->statement;
-
- if (Z_LVAL_P(arg2) < 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field numbering starts at 1! in call to ovrimos_field_type()");
- RETURN_FALSE;
- }
-
- field = Z_LVAL_P(arg2) - 1;
-
- if (field >= sqlGetOutputColNb(stmt)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No field at this index (%d) in call to ovrimos_field_type()", field);
- RETURN_FALSE;
- }
-
- RETURN_LONG(sqlGetOutputColType(stmt, field));
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_field_len(int result_id, int field_number)
- Get the length of a column */
-PHP_FUNCTION(ovrimos_field_len)
-{
- pval *arg1, *arg2;
- SQLS stmt;
- int field;
- PSTATEMENT pstmt;
- int longreadlen;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_long(arg2);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg1);
-
- longreadlen = pstmt->longreadlen;
-
- stmt = (SQLS) pstmt->statement;
-
- if (Z_LVAL_P(arg2) < 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field numbering starts at 1! in call to ovrimos_field_len()");
- RETURN_FALSE;
- }
-
- field = Z_LVAL_P(arg2) - 1;
-
- if (field >= sqlGetOutputColNb(stmt)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No field at this index (%d) in call to ovrimos_field_len()", field);
- RETURN_FALSE;
- }
-
- switch (sqlGetOutputColType(stmt, field)) {
- case T_LONGVARCHAR:
- case T_LONGVARBINARY:
- RETURN_LONG(longreadlen);
- default:
- RETURN_LONG(sqlGetOutputColLength(stmt, field));
- }
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_field_num(int result_id, string field_name)
- Return column number */
-PHP_FUNCTION(ovrimos_field_num)
-{
- pval *arg1, *arg2;
- SQLS stmt;
- int i, n;
- PSTATEMENT pstmt;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE
- || Z_TYPE_P(arg2) != IS_STRING) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- pstmt = (PSTATEMENT) Z_LVAL_P(arg1);
- stmt = (SQLS) pstmt->statement;
-
- n = sqlGetOutputColNb(stmt);
- for (i = 0; i < n; i++) {
- if (!strcmp
- (Z_STRVAL_P(arg2), sqlGetOutputColName(stmt, i))) {
- RETURN_LONG(i + 1);
- }
- }
- RETURN_FALSE;
-}
-
-/* }}} */
-
-#if 0
-/* {{{ proto int ovrimos_autocommit(int connection_id, int OnOff)
- Toggle autocommit mode
- There can be problems with pconnections!*/
-PHP_FUNCTION(ovrimos_autocommit)
-{
-}
-
-/* }}} */
-#endif
-
-/* {{{ proto bool ovrimos_commit(int connection_id)
- Commit an ovrimos transaction */
-PHP_FUNCTION(ovrimos_commit)
-{
- pval *arg1;
- SQLS stmt;
- int i;
- PCON_STATE state;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE
- || Z_TYPE_P(arg1) != IS_LONG) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long( arg1);
- state = (PCON_STATE) Z_LVAL_P(arg1);
-
- for (i=0;i<state->nstatements;i++) {
- stmt = state->statements[ i].statement;
- if (stmt==NULL) {
- continue;
- }
- if (!sqlCommit(stmt)) {
- RETURN_FALSE;
- }
- }
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto bool ovrimos_rollback(int connection_id)
- Rollback a transaction */
-PHP_FUNCTION(ovrimos_rollback)
-{
- pval *arg1;
- SQLS stmt;
- int i;
- PCON_STATE state;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE
- || Z_TYPE_P(arg1) != IS_LONG) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long( arg1);
- state = (PCON_STATE) Z_LVAL_P(arg1);
-
- for (i=0;i<state->nstatements;i++) {
- stmt = (SQLS) state->statements[ i].statement;
- if (stmt==NULL) continue;
-
- if (!sqlRollback(stmt)) {
- RETURN_FALSE;
- }
- }
- RETURN_TRUE;
-}
-
-/* }}} */
-
-#if 0
-/* {{{ proto int ovrimos_setoption(int conn_id|result_id, int which, int option, int value)
- Sets connection or statement options */
-PHP_FUNCTION(ovrimos_setoption)
-{
-}
-
-/* }}} */
-#endif
-
-/* {{{ ovrimos_functions[]
- */
-function_entry ovrimos_functions[] = {
-/* PHP_FE(ovrimos_setoption, NULL)*/
-/* PHP_FE(ovrimos_autocommit, NULL)*/
- PHP_FE(ovrimos_close, NULL)
- PHP_FE(ovrimos_commit, NULL)
- PHP_FE(ovrimos_connect, NULL)
- PHP_FE(ovrimos_cursor, NULL)
- PHP_FE(ovrimos_exec, NULL)
- PHP_FE(ovrimos_prepare, NULL)
- PHP_FE(ovrimos_execute, NULL)
- PHP_FE(ovrimos_fetch_row, NULL)
- PHP_FE(ovrimos_fetch_into, second_arg_force_ref)
- PHP_FE(ovrimos_field_len, NULL)
- PHP_FE(ovrimos_field_name, NULL)
- PHP_FE(ovrimos_field_type, NULL)
- PHP_FE(ovrimos_field_num, NULL)
- PHP_FE(ovrimos_free_result, NULL)
- PHP_FE(ovrimos_num_fields, NULL)
- PHP_FE(ovrimos_num_rows, NULL)
- PHP_FE(ovrimos_result, NULL)
- PHP_FE(ovrimos_result_all, NULL)
- PHP_FE(ovrimos_rollback, NULL)
-/* PHP_FE(ovrimos_binmode, NULL)*/
- PHP_FE(ovrimos_longreadlen, NULL)
- PHP_FALIAS(ovrimos_do, ovrimos_exec, NULL) {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry ovrimos_module_entry = {
- STANDARD_MODULE_HEADER,
- "ovrimos",
- ovrimos_functions,
- NULL,
- NULL,
- NULL,
- NULL,
- PHP_MINFO(ovrimos),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
-};
-
-DLEXPORT zend_module_entry *get_module()
-{
- return &ovrimos_module_entry;
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */