| 31 |
ZEND_FUNCTION(vp_initialize_db ); |
ZEND_FUNCTION(vp_initialize_db ); |
| 32 |
ZEND_FUNCTION(vp_login_user ); |
ZEND_FUNCTION(vp_login_user ); |
| 33 |
ZEND_FUNCTION(vp_logout_user ); |
ZEND_FUNCTION(vp_logout_user ); |
| 34 |
//ZEND_FUNCTION(vp_create_session ); |
ZEND_FUNCTION(vp_create_session ); |
| 35 |
|
ZEND_FUNCTION(vp_get_session ); |
| 36 |
ZEND_FUNCTION(vp_is_activated ); |
ZEND_FUNCTION(vp_is_activated ); |
| 37 |
ZEND_FUNCTION(vp_activate ); |
ZEND_FUNCTION(vp_activate ); |
| 38 |
ZEND_FUNCTION(vp_get_account_count ); |
ZEND_FUNCTION(vp_get_account_count ); |
| 70 |
ZEND_FE(vp_initialize_db ,NULL) |
ZEND_FE(vp_initialize_db ,NULL) |
| 71 |
ZEND_FE(vp_login_user ,NULL) |
ZEND_FE(vp_login_user ,NULL) |
| 72 |
ZEND_FE(vp_logout_user ,NULL) |
ZEND_FE(vp_logout_user ,NULL) |
| 73 |
// ZEND_FE(vp_create_session ,NULL) |
ZEND_FE(vp_create_session ,NULL) |
| 74 |
|
ZEND_FE(vp_get_session ,NULL) |
| 75 |
ZEND_FE(vp_is_activated ,NULL) |
ZEND_FE(vp_is_activated ,NULL) |
| 76 |
ZEND_FE(vp_activate ,NULL) |
ZEND_FE(vp_activate ,NULL) |
| 77 |
ZEND_FE(vp_get_account_count ,NULL) |
ZEND_FE(vp_get_account_count ,NULL) |
| 375 |
|
|
| 376 |
/** uids_t → zval |
/** uids_t → zval |
| 377 |
*/ |
*/ |
| 378 |
result_t uidsToZval( userid_t *pUID, int len, zval **ppz ){ |
result_t uidsToZval( userid_t *pUID, int len, zval **ppz ) |
| 379 |
|
{ |
| 380 |
zval *pz; |
zval *pz; |
| 381 |
|
|
| 382 |
// create new array |
// create new array |
| 394 |
} |
} |
| 395 |
/** uids_t → zval |
/** uids_t → zval |
| 396 |
*/ |
*/ |
| 397 |
result_t gidsToZval( groupid_t *pGID, int len, zval **ppz ){ |
result_t gidsToZval( groupid_t *pGID, int len, zval **ppz ) |
| 398 |
|
{ |
| 399 |
zval *pz; |
zval *pz; |
| 400 |
|
|
| 401 |
// create new array |
// create new array |
| 425 |
... |
... |
| 426 |
) |
) |
| 427 |
*/ |
*/ |
| 428 |
result_t accountsToZval( const account_t *pAccounts, int accountLen, zval *z ){ |
result_t accountsToZval( const account_t *pAccounts, int accountLen, zval *z ) |
| 429 |
|
{ |
| 430 |
return RES_ERROR; |
return RES_ERROR; |
| 431 |
} |
} |
| 432 |
|
|
| 433 |
result_t accountToZval( const account_t *pAccount, zval *z ){ |
result_t accountToZval( const account_t *pAccount, zval *z ) |
| 434 |
|
{ |
| 435 |
return RES_ERROR; |
return RES_ERROR; |
| 436 |
} |
} |
| 437 |
|
|
| 438 |
/** groups → zval |
/** groups → zval |
| 439 |
*/ |
*/ |
| 440 |
result_t groupsToZval( const group_t *pGroups, int groupLen, zval *z ){ |
result_t groupsToZval( const group_t *pGroups, int groupLen, zval *z ) |
| 441 |
|
{ |
| 442 |
|
|
| 443 |
return RES_ERROR; |
return RES_ERROR; |
| 444 |
} |
} |
| 445 |
|
|
| 446 |
|
/** session → zval |
| 447 |
|
*/ |
| 448 |
|
result_t sessionToZval( const session_t *pSession, zval *z ) |
| 449 |
|
{ |
| 450 |
|
string sessionID(unsignedIntToString(pSession->getSessionID())); |
| 451 |
|
add_assoc_string(z, "session_id", (char *)sessionID.c_str(), 1); |
| 452 |
|
|
| 453 |
|
string date(unsignedIntToString((unsigned int)pSession->getDate())); |
| 454 |
|
add_assoc_string(z, "date", (char *)date.c_str(), 1); |
| 455 |
|
|
| 456 |
|
string userID(unsignedIntToString((unsigned int)pSession->getUserID())); |
| 457 |
|
add_assoc_string(z, "user_id", (char *)userID.c_str(), 1); |
| 458 |
|
|
| 459 |
|
return RES_OK; |
| 460 |
|
} |
| 461 |
|
|
| 462 |
ZEND_FUNCTION(vp_test_criteria) |
ZEND_FUNCTION(vp_test_criteria) |
| 463 |
{ |
{ |
| 464 |
zval *z; |
zval *z; |
| 489 |
|
|
| 490 |
|
|
| 491 |
|
|
| 492 |
/** DBに接続する。既に接続中の接続は閉じられる。 |
/** DBに接続する。既に接続中の接続は閉じられる。<br> |
| 493 |
|
int initialize_db( string host[, string user[, string password[, string dbname[, string prefix]]]] ); |
| 494 |
@param host 接続先。省略時はNULL |
@param host 接続先。省略時はNULL |
| 495 |
@param user DB接続時のユーザ名。省略時はNULL |
@param user DB接続時のユーザ名。省略時はNULL |
| 496 |
@param password DB接続時のパスワード。省略時はNULL |
@param password DB接続時のパスワード。省略時はNULL |
| 497 |
@param dbname DB接続時のDB名。省略時は"" |
@param dbname DB接続時のDB名。省略時は"" |
| 498 |
@param prefix XOOPS DB のprefix。 |
@param prefix XOOPS DB のprefix。 |
| 499 |
@return 0 success <br> |
@return 0 success <br> |
|
int initialize_db( string host[, string user[, string password[, string dbname[, string prefix]]]] ); |
|
| 500 |
*/ |
*/ |
| 501 |
ZEND_FUNCTION(vp_initialize_db) |
ZEND_FUNCTION(vp_initialize_db) |
| 502 |
{ |
{ |
| 536 |
RETURN_LONG(result); |
RETURN_LONG(result); |
| 537 |
} |
} |
| 538 |
|
|
| 539 |
// int vp_login_user(string uname, string password) |
/** ログインする。<br> |
| 540 |
|
int vp_login_user(string uname, string password) |
| 541 |
|
@param uname ユーザ名(xoops_users.uname) |
| 542 |
|
@param password パスワード(md5(password)=xoops_users.pass) |
| 543 |
|
@return 0 success |
| 544 |
|
*/ |
| 545 |
ZEND_FUNCTION(vp_login_user) |
ZEND_FUNCTION(vp_login_user) |
| 546 |
{ |
{ |
| 547 |
char *uname; |
char *uname; |
| 556 |
|
|
| 557 |
string strUname( uname, unameLen ); |
string strUname( uname, unameLen ); |
| 558 |
string strPasswd( passwd, passwdLen ); |
string strPasswd( passwd, passwdLen ); |
| 559 |
sessionid_t vpsid; |
sessionid_t vpSessionID; |
| 560 |
result_t result = loginUser( strUname.c_str(), strPasswd.c_str(), &vpsid ); |
result_t result = loginUser( strUname.c_str(), strPasswd.c_str(), &vpSessionID ); |
| 561 |
if ( result == RES_OK ){ |
if ( result == RES_OK ){ |
| 562 |
RETURN_LONG((long)vpsid); |
RETURN_LONG((long)vpSessionID); |
| 563 |
} |
} |
| 564 |
else { |
else { |
| 565 |
//zend_printf( "vpal_debug: vp_login_user(%s, %s): cannot login. result=%d<br>\n", strUname.c_str(), strPasswd.c_str(), (int)result ); |
//zend_printf( "vpal_debug: vp_login_user(%s, %s): cannot login. result=%d<br>\n", strUname.c_str(), strPasswd.c_str(), (int)result ); |
| 567 |
} |
} |
| 568 |
} |
} |
| 569 |
|
|
| 570 |
// void vp_logout_user(int vpsid) |
/** ログアウトする。<br> |
| 571 |
|
void vp_logout_user(int vp_session_id) |
| 572 |
|
@param vp_session_id vpのsessionid |
| 573 |
|
@return なし |
| 574 |
|
*/ |
| 575 |
ZEND_FUNCTION(vp_logout_user) |
ZEND_FUNCTION(vp_logout_user) |
| 576 |
{ |
{ |
| 577 |
long sid; |
long vpSessionID; |
| 578 |
|
|
| 579 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &sid) == FAILURE) { |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &vpSessionID) == FAILURE) { |
| 580 |
return; |
return; |
| 581 |
} |
} |
| 582 |
|
|
| 583 |
logoutUser( (sessionid_t)sid ); |
logoutUser( (sessionid_t)vpSessionID ); |
| 584 |
|
|
| 585 |
RETURN_NULL(); |
RETURN_NULL(); |
| 586 |
} |
} |
| 587 |
|
|
| 588 |
// int vp_create_session( string xoops_sess_id, int uid ) |
/** vp の session id 作成<br> |
| 589 |
|
int vp_create_session( string xoops_sess_id, int uid, string remote_host ) |
| 590 |
|
@param xoops_sess_id xoopsのsession id |
| 591 |
|
@param uid xoops の uid (xoops_users.uid) |
| 592 |
|
@return FALSE以外: vp の session id |
| 593 |
|
@return FALSE: 失敗 |
| 594 |
|
*/ |
| 595 |
ZEND_FUNCTION(vp_create_session) |
ZEND_FUNCTION(vp_create_session) |
| 596 |
{ |
{ |
| 597 |
char *xoopsSessionID; |
char *xoopsSessionID; |
| 603 |
return; |
return; |
| 604 |
} |
} |
| 605 |
|
|
| 606 |
sessionid_t vpsid; |
sessionid_t vpSessionID = 0; |
| 607 |
result_t result = createSession( xoopsSessionID, (sessionid_t)sid, &vpsid ); |
result_t result = createSession( xoopsSessionID, (userid_t)uid, &vpSessionID ); |
| 608 |
|
if ( result == RES_OK ){ |
| 609 |
|
RETURN_LONG((long)vpSessionID); |
| 610 |
|
} |
| 611 |
|
else { |
| 612 |
|
RETURN_FALSE; |
| 613 |
|
} |
| 614 |
|
} |
| 615 |
|
|
| 616 |
|
/** vp の session の詳細情報を得る<br> |
| 617 |
|
int vp_get_session( int vp_session_id, array session_info ) |
| 618 |
|
@param vp_session_id vp の session id |
| 619 |
|
@param session_info 結果を受け取る配列 |
| 620 |
|
@return 0 success |
| 621 |
|
*/ |
| 622 |
|
ZEND_FUNCTION(vp_get_session) |
| 623 |
|
{ |
| 624 |
|
long vpSessionID; |
| 625 |
|
zval *sessionInfo; |
| 626 |
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "la", |
| 627 |
|
&vpSessionID, &sessionInfo) == FAILURE) { |
| 628 |
|
return; |
| 629 |
|
} |
| 630 |
|
const session_t *session = 0; |
| 631 |
|
result_t result = getSession( (sessionid_t)vpSessionID, &session ); |
| 632 |
|
if ( result == RES_OK ){ |
| 633 |
|
sessionToZval( session, sessionInfo ); |
| 634 |
|
freeResult( session ); |
| 635 |
|
} |
| 636 |
|
|
| 637 |
RETURN_LONG((long)vpsid); |
RETURN_LONG((long)result); |
| 638 |
} |
} |
| 639 |
|
|
| 640 |
ZEND_FUNCTION(vp_is_activated) |
ZEND_FUNCTION(vp_is_activated) |