diff -ubNr phpwebdav-0.0.4/README phpwebdav-0.0.5/README --- phpwebdav-0.0.4/README Wed Jul 25 13:08:19 2001 +++ phpwebdav-0.0.5/README Tue Sep 18 19:48:07 2001 @@ -8,7 +8,7 @@ -The following DAV methods are currently (as of 0.0.4, 2001-07-25) implemented: +The following DAV methods are currently (as of 0.0.5, 2001-09-18) implemented: MKCOL - make collection RMCOL - remove collection @@ -148,19 +148,20 @@ otherwise it's a file. -string phpwebdav_propget(mixed connid, string remote, string name) +string phpwebdav_propget(mixed connid, string remote, string name [, string namespace]) get a file's property connid: connectionid remote: absolute path to file name: name of the property + namespace: namespace name (refer to your preferred XML manual for details) returns the value on success; FALSE on error. use phpwebdav_error() to get the errormessage -bool phpwebdav_propset(mixed connid, string remote, string name, string value) +bool phpwebdav_propset(mixed connid, string remote, string name, string value [, string namespace]) set a file's property @@ -168,6 +169,7 @@ remote: absolute path to file name: name of the property value: value to set the property to + namespace: namespace name (refer to your preferred XML manual for details) returns TRUE on success; FALSE on error. use phpwebdav_error() to get the errormessage diff -ubNr phpwebdav-0.0.4/phpwebdav.c phpwebdav-0.0.5/phpwebdav.c --- phpwebdav-0.0.4/phpwebdav.c Wed Jul 25 11:57:34 2001 +++ phpwebdav-0.0.5/phpwebdav.c Tue Sep 18 19:58:02 2001 @@ -9,6 +9,10 @@ /* REVISION HISTORY + v0.0.5 2001-09-18 + -- propget and propset now accept one more optional argument each: a namespace + (see documentation for details) + v0.0.4 2001-06-02 -- phpwebdav_connect connects to an URL and returns a resource identifier this ID is then used by every other phpwebdav_ function cleanup is done @@ -45,7 +49,7 @@ #include "phpwebdav.h" -#define PHPWEBDAV_USER_AGENT "phpwebdav/0.0.4" +#define PHPWEBDAV_USER_AGENT "phpwebdav/0.0.5" #define PHPWEBDAV_NAMESPACE "http://apache.org/dav/props/" #define PHPWEBDAV_RETURN if (phpwebdav_last_error) { RETURN_FALSE; } else { RETURN_TRUE; } @@ -673,7 +677,7 @@ PHP_FUNCTION(phpwebdav_propget) { - zval **conn, **path, **propname; + zval **conn, **path, **propname, **nspace; char str_path[256], str_name[256]; http_session **session; dav_propname pnames[2] = {{NULL}, {NULL}}; @@ -681,18 +685,35 @@ struct propfind_data value; int ret; - if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &conn, &path, &propname) == FAILURE) + switch(ZEND_NUM_ARGS()) { + case 3: + if (zend_get_parameters_ex(3, &conn, &path, &propname) == FAILURE) + WRONG_PARAM_COUNT; + nspace = NULL; + break; + case 4: + if (zend_get_parameters_ex(4, &conn, &path, &propname, &nspace) == FAILURE) + WRONG_PARAM_COUNT; + convert_to_string_ex(nspace); + break; + default: WRONG_PARAM_COUNT; } convert_to_string_ex(path); - ZEND_FETCH_RESOURCE(session, http_session **, conn, -1, "phpwebdav connection", phpwebdav_connections); + convert_to_string_ex(propname); + ZEND_FETCH_RESOURCE(session, http_session **, conn, -1, + "phpwebdav connection", phpwebdav_connections); snprintf(str_path, 256, "%s", Z_STRVAL_PP(path)); snprintf(str_name, 256, "%s", Z_STRVAL_PP(propname)); + if (nspace) + pnames[0].nspace = Z_STRVAL_PP(nspace); + else pnames[0].nspace = PHPWEBDAV_NAMESPACE; + pnames[0].name = str_name; value.prop = props = pnames; value.value = 0; @@ -725,24 +746,35 @@ PHP_FUNCTION(phpwebdav_propset) { - zval **conn, **path, **propname, **propvalue; + zval **conn, **path, **propname, **propvalue, **nspace; char str_path[256], str_name[256], *str_value; http_session **session; dav_proppatch_operation ops[2]; dav_propname pname; - if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &conn, &path, &propname, &propvalue) == FAILURE) + switch(ZEND_NUM_ARGS()) { + case 4: + if (zend_get_parameters_ex(4, &conn, &path, &propname, &propvalue) == FAILURE) + WRONG_PARAM_COUNT; + nspace = NULL; + break; + case 5: + if (zend_get_parameters_ex(5, &conn, &path, &propname, &propvalue, &nspace) == FAILURE) + WRONG_PARAM_COUNT; + convert_to_string_ex(nspace); + break; + default: WRONG_PARAM_COUNT; } convert_to_string_ex(path); convert_to_string_ex(propname); convert_to_string_ex(propvalue); - ZEND_FETCH_RESOURCE(session, http_session **, conn, -1, "phpwebdav connection", phpwebdav_connections); + ZEND_FETCH_RESOURCE(session, http_session **, conn, -1, + "phpwebdav connection", phpwebdav_connections); snprintf(str_path, 256, "%s", Z_STRVAL_PP(path)); - snprintf(str_name, 256, "%s", Z_STRVAL_PP(propname)); str_value = estrdup(Z_STRVAL_PP(propvalue)); @@ -751,6 +783,9 @@ ops[0].value = str_value; ops[1].name = NULL; + if (nspace) + pname.nspace = Z_STRVAL_PP(nspace); + else pname.nspace = PHPWEBDAV_NAMESPACE; pname.name = str_name;