[PHP-CVS] cvs: php4 /ext/midgard midgard.c
davidg Wed Feb 21 04:21:02 2001 EDT Modified files: /php4/ext/midgard midgard.c Log: used dynamic alloc to avoid segfault ;) Index: php4/ext/midgard/midgard.c diff -u php4/ext/midgard/midgard.c:1.9 php4/ext/midgard/midgard.c:1.10 --- php4/ext/midgard/midgard.c:1.9 Tue Feb 20 16:29:34 2001 +++ php4/ext/midgard/midgard.c Wed Feb 21 04:21:01 2001 @@ -1,4 +1,4 @@ -/* $Id: midgard.c,v 1.9 2001/02/21 00:29:34 davidg Exp $ +/* $Id: midgard.c,v 1.10 2001/02/21 12:21:01 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -707,13 +707,14 @@ void midgard_user_call_func(midgard *mgd, int id, int level, void *xparam) { - zval z_id, z_level, z_xparam, *args[3]={&z_id,&z_level,&z_xparam}; + zval *args[3]; zval ** xp = (zval **)xparam; - zval retval, *return_value = &retval; //just to make sure + zval *return_value; - ZVAL_LONG(args[0], id); - ZVAL_LONG(args[1], level); - args[2] = xp[0]; + ALLOC_ZVAL(return_value); ZVAL_NULL(return_value); + ALLOC_ZVAL(args[0]);ZVAL_LONG(args[0], id); + ALLOC_ZVAL(args[1]);ZVAL_LONG(args[1], level); + args[2] = xp[0];// DG: is this needed ? -> +zval_copy_ctor(args[2]); if(call_user_function(CG(function_table), NULL, xp[1], return_value, 3, @@ -722,7 +723,9 @@ (xp[1])->value.str.val); return; } - + zval_dtor(return_value); + zval_dtor(args[0]); + zval_dtor(args[1]); } #endif /* HAVE_MIDGARD */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard event.c mgd_event.h mgd_internal.h midgard.c
davidg Thu Feb 22 06:26:31 2001 EDT Modified files: /php4/ext/midgard event.c mgd_event.h mgd_internal.h midgard.c Log: Added custom sort on mgd_walk_xxx_tree() function. Index: php4/ext/midgard/event.c diff -u php4/ext/midgard/event.c:1.4 php4/ext/midgard/event.c:1.5 --- php4/ext/midgard/event.c:1.4Wed Feb 21 14:18:54 2001 +++ php4/ext/midgard/event.cThu Feb 22 06:26:31 2001 @@ -1,4 +1,4 @@ -/* $Id: event.c,v 1.4 2001/02/21 22:18:54 emile Exp $ +/* $Id: event.c,v 1.5 2001/02/22 14:26:31 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -847,6 +847,8 @@ } MGD_MOVE_FUNCTION(event,event,event,up); + +MGD_WALK_FUNCTION(event); MidgardProperty MidgardEventProperties [] = { { IS_LONG, "up"}, Index: php4/ext/midgard/mgd_event.h diff -u php4/ext/midgard/mgd_event.h:1.3 php4/ext/midgard/mgd_event.h:1.4 --- php4/ext/midgard/mgd_event.h:1.3Sat Feb 17 15:21:50 2001 +++ php4/ext/midgard/mgd_event.hThu Feb 22 06:26:31 2001 @@ -1,4 +1,4 @@ -/* $Id: mgd_event.h,v 1.3 2001/02/17 23:21:50 emile Exp $ +/* $Id: mgd_event.h,v 1.4 2001/02/22 14:26:31 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -26,6 +26,7 @@ extern MGD_FUNCTION(update_event); extern MGD_FUNCTION(delete_event); extern MGD_FUNCTION(delete_event_tree); +extern MGD_FUNCTION(walk_event_tree); extern MGD_FUNCTION(get_event); extern MGD_FUNCTION(list_events); extern MGD_FUNCTION(list_events_between); Index: php4/ext/midgard/mgd_internal.h diff -u php4/ext/midgard/mgd_internal.h:1.4 php4/ext/midgard/mgd_internal.h:1.5 --- php4/ext/midgard/mgd_internal.h:1.4 Tue Feb 20 16:24:56 2001 +++ php4/ext/midgard/mgd_internal.h Thu Feb 22 06:26:31 2001 @@ -1,4 +1,4 @@ -/* $Id: mgd_internal.h,v 1.4 2001/02/21 00:24:56 davidg Exp $ +/* $Id: mgd_internal.h,v 1.5 2001/02/22 14:26:31 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -120,14 +120,22 @@ MGD_FUNCTION(walk_ ## table ## _tree) \ { \ zval **id, **level, **xparam, *xp[2], **order; \ - zval **midgard_user_call_func_name; \ + zval **midgard_user_call_func_name, **sort = NULL; \ CHECK_MGD; \ \ switch (ZEND_NUM_ARGS()) { \ + case 6: \ + if (zend_get_parameters_ex(6, &midgard_user_call_func_name, &id, \ +&level, &xparam, &order, &sort) == FAILURE) { \ + WRONG_PARAM_COUNT; \ + } \ + break; \ case 5: \ if (zend_get_parameters_ex(5, &midgard_user_call_func_name, &id, \ &level, &xparam, &order) == FAILURE) { \ WRONG_PARAM_COUNT; \ + } else { \ + sort = NULL; \ } \ break; \ case 4: \ @@ -136,6 +144,7 @@ WRONG_PARAM_COUNT; \ } else { \ order = NULL; \ + sort = NULL; \ } \ break; \ default: \ @@ -147,6 +156,7 @@ convert_to_long_ex(level); \ if (order) convert_to_long_ex(order); \ convert_to_long_ex(id); \ + if(sort) convert_to_string_ex(sort); \ \ xp[0] = (*xparam); \ xp[1] = (*midgard_user_call_func_name); \ @@ -154,7 +164,8 @@ (*level)->value.lval, \ order ? (*order)->value.lval : 1, \ (void *)xp, \ - midgard_user_call_func); \ + +midgard_user_call_func, \ + sort ? +(*sort)->value.str.val : NULL); \ RETURN_TRUE; \ } \ \ Index: php4/ext/midgard/midgard.c diff -u php4/ext/midgard/midgard.c:1.11 php4/ext/midgard/midgard.c:1.12 --- php4/ext/midgard/midgard.c:1.11 Wed Feb 21 14:18:54 2001 +++ php4/ext/midgard/midgard.c Thu Feb 22 06:26:31 2001 @@ -1,4 +1,4 @@ -/* $Id: midgard.c,v 1.11 2001/02/21 22:18:54 emile Exp $ +/* $Id: midgard.c,v 1.12 2001/02/22 14:26:31 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -273,6 +273,7 @@ MGD_FE(walk_article_tree, NULL) MGD_FE(walk_page_tree, NULL) MGD_FE(walk_snippetdir_tree, NULL) +MGD_FE(walk_event_tree, NULL) MGD_FE(is_style_owner, NULL) MGD_FE(list_styles, NULL) MGD_FE(get_style, NULL) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROT
[PHP-CVS] cvs: php4 /ext/midgard article.c calendar.c event.c group.c mgd_group.h mgd_internal.h midgard.c page.c person.c topic.c
davidg Thu Feb 22 09:39:38 2001 EDT Modified files: /php4/ext/midgard article.c calendar.c event.c group.c mgd_group.h mgd_internal.h midgard.c page.c person.c topic.c Log: Added mgd_walk_group_tree() function Index: php4/ext/midgard/article.c diff -u php4/ext/midgard/article.c:1.6 php4/ext/midgard/article.c:1.7 --- php4/ext/midgard/article.c:1.6 Wed Feb 21 14:18:54 2001 +++ php4/ext/midgard/article.c Thu Feb 22 09:39:37 2001 @@ -1,4 +1,4 @@ -/* $Id: article.c,v 1.6 2001/02/21 22:18:54 emile Exp $ +/* $Id: article.c,v 1.7 2001/02/22 17:39:37 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -57,7 +57,7 @@ return; #endif - ids = mgd_tree(mgd_handle(), "topic", (*root)->value.lval, 0, NULL); + ids = mgd_tree(mgd_handle(), "topic", "up", (*root)->value.lval, 0, NULL); if (ids) { id = mgd_idfield(mgd_handle(), "topic", "article", @@ -252,7 +252,7 @@ wrong_param_count(); } - topics = mgd_tree(mgd_handle(), "topic", (*id)->value.lval, 0, NULL); + topics = mgd_tree(mgd_handle(), "topic", "up", (*id)->value.lval, 0, NULL); if (typev == -1) php_midgard_select(&MidgardArticle, return_value, @@ -329,7 +329,7 @@ wrong_param_count(); } - topics = mgd_tree(mgd_handle(), "topic", (*id)->value.lval, 0, NULL); + topics = mgd_tree(mgd_handle(), "topic", "up", (*id)->value.lval, 0, NULL); if (typev == -1) php_midgard_select(&MidgardArticle, return_value, @@ -360,7 +360,7 @@ convert_to_long_ex(person); topics = - mgd_tree(mgd_handle(), "topic", (*topic)->value.lval, 0, NULL); + mgd_tree(mgd_handle(), "topic", "up", (*topic)->value.lval, 0, NULL); php_midgard_select(&MidgardArticle, return_value, ARTICLE_SELECT, ARTICLE_FROM, Index: php4/ext/midgard/calendar.c diff -u php4/ext/midgard/calendar.c:1.3 php4/ext/midgard/calendar.c:1.4 --- php4/ext/midgard/calendar.c:1.3 Sat Feb 17 15:21:49 2001 +++ php4/ext/midgard/calendar.c Thu Feb 22 09:39:37 2001 @@ -1,4 +1,4 @@ -/* $Id: calendar.c,v 1.3 2001/02/17 23:21:49 emile Exp $ +/* $Id: calendar.c,v 1.4 2001/02/22 17:39:37 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -93,7 +93,7 @@ wrong_param_count(); } -topics = mgd_tree(mgd_handle(), "topic", (*id)->value.lval, 0, NULL); +topics = mgd_tree(mgd_handle(), "topic", "up", (*id)->value.lval, 0, NULL); if (typev == -1) php_midgard_select(&MidgardArticle, return_value, @@ -184,7 +184,7 @@ wrong_param_count(); } -topics = mgd_tree(mgd_handle(), "topic", (*id)->value.lval, 0, NULL); +topics = mgd_tree(mgd_handle(), "topic", "up", (*id)->value.lval, 0, NULL); if (typev == -1) php_midgard_select(&MidgardArticle, return_value, ARTICLE_SELECT_FAST "," ARTICLE_CALENDAR, Index: php4/ext/midgard/event.c diff -u php4/ext/midgard/event.c:1.5 php4/ext/midgard/event.c:1.6 --- php4/ext/midgard/event.c:1.5Thu Feb 22 06:26:31 2001 +++ php4/ext/midgard/event.cThu Feb 22 09:39:37 2001 @@ -1,4 +1,4 @@ -/* $Id: event.c,v 1.5 2001/02/22 14:26:31 davidg Exp $ +/* $Id: event.c,v 1.6 2001/02/22 17:39:37 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -418,7 +418,8 @@ } if((*id)->value.lval) { - if(!(events = mgd_tree(mgd_handle(), "event", (*id)->value.lval, 0, NULL))) + if(!(events = mgd_tree(mgd_handle(), "event", "up", + +(*id)->value.lval, 0, NULL))) RETURN_FALSE_BECAUSE(MGD_ERR_ERROR); if (typev == -1) php_midgard_select(&MidgardEvent, return_value, "id,up,start,end,title," @@ -493,7 +494,8 @@ } if((*id)->value.lval) { - if(!(events = mgd_tree(mgd_handle(), "event", (*id)->value.lval, 0, NULL))) + if(!(events = mgd_tree(mgd_handle(), "event", "up", + +(*id)->value.lval, 0, NULL))) RETURN_FALSE_BECAUSE(MGD_ERR_ERROR); if (typev == -1) php_midgard_select(&MidgardEvent, return_value, "id,up,start,end,title," Index: php4/ext/midgard/group.c diff -u php4/ext/midgard/group.c:1.4 php4/ext/midgard/group.c:1.5 --- php4/ext/midgard/group.c:1.4Wed Fe
[PHP-CVS] cvs: php4 /ext/midgard midgard.c
davidg Thu Feb 22 12:32:20 2001 EDT Modified files: /php4/ext/midgard midgard.c Log: Registering Midgard constants. Index: php4/ext/midgard/midgard.c diff -u php4/ext/midgard/midgard.c:1.13 php4/ext/midgard/midgard.c:1.14 --- php4/ext/midgard/midgard.c:1.13 Thu Feb 22 09:39:37 2001 +++ php4/ext/midgard/midgard.c Thu Feb 22 12:32:20 2001 @@ -1,4 +1,4 @@ -/* $Id: midgard.c,v 1.13 2001/02/22 17:39:37 davidg Exp $ +/* $Id: midgard.c,v 1.14 2001/02/22 20:32:20 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -362,15 +362,17 @@ return SUCCESS; } +#define MGD_REGISTER_LONG_CONSTANT(name,lval,flags) +zend_register_long_constant((name),strlen(name)+1,(lval),(flags),module_number ELS_CC) /* Remove if there's nothing to do at request start */ PHP_RINIT_FUNCTION(midgard) { + int i; request_rec *r; module *midgard_module; SLS_FETCH(); MGDLS_FETCH(); - + midgard_module = ap_find_linked_module("mod_midgard.c"); if (!midgard_module) { MGDG(rcfg) = NULL; @@ -404,6 +406,13 @@ return SUCCESS; } + /* register Midgard constants */ + for(i = 1; i < MIDGARD_OBJECT_COUNT; i++) { + MGD_REGISTER_LONG_CONSTANT((char *)mgd_table_label[i], i, + CONST_CS | CONST_PERSISTENT); + + } + MGDG(mgd) = MGDG(rcfg)->mgd; ALLOC_INIT_ZVAL(MGDG(udf)); if(MGDG(udf)) array_init(MGDG(udf)); @@ -730,6 +739,7 @@ zval_dtor(args[0]); zval_dtor(args[1]); } + #endif /* HAVE_MIDGARD */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard preparser-scanner.l
davidg Thu Feb 22 17:08:44 2001 EDT Modified files: /php4/ext/midgard preparser-scanner.l Log: misbehavior of the preparser that translated (eg) myeval() into mymgd_eval() Index: php4/ext/midgard/preparser-scanner.l diff -u php4/ext/midgard/preparser-scanner.l:1.3 php4/ext/midgard/preparser-scanner.l:1.4 --- php4/ext/midgard/preparser-scanner.l:1.3Sat Feb 17 15:21:50 2001 +++ php4/ext/midgard/preparser-scanner.lThu Feb 22 17:08:43 2001 @@ -1,6 +1,6 @@ %{ -/* $Id: preparser-scanner.l,v 1.3 2001/02/17 23:21:50 emile Exp $ +/* $Id: preparser-scanner.l,v 1.4 2001/02/23 01:08:43 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -207,7 +207,7 @@ mgd_append_byte(mgdlval.gstring, mgdtext); } -[^_]"eval"{WHITESPACE}*"(" { +[^a-zA-Z0-9_]"eval"{WHITESPACE}*"(" { /* TODO: change the [^_] to make it conditional, so it's not part of the match */ mgd_append_byte(mgd_output_buffer, mgdtext); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard midgard.c
davidg Fri Feb 23 01:22:09 2001 EDT Modified files: /php4/ext/midgard midgard.c Log: Removed constants registration, added a conversion table $midgard->types[$objtype] try var_dump($midgard) for more details Index: php4/ext/midgard/midgard.c diff -u php4/ext/midgard/midgard.c:1.14 php4/ext/midgard/midgard.c:1.15 --- php4/ext/midgard/midgard.c:1.14 Thu Feb 22 12:32:20 2001 +++ php4/ext/midgard/midgard.c Fri Feb 23 01:22:08 2001 @@ -1,4 +1,4 @@ -/* $Id: midgard.c,v 1.14 2001/02/22 20:32:20 davidg Exp $ +/* $Id: midgard.c,v 1.15 2001/02/23 09:22:08 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -72,6 +72,9 @@ MGD_FUNCTION(version); MGD_FUNCTION(get_midgard); MGD_FUNCTION(auth_midgard); +#if YOU_WANT_TO_TEST +MGD_FUNCTION(walk_tree); +#endif /* Every user visible function must have an entry in midgard_functions[]. */ @@ -292,6 +295,9 @@ MGD_FE(snippet, NULL) MGD_FE(eval, NULL) MGD_FE(register_filter, NULL) +#if YOU_WANT_TO_TEST +MGD_FE(walk_tree, NULL) +#endif {NULL, NULL, NULL} /* Must be the last line in midgard_functions[] */ }; @@ -362,11 +368,9 @@ return SUCCESS; } -#define MGD_REGISTER_LONG_CONSTANT(name,lval,flags) zend_register_long_constant((name),strlen(name)+1,(lval),(flags),module_number ELS_CC) /* Remove if there's nothing to do at request start */ PHP_RINIT_FUNCTION(midgard) { - int i; request_rec *r; module *midgard_module; @@ -406,13 +410,6 @@ return SUCCESS; } - /* register Midgard constants */ - for(i = 1; i < MIDGARD_OBJECT_COUNT; i++) { - MGD_REGISTER_LONG_CONSTANT((char *)mgd_table_label[i], i, - CONST_CS | CONST_PERSISTENT); - - } - MGDG(mgd) = MGDG(rcfg)->mgd; ALLOC_INIT_ZVAL(MGDG(udf)); if(MGDG(udf)) array_init(MGDG(udf)); @@ -568,9 +565,9 @@ MGD_FUNCTION(get_midgard) { int i; - zval *argv; + zval *argv, *types; char **mm_argv; - long mm_argc; + long mm_argc; midgard *mgd = mgd_handle(); midgard_request_config *rcfg = mgd_rcfg(); @@ -607,6 +604,8 @@ /* EEH {HACK ALERT}: We add this property with hash_update manually since Zend doesn't offer a add_property_array. + DG {END HACK ALERT} TODO: replace by the following line in PHP 4.0.5 + add_property_zval(return_value, "argv", argv); */ zend_hash_update(return_value->value.obj.properties, "argv", 5, &argv, sizeof(argv), NULL); @@ -615,6 +614,16 @@ add_property_stringl(return_value, "self", rcfg->req->uri, rcfg->self_len, 1); + + MAKE_STD_ZVAL(types); + array_init(types); + for (i = 1; i < MIDGARD_OBJECT_COUNT; i++) { + add_assoc_long(types, (char *)mgd_table_extname[i], i); + } + + //add_property_zval(return_value, "types", types); + zend_hash_update(return_value->value.obj.properties, "types", 6, +&types, sizeof(types), NULL); } MGD_FUNCTION(auth_midgard) @@ -740,6 +749,68 @@ zval_dtor(args[1]); } +#if YOU_WANT_TO_TEST +MGD_FUNCTION(walk_tree) +{ + zval **id, **level, **xparam, *xp[2], **order; + zval **midgard_user_call_func_name, **sort = NULL; + zval **tableid, **upfield; + CHECK_MGD; + + switch (ZEND_NUM_ARGS()) { + case 8: + if (zend_get_parameters_ex(8, &tableid, &upfield, + &midgard_user_call_func_name, &id, +&level, &xparam, &order, &sort) == FAILURE) { + WRONG_PARAM_COUNT; + } + break; + case 7: + if (zend_get_parameters_ex(7, &tableid, &upfield, + &midgard_user_call_func_name, &id, +&level, &xparam, &order) == FAILURE) { + WRONG_PARAM_COUNT; + } else { + sort = NULL; + } + break; + case 6: + if (zend_get_parameters_ex(6, &tableid, &upfield, + &midgard_user_call_func_name, &id, +&level, &xparam) == FAILURE) { + WRONG_PARAM_COUNT; + } else { + order = NULL; + sort = NULL; + } + break; + default: + WRONG_PARAM_COUNT; + break; + } + + convert_to_long_ex(tableid); + if(!(*tableid)->value.lval) RETURN_FALSE; + convert_to_string_ex(upfield); + convert_to_string_ex(midgard_user_call_func_name); + convert_to_long_ex(level); + if (order) convert_to_long_ex(order); + convert_to_long_ex(id); + if(sort) convert_to_string_ex(sort); + + xp[0] = (*xparam); + xp[1] = (*midgard_user_call_func_name); + mgd_walk_table_tree(mgd_handle(), mgd_table_name[(*tableid)->value.lval], +
[PHP-CVS] cvs: php4 /ext/midgard oop.c
davidg Fri Feb 23 01:46:48 2001 EDT Modified files: /php4/ext/midgard oop.c Log: typo fixed. Index: php4/ext/midgard/oop.c diff -u php4/ext/midgard/oop.c:1.5 php4/ext/midgard/oop.c:1.6 --- php4/ext/midgard/oop.c:1.5 Wed Feb 21 14:18:54 2001 +++ php4/ext/midgard/oop.c Fri Feb 23 01:46:47 2001 @@ -1,4 +1,4 @@ -/* $Id: oop.c,v 1.5 2001/02/21 22:18:54 emile Exp $ +/* $Id: oop.c,v 1.6 2001/02/23 09:46:47 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -654,7 +654,7 @@ midgard_res *res; long table, id; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ht, 1, &guid) != SUCCESS) { + if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &guid) != SUCCESS) { WRONG_PARAM_COUNT; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard midgard.c
davidg Fri Feb 23 01:53:49 2001 EDT Modified files: /php4/ext/midgard midgard.c Log: removed unneeded header inclusion. Index: php4/ext/midgard/midgard.c diff -u php4/ext/midgard/midgard.c:1.15 php4/ext/midgard/midgard.c:1.16 --- php4/ext/midgard/midgard.c:1.15 Fri Feb 23 01:22:08 2001 +++ php4/ext/midgard/midgard.c Fri Feb 23 01:53:49 2001 @@ -1,4 +1,4 @@ -/* $Id: midgard.c,v 1.15 2001/02/23 09:22:08 davidg Exp $ +/* $Id: midgard.c,v 1.16 2001/02/23 09:53:49 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -19,10 +19,6 @@ */ #include "php.h" -#include "php_ini.h" -#include "php_logos.h" -#include "php_main.h" -#include "SAPI.h" #include "ext/standard/info.h" #include "php_midgard.h" -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard oop.c
davidg Fri Feb 23 02:04:48 2001 EDT Modified files: /php4/ext/midgard oop.c Log: another typo. Index: php4/ext/midgard/oop.c diff -u php4/ext/midgard/oop.c:1.6 php4/ext/midgard/oop.c:1.7 --- php4/ext/midgard/oop.c:1.6 Fri Feb 23 01:46:47 2001 +++ php4/ext/midgard/oop.c Fri Feb 23 02:04:48 2001 @@ -1,4 +1,4 @@ -/* $Id: oop.c,v 1.6 2001/02/23 09:46:47 davidg Exp $ +/* $Id: oop.c,v 1.7 2001/02/23 10:04:48 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -660,7 +660,7 @@ if ((*guid)->type != IS_STRING) { RETURN_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); } - res = mgd_sitegroup_select(mgd_handle(), "realm,id" "repligard", + res = mgd_sitegroup_select(mgd_handle(), "realm,id", "repligard", "guid=$q", NULL, (*guid)->value.str.val); if (!res || !mgd_fetch(res)) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard config.m4
davidg Fri Feb 23 03:55:57 2001 EDT Modified files: /php4/ext/midgard config.m4 Log: Added --with-mgd-experimental option to compile experimental stuff (off by defeult) Index: php4/ext/midgard/config.m4 diff -u php4/ext/midgard/config.m4:1.7 php4/ext/midgard/config.m4:1.8 --- php4/ext/midgard/config.m4:1.7 Tue Feb 20 16:57:28 2001 +++ php4/ext/midgard/config.m4 Fri Feb 23 03:55:57 2001 @@ -1,4 +1,4 @@ -dnl $Id: config.m4,v 1.7 2001/02/21 00:57:28 emile Exp $ +dnl $Id: config.m4,v 1.8 2001/02/23 11:55:57 davidg Exp $ dnl Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> dnl Copyright (C) 2000 The Midgard Project ry @@ -56,4 +56,12 @@ LFLAGS="$LFLAGS -Pmgd -olex.yy.c" PHP_SUBST(GLIBCONFIG) + + AC_MSG_CHECKING(for midgard experimental functions support) + AC_ARG_WITH(mgd-experimental, + [ --with-mgd-experimental Include midgard 1.4.1 experimental functions +support], PHP_MIDGARD_EXPERIMENTAL=[$]withval, PHP_MIDGARD_EXPERIMENTAL="no") + echo "$PHP_MIDGARD_EXPERIMENTAL"; + if test "$PHP_MIDGARD_EXPERIMENTAL" == "yes"; then +AC_DEFINE(YOU_WANT_TO_TEST, 1, [ ]) + fi fi -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard config.m4 preparser.c
davidg Fri Feb 23 15:14:42 2001 EDT Modified files: /php4/ext/midgard preparser.c config.m4 Log: - workaround for the function mgd_eval() to return a value like the PHP eval(). - changed --with-mgd-experimental to --enable-mgd-experimental Index: php4/ext/midgard/preparser.c diff -u php4/ext/midgard/preparser.c:1.5 php4/ext/midgard/preparser.c:1.6 --- php4/ext/midgard/preparser.c:1.5Tue Feb 20 03:14:55 2001 +++ php4/ext/midgard/preparser.cFri Feb 23 15:14:42 2001 @@ -1,4 +1,4 @@ -/* $Id: preparser.c,v 1.5 2001/02/20 11:14:55 emile Exp $ +/* $Id: preparser.c,v 1.6 2001/02/23 23:14:42 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -345,6 +345,77 @@ mgd_free_pool(pool); } +/* DG {HACK ALERT}: Since the function zend_eval_string does not behave like + * the statement eval(), thie following function is the exact copy of the + * function zend_eval_string with some lines commented out. + * This is necessary to keep the compatibility between eval() and mgd_eval() + */ +static int mgd_eval_string(char *str, zval *retval_ptr, char *string_name CLS_DC +ELS_DC) +{ + zval pv; + zend_op_array *new_op_array; + zend_op_array *original_active_op_array = EG(active_op_array); + zend_function_state *original_function_state_ptr = EG(function_state_ptr); + int original_handle_op_arrays; + int retval; + +// if (retval_ptr) { +// pv.value.str.len = strlen(str)+sizeof("return ;")-1; +// pv.value.str.val = emalloc(pv.value.str.len+1); +// strcpy(pv.value.str.val, "return "); +// strcat(pv.value.str.val, str); +// strcat(pv.value.str.val, " ;"); +// } else { + pv.value.str.len = strlen(str); + pv.value.str.val = estrndup(str, pv.value.str.len); +// } + pv.type = IS_STRING; + + /*printf("Evaluating '%s'\n", pv.value.str.val);*/ + + original_handle_op_arrays = CG(handle_op_arrays); + CG(handle_op_arrays) = 0; + new_op_array = compile_string(&pv, string_name CLS_CC); + CG(handle_op_arrays) = original_handle_op_arrays; + + if (new_op_array) { + zval *local_retval_ptr=NULL; + zval **original_return_value_ptr_ptr = EG(return_value_ptr_ptr); + zend_op **original_opline_ptr = EG(opline_ptr); + + EG(return_value_ptr_ptr) = &local_retval_ptr; + EG(active_op_array) = new_op_array; + EG(no_extensions)=1; + + zend_execute(new_op_array ELS_CC); + + if (local_retval_ptr) { + if (retval_ptr) { + COPY_PZVAL_TO_ZVAL(*retval_ptr, local_retval_ptr); + } else { + zval_ptr_dtor(&local_retval_ptr); + } + } else { + if (retval_ptr) { + INIT_ZVAL(*retval_ptr); + } + } + + EG(no_extensions)=0; + EG(opline_ptr) = original_opline_ptr; + EG(active_op_array) = original_active_op_array; + EG(function_state_ptr) = original_function_state_ptr; + destroy_op_array(new_op_array); + efree(new_op_array); + EG(return_value_ptr_ptr) = original_return_value_ptr_ptr; + retval = SUCCESS; + } else { + retval = FAILURE; + } + zval_dtor(&pv); + return retval; +} + MGD_FUNCTION(eval) { zval **string, **name; @@ -370,20 +441,9 @@ WRONG_PARAM_COUNT; } if((*string)->value.str.len) { -#ifdef MGD_PREPARSER_LOG - zend_syntax_highlighter_ini syntax_highlighter_ini; - php_get_highlight_struct(&syntax_highlighter_ini); -// highlight_string(*string, &syntax_highlighter_ini, tmp); -#endif pool = mgd_alloc_pool(); value = php_eval_midgard(pool, tmp, (*string)->value.str.val, 0); -#ifdef MGD_PREPARSER_LOG -MGD_LOG_START("mgd_eval(%s) '%s'\n\n\n\n\n\n\n\n") - MGD_LOG_ARG(tmp) - MGD_LOG_ARG(value) -MGD_LOG_END() -#endif - if(zend_eval_string(value, NULL /* return_value */, tmp CLS_CC ELS_CC) != SUCCESS) { + if(mgd_eval_string(value, return_value, tmp CLS_CC ELS_CC) != SUCCESS) +{ /* DG: we probably want to turn that off when stable and ready to release * or at least offer the user an option to turn it off, as it exposes the * PHP source (security issue here) @@ -449,4 +509,5 @@ } } } + #endif /* HAVE_MIDGARD */ Index: php4/ext/midgard/config.m4 diff -u php4/ext/midgard/config.m4:1.9 php4/ext/midgard/config.m4:1.10 --- php4/ext/midgard/c
[PHP-CVS] cvs: php4 /ext/midgard preparser-parser.y preparser-scanner.l
davidg Fri Feb 23 16:01:00 2001 EDT Modified files: /php4/ext/midgard preparser-parser.y preparser-scanner.l Log: passing include()'ed files thru the preparser. Index: php4/ext/midgard/preparser-parser.y diff -u php4/ext/midgard/preparser-parser.y:1.4 php4/ext/midgard/preparser-parser.y:1.5 --- php4/ext/midgard/preparser-parser.y:1.4 Tue Feb 20 03:14:55 2001 +++ php4/ext/midgard/preparser-parser.y Fri Feb 23 16:00:59 2001 @@ -1,5 +1,5 @@ %{ -/* $Id: preparser-parser.y,v 1.4 2001/02/20 11:14:55 emile Exp $ +/* $Id: preparser-parser.y,v 1.5 2001/02/24 00:00:59 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -42,7 +42,7 @@ %token MGD_SNIP %token MGD_SNIPE %token MGD_EVAL -%token MGD_EVALE +%token MGD_INCLUDE %% @@ -183,6 +183,17 @@ mgd_append_output_buffer_const("mgd_eval("); mgd_append_output_buffer_data($2); mgd_append_output_buffer_const(")"); + mgd_free_buffer($2); + } + | MGD_INCLUDE STRING { +#ifdef PARSER_DEBUG + mgd_append_output_buffer_const("parsed include: "); + mgd_append_output_buffer_data($2); +#endif + mgd_append_output_buffer_const("$midgard->pp_tmp=\"?>\"." + + "implode(\"\\n\",file("); + mgd_append_output_buffer_data($2); + mgd_append_output_buffer_const(")).\"pp_tmp);"); mgd_free_buffer($2); } ; Index: php4/ext/midgard/preparser-scanner.l diff -u php4/ext/midgard/preparser-scanner.l:1.4 php4/ext/midgard/preparser-scanner.l:1.5 --- php4/ext/midgard/preparser-scanner.l:1.4Thu Feb 22 17:08:43 2001 +++ php4/ext/midgard/preparser-scanner.lFri Feb 23 16:00:59 2001 @@ -1,6 +1,6 @@ %{ -/* $Id: preparser-scanner.l,v 1.4 2001/02/23 01:08:43 davidg Exp $ +/* $Id: preparser-scanner.l,v 1.5 2001/02/24 00:00:59 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -48,6 +48,9 @@ %x IN_EVAL %x IN_EVALQ %x IN_EVALQQ +%x IN_INCLUDE +%x IN_INCLUDEQ +%x IN_INCLUDEQQ %option stack %option noyywrap @@ -259,6 +262,67 @@ } {ANY} { + if(yytext[0] == '(') par_stack++; + if(yytext[0] == ')') par_stack--; + if(par_stack < 0) { +yy_pop_state(); +return STRING; + } + mgd_append_byte(mgdlval.gstring, mgdtext); +} + +[^a-zA-Z0-9_]"include"{WHITESPACE}*"(" { +/* TODO: change the [^_] to make it conditional, so it's not part of the match + */ + mgd_append_byte(mgd_output_buffer, mgdtext); + yy_push_state(IN_INCLUDE); + par_stack=0; + in_string = 0; + mgdlval.gstring = g_byte_array_new(); + return MGD_INCLUDE; +} + +{quote} { + yy_push_state(IN_INCLUDEQ); + in_string = mgdtext[0]; + mgd_append_byte(mgdlval.gstring, mgdtext); +} + +{dquote} { + yy_push_state(IN_INCLUDEQQ); + in_string = mgdtext[0]; + mgd_append_byte(mgdlval.gstring, mgdtext); +} + +[\\]{quote} { + mgd_append_byte(mgdlval.gstring, mgdtext); + mgd_append_byte(mgdlval.gstring, mgdtext+1); +} + +{quote} { + mgd_append_byte(mgdlval.gstring, mgdtext); + yy_pop_state(); +} + +{ANY} { + mgd_append_byte(mgdlval.gstring, mgdtext); +} + +[\\]{dquote} { + mgd_append_byte(mgdlval.gstring, mgdtext); + mgd_append_byte(mgdlval.gstring, mgdtext+1); +} + +{dquote} { + mgd_append_byte(mgdlval.gstring, mgdtext); + yy_pop_state(); +} + +{ANY} { + mgd_append_byte(mgdlval.gstring, mgdtext); +} + +{ANY} { if(yytext[0] == '(') par_stack++; if(yytext[0] == ')') par_stack--; if(par_stack < 0) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard mgd_preparser.h
davidg Fri Feb 23 16:48:44 2001 EDT Modified files: /php4/ext/midgard mgd_preparser.h Log: Fixed some potential and real segfaults. Index: php4/ext/midgard/mgd_preparser.h diff -u php4/ext/midgard/mgd_preparser.h:1.4 php4/ext/midgard/mgd_preparser.h:1.5 --- php4/ext/midgard/mgd_preparser.h:1.4Tue Feb 20 03:29:52 2001 +++ php4/ext/midgard/mgd_preparser.hFri Feb 23 16:48:43 2001 @@ -1,4 +1,4 @@ -/* $Id: mgd_preparser.h,v 1.4 2001/02/20 11:29:52 emile Exp $ +/* $Id: mgd_preparser.h,v 1.5 2001/02/24 00:48:43 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -43,15 +43,15 @@ } \ } -#define mgd_free_buffer(buffer) g_byte_array_free((buffer), TRUE) -#define mgd_append_buffer(buffer, str) if(strlen(str) > 0 )\ - g_byte_array_append((buffer), (str), strlen(str)); -#define mgd_append_output_buffer_const(str) if(sizeof(str) > 0 )\ - g_byte_array_append(mgd_output_buffer, (str), (sizeof(str) == 1) ? 1 : sizeof(str)-1 ); -#define mgd_append_output_buffer(str) if(strlen(str) > 0 )\ - g_byte_array_append(mgd_output_buffer, (str), strlen(str)); -#define mgd_append_output_buffer_data(gstr) if((gstr)->len > 0 )\ - g_byte_array_append(mgd_output_buffer, (gstr)->data, (gstr)->len); +#define mgd_free_buffer(buffer) {if(buffer) g_byte_array_free((buffer), TRUE);} +#define mgd_append_buffer(buffer, str) { if(str && strlen(str) > 0 )\ + g_byte_array_append((buffer), (str), strlen(str)); } +#define mgd_append_output_buffer_const(str) { if(sizeof(str) > 0 )\ + g_byte_array_append(mgd_output_buffer, (str), (sizeof(str) == 1) ? 1 : +sizeof(str)-1 ); } +#define mgd_append_output_buffer(str) { if(str && strlen(str) > 0 )\ + g_byte_array_append(mgd_output_buffer, (str), strlen(str)); } +#define mgd_append_output_buffer_data(gstr) { if(gstr && (gstr)->len > 0 )\ + g_byte_array_append(mgd_output_buffer, (gstr)->data, (gstr)->len); } //#define MGD_PREPARSER_LOG -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard article.c calendar.c event.c person.c topic.c
davidg Sat Feb 24 05:39:30 2001 EDT Modified files: /php4/ext/midgard article.c calendar.c event.c person.c topic.c Log: fixed some possible memory leaks. Index: php4/ext/midgard/article.c diff -u php4/ext/midgard/article.c:1.7 php4/ext/midgard/article.c:1.8 --- php4/ext/midgard/article.c:1.7 Thu Feb 22 09:39:37 2001 +++ php4/ext/midgard/article.c Sat Feb 24 05:39:30 2001 @@ -1,4 +1,4 @@ -/* $Id: article.c,v 1.7 2001/02/22 17:39:37 davidg Exp $ +/* $Id: article.c,v 1.8 2001/02/24 13:39:30 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -59,12 +59,14 @@ ids = mgd_tree(mgd_handle(), "topic", "up", (*root)->value.lval, 0, NULL); if (ids) { - id = - mgd_idfield(mgd_handle(), "topic", "article", + id = mgd_idfield(mgd_handle(), "topic", "article", (*article)->value.lval); for (i = 0; ids[i]; i++) - if (ids[i] == id) + if (ids[i] == id) { + free(ids); RETURN_TRUE; + } + free(ids); } } @@ -254,21 +256,24 @@ topics = mgd_tree(mgd_handle(), "topic", "up", (*id)->value.lval, 0, NULL); - if (typev == -1) - php_midgard_select(&MidgardArticle, return_value, - ARTICLE_SELECT, - ARTICLE_FROM, - "article.topic IN $D AND author=person.id" - " AND (article.up=$d OR 1=$d)", - sortv, topics, up, up_wild); - else - php_midgard_select(&MidgardArticle, return_value, - ARTICLE_SELECT, - ARTICLE_FROM, - "article.type=$d AND article.topic IN $D" - " AND (article.up=$d OR 1=$d)" - " AND author=person.id", - sortv, typev, topics, up, up_wild); + if(topics) { + if (typev == -1) + php_midgard_select(&MidgardArticle, return_value, + ARTICLE_SELECT, + ARTICLE_FROM, + "article.topic IN $D AND author=person.id" + " AND (article.up=$d OR 1=$d)", + sortv, topics, up, up_wild); + else + php_midgard_select(&MidgardArticle, return_value, + ARTICLE_SELECT, + ARTICLE_FROM, + "article.type=$d AND article.topic IN $D" + " AND (article.up=$d OR 1=$d)" + " AND author=person.id", + sortv, typev, topics, up, up_wild); + free(topics); + } } MGD_FUNCTION(list_topic_articles_all_fast) @@ -331,20 +336,23 @@ topics = mgd_tree(mgd_handle(), "topic", "up", (*id)->value.lval, 0, NULL); - if (typev == -1) - php_midgard_select(&MidgardArticle, return_value, - ARTICLE_SELECT_FAST, - ARTICLE_FROM_FAST, - "article.topic IN $D" - " AND (article.up=$d OR 1=$d)", - sortv, topics, up, up_wild); - else - php_midgard_select(&MidgardArticle, return_value, - ARTICLE_SELECT_FAST, - ARTICLE_FROM_FAST, - "article.type=$d AND article.topic IN $D" - " AND (article.up=$d OR 1=$d)", - sortv, typev, topics, up, up_wild); + if(topics) { + if (typev == -1) + php_midgard_select(&MidgardArticle, return_value, + ARTICLE_SELECT_FAST, + ARTICLE_FROM_FAST, + "article.topic IN $D" + " AND (article.up=$d OR 1=$d)", + sortv, topics, up, up_wild); + else + php_midgard_select(&MidgardArticle, return_value, + ARTICLE_SELECT_FAST, + ARTICLE_FROM_FAST, + "article.type=$d AND article.topic IN $D" +
[PHP-CVS] cvs: php4 /ext/midgard page.c
davidg Sat Feb 24 05:42:00 2001 EDT Modified files: /php4/ext/midgard page.c Log: fixed a possible memory leak Index: php4/ext/midgard/page.c diff -u php4/ext/midgard/page.c:1.7 php4/ext/midgard/page.c:1.8 --- php4/ext/midgard/page.c:1.7 Thu Feb 22 09:39:37 2001 +++ php4/ext/midgard/page.c Sat Feb 24 05:42:00 2001 @@ -1,4 +1,4 @@ -/* $Id: page.c,v 1.7 2001/02/22 17:39:37 davidg Exp $ +/* $Id: page.c,v 1.8 2001/02/24 13:42:00 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -91,9 +91,14 @@ RETURN_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); ids = mgd_tree(mgd_handle(), "page", "up", (*root)->value.lval, 0, NULL); - if (ids) + if (ids) { for (i = 0; ids[i]; i++) - if (ids[i] == (*page)->value.lval) RETURN_TRUE; + if (ids[i] == (*page)->value.lval) { + free(ids); + RETURN_TRUE; + } + free(ids); + } } MGD_FUNCTION(get_page) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard mgd_internal.h midgard.c oop.c php_midgard.h
davidg Sat Feb 24 13:12:11 2001 EDT Modified files: /php4/ext/midgard mgd_internal.h midgard.c oop.c php_midgard.h Log: fixed the error reporting. added custom log to the lib Index: php4/ext/midgard/mgd_internal.h diff -u php4/ext/midgard/mgd_internal.h:1.6 php4/ext/midgard/mgd_internal.h:1.7 --- php4/ext/midgard/mgd_internal.h:1.6 Thu Feb 22 09:39:37 2001 +++ php4/ext/midgard/mgd_internal.h Sat Feb 24 13:12:11 2001 @@ -1,4 +1,4 @@ -/* $Id: mgd_internal.h,v 1.6 2001/02/22 17:39:37 davidg Exp $ +/* $Id: mgd_internal.h,v 1.7 2001/02/24 21:12:11 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -42,7 +42,7 @@ if (!mgd_rcfg()) { \ RETURN_FALSE_BECAUSE(MGD_ERR_NOT_CONNECTED); \ } \ - mgd_set_errno(MGD_ERR_OK); \ + mgd_reset_errno(); \ } while (0); #define MGD_FUNCTION(name) \ Index: php4/ext/midgard/midgard.c diff -u php4/ext/midgard/midgard.c:1.16 php4/ext/midgard/midgard.c:1.17 --- php4/ext/midgard/midgard.c:1.16 Fri Feb 23 01:53:49 2001 +++ php4/ext/midgard/midgard.c Sat Feb 24 13:12:11 2001 @@ -1,4 +1,4 @@ -/* $Id: midgard.c,v 1.16 2001/02/23 09:53:49 davidg Exp $ +/* $Id: midgard.c,v 1.17 2001/02/24 21:12:11 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -373,6 +373,9 @@ SLS_FETCH(); MGDLS_FETCH(); + /* set apache log facilities available to the library */ + // mgd_set_log_debug_func(mgd_log_debug); + midgard_module = ap_find_linked_module("mod_midgard.c"); if (!midgard_module) { MGDG(rcfg) = NULL; @@ -552,10 +555,30 @@ MGDG(mgd_errno) = mgd_errno; } +void mgd_reset_errno(void) +{ + MGDLS_FETCH(); + MGDG(mgd_errno) = MGD_ERR_OK; +} + int mgd_get_errno() { MGDLS_FETCH(); return MGDG(mgd_errno); +} + +void mgd_log_debug(int flags, const char *fmt, ...) +{ + midgard_pool *pool; + char *str; + va_list args; + + pool = mgd_alloc_pool(); + va_start(args, fmt); + str = mgd_vformat(mgd_handle(), pool, fmt, args); + va_end(args); + MGD_LOG_START("\nDEBUG: %s") MGD_LOG_ARG(str) MGD_LOG_END() + mgd_free_pool(pool); } MGD_FUNCTION(get_midgard) Index: php4/ext/midgard/oop.c diff -u php4/ext/midgard/oop.c:1.7 php4/ext/midgard/oop.c:1.8 --- php4/ext/midgard/oop.c:1.7 Fri Feb 23 02:04:48 2001 +++ php4/ext/midgard/oop.c Sat Feb 24 13:12:11 2001 @@ -1,4 +1,4 @@ -/* $Id: oop.c,v 1.7 2001/02/23 10:04:48 davidg Exp $ +/* $Id: oop.c,v 1.8 2001/02/24 21:12:11 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -121,11 +121,7 @@ void php_midgard_delete(zval * return_value, const char *table, int id) { - if (!mgd_rcfg()) { - RETURN_FALSE_BECAUSE(MGD_ERR_NOT_CONNECTED); - } - - RETVAL_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); + CHECK_MGD; if (mgd_delete(mgd_handle(), table, id)) { RETURN_TRUE; @@ -151,17 +147,14 @@ const char *fields, int id, ...) { va_list args; - RETVAL_FALSE_BECAUSE(MGD_ERR_INTERNAL); - - if (!mgd_rcfg()) { - RETURN_FALSE_BECAUSE(MGD_ERR_NOT_CONNECTED); - } + CHECK_MGD; va_start(args, id); if (mgd_vupdate(mgd_handle(), table, id, fields, args)) { RETVAL_TRUE; } else { + RETVAL_FALSE_BECAUSE(MGD_ERR_INTERNAL); /* EEH: TODO: log_error( "Midgard: update of %s %d failed", table ? table : "", id); @@ -178,8 +171,6 @@ int id; CHECK_MGD; - RETVAL_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); - va_start(args, values); id = mgd_vcreate(mgd_handle(), table, fields, values, args); va_end(args); @@ -202,11 +193,7 @@ va_list args; midgard_res *res; - if (!mgd_rcfg()) { - RETURN_FALSE_BECAUSE(MGD_ERR_NOT_CONNECTED); - } - - RETVAL_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); + CHECK_MGD; va_start(args, order); res = @@ -242,11 +229,7 @@ midgard_pool *pool = NULL; char *propname, *value=NULL; - if (!mgd_rcfg()) { - RETURN_FALSE_BECAUSE(MGD_ERR_NOT_CONNECTED); - } - - RETVAL_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); + CHECK_MGD; #if HAVE_MIDGARD_SITEGROUPS if (grouped) @@ -284,7 +267,7 @@ (char*)mgd_colname(res, i), value, 1); } - } + } else RETVAL_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); if (res) mgd_release(res); @@ -314,7 +297,6 @@ int i;
[PHP-CVS] cvs: php4 /ext/midgard article.c midgard.c page.c topic.c
davidg Sun Feb 25 11:31:17 2001 EDT Modified files: /php4/ext/midgard article.c midgard.c page.c topic.c Log: optimized the mgd_is_in_xxx_tree() functions Index: php4/ext/midgard/article.c diff -u php4/ext/midgard/article.c:1.8 php4/ext/midgard/article.c:1.9 --- php4/ext/midgard/article.c:1.8 Sat Feb 24 05:39:30 2001 +++ php4/ext/midgard/article.c Sun Feb 25 11:31:17 2001 @@ -1,4 +1,4 @@ -/* $Id: article.c,v 1.8 2001/02/24 13:39:30 davidg Exp $ +/* $Id: article.c,v 1.9 2001/02/25 19:31:17 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -32,7 +32,6 @@ MGD_FUNCTION(is_article_in_topic_tree) { zval **root, **article; - int *ids, id, i; RETVAL_FALSE; CHECK_MGD; @@ -57,17 +56,10 @@ return; #endif - ids = mgd_tree(mgd_handle(), "topic", "up", (*root)->value.lval, 0, NULL); - if (ids) { - id = mgd_idfield(mgd_handle(), "topic", "article", - (*article)->value.lval); - for (i = 0; ids[i]; i++) - if (ids[i] == id) { - free(ids); - RETURN_TRUE; - } - free(ids); - } + if(mgd_is_in_tree(mgd_handle(), "topic", "up", (*root)->value.lval, + mgd_idfield(mgd_handle(), "topic", "article", + (*article)->value.lval))) + RETURN_TRUE; } const char *article_sort(const char *order) Index: php4/ext/midgard/midgard.c diff -u php4/ext/midgard/midgard.c:1.17 php4/ext/midgard/midgard.c:1.18 --- php4/ext/midgard/midgard.c:1.17 Sat Feb 24 13:12:11 2001 +++ php4/ext/midgard/midgard.c Sun Feb 25 11:31:17 2001 @@ -1,4 +1,4 @@ -/* $Id: midgard.c,v 1.17 2001/02/24 21:12:11 davidg Exp $ +/* $Id: midgard.c,v 1.18 2001/02/25 19:31:17 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -374,7 +374,7 @@ MGDLS_FETCH(); /* set apache log facilities available to the library */ - // mgd_set_log_debug_func(mgd_log_debug); + mgd_set_log_debug_func(mgd_log_debug); midgard_module = ap_find_linked_module("mod_midgard.c"); if (!midgard_module) { @@ -754,7 +754,8 @@ ALLOC_ZVAL(return_value); ZVAL_NULL(return_value); ALLOC_ZVAL(args[0]);ZVAL_LONG(args[0], id); ALLOC_ZVAL(args[1]);ZVAL_LONG(args[1], level); - args[2] = xp[0];// DG: is this needed ? -> zval_copy_ctor(args[2]); + args[2] = xp[0];// DG: is this needed ? -> + zval_copy_ctor(args[2]); if(call_user_function(CG(function_table), NULL, xp[1], return_value, 3, Index: php4/ext/midgard/page.c diff -u php4/ext/midgard/page.c:1.8 php4/ext/midgard/page.c:1.9 --- php4/ext/midgard/page.c:1.8 Sat Feb 24 05:42:00 2001 +++ php4/ext/midgard/page.c Sun Feb 25 11:31:17 2001 @@ -1,4 +1,4 @@ -/* $Id: page.c,v 1.8 2001/02/24 13:42:00 davidg Exp $ +/* $Id: page.c,v 1.9 2001/02/25 19:31:17 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -70,7 +70,6 @@ MGD_FUNCTION(is_in_page_tree) { zval **root, **page; -int *ids, i; RETVAL_FALSE; CHECK_MGD; @@ -90,15 +89,9 @@ if(!mgd_exists_id(mgd_handle(), "page", "id=$d", (*root)->value.lval)) RETURN_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); -ids = mgd_tree(mgd_handle(), "page", "up", (*root)->value.lval, 0, NULL); - if (ids) { - for (i = 0; ids[i]; i++) - if (ids[i] == (*page)->value.lval) { - free(ids); - RETURN_TRUE; - } - free(ids); - } +if(mgd_is_in_tree(mgd_handle(), "page", "up", + (*root)->value.lval, +(*page)->value.lval)) + RETURN_TRUE; } MGD_FUNCTION(get_page) Index: php4/ext/midgard/topic.c diff -u php4/ext/midgard/topic.c:1.8 php4/ext/midgard/topic.c:1.9 --- php4/ext/midgard/topic.c:1.8Sat Feb 24 05:39:30 2001 +++ php4/ext/midgard/topic.cSun Feb 25 11:31:17 2001 @@ -1,4 +1,4 @@ -/* $Id: topic.c,v 1.8 2001/02/24 13:39:30 davidg Exp $ +/* $Id: topic.c,v 1.9 2001/02/25 19:31:17 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -103,7 +103,7 @@ MGD_FUNCTION(is_in_topic_tree) { zval **root, **topi
[PHP-CVS] cvs: php4 /ext/midgard midgard.c
davidg Sun Feb 25 15:34:48 2001 EDT Modified files: /php4/ext/midgard midgard.c Log: force user to pass $xparam by reference (from mgd_walk_xxx_tree() functions) Index: php4/ext/midgard/midgard.c diff -u php4/ext/midgard/midgard.c:1.18 php4/ext/midgard/midgard.c:1.19 --- php4/ext/midgard/midgard.c:1.18 Sun Feb 25 11:31:17 2001 +++ php4/ext/midgard/midgard.c Sun Feb 25 15:34:48 2001 @@ -1,4 +1,4 @@ -/* $Id: midgard.c,v 1.18 2001/02/25 19:31:17 davidg Exp $ +/* $Id: midgard.c,v 1.19 2001/02/25 23:34:48 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -751,22 +751,28 @@ zval ** xp = (zval **)xparam; zval *return_value; + if(!PZVAL_IS_REF(xp[0])) { + /* DG: Do we force the user to pass it by reference ? */ + php_error(E_WARNING,"You must pass the fourth parameter by +reference."); + return; + } ALLOC_ZVAL(return_value); ZVAL_NULL(return_value); ALLOC_ZVAL(args[0]);ZVAL_LONG(args[0], id); ALLOC_ZVAL(args[1]);ZVAL_LONG(args[1], level); - args[2] = xp[0];// DG: is this needed ? -> - zval_copy_ctor(args[2]); + args[2] = xp[0];// DG: is this needed ? +->zval_copy_ctor(args[2]); if(call_user_function(CG(function_table), NULL, xp[1], return_value, 3, args) != SUCCESS) { php_error(E_WARNING,"Unable to call %s() - function does not exist", (xp[1])->value.str.val); + zval_dtor(return_value); + zval_dtor(args[0]); zval_dtor(args[1]); return; } + zval_dtor(return_value); - zval_dtor(args[0]); - zval_dtor(args[1]); + zval_dtor(args[0]); zval_dtor(args[1]); } #if YOU_WANT_TO_TEST -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard snippetdir.c
davidg Mon Feb 26 01:45:04 2001 EDT Modified files: /php4/ext/midgard snippetdir.c Log: fixed bug #121 Index: php4/ext/midgard/snippetdir.c diff -u php4/ext/midgard/snippetdir.c:1.5 php4/ext/midgard/snippetdir.c:1.6 --- php4/ext/midgard/snippetdir.c:1.5 Wed Feb 21 14:18:54 2001 +++ php4/ext/midgard/snippetdir.c Mon Feb 26 01:45:04 2001 @@ -1,4 +1,4 @@ -/* $Id: snippetdir.c,v 1.5 2001/02/21 22:18:54 emile Exp $ +/* $Id: snippetdir.c,v 1.6 2001/02/26 09:45:04 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -145,7 +145,7 @@ switch (ZEND_NUM_ARGS()) { case 3: if (zend_get_parameters_ex - (ht, 3, &name, &description, + (3, &name, &description, &owner) != SUCCESS) WRONG_PARAM_COUNT; break; case 4: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard article.c attachment.c calendar.c element.c event.c eventmember.c file.c group.c host.c image.c mail.c member.c mgd_article.h mgd_attachment.h mgd_calendar.h mgd_element.h mgd_event.h mgd_eventmember.h mgd_file.h mgd_group.h mgd_host.h mgd_image.h mgd_internal.h mgd_mail.h mgd_member.h mgd_oop.h mgd_page.h mgd_pageelement.h mgd_pagelink.h mgd_person.h mgd_preferences.h mgd_preparser.h mgd_sitegroup.h mgd_snippet.h mgd_snippetdir.h mgd_style.h mgd_topic.h midgard.c oop.c page.c pageelement.c pagelink.c parameter.c person.c preferences.c preparser.c sitegroup.c snippet.c snippetdir.c style.c topic.c
davidg Tue Feb 27 17:00:40 2001 EDT Modified files: /php4/ext/midgard article.c attachment.c calendar.c element.c event.c eventmember.c file.c group.c host.c image.c mail.c member.c mgd_article.h mgd_attachment.h mgd_calendar.h mgd_element.h mgd_event.h mgd_eventmember.h mgd_file.h mgd_group.h mgd_host.h mgd_image.h mgd_internal.h mgd_mail.h mgd_member.h mgd_oop.h mgd_page.h mgd_pageelement.h mgd_pagelink.h mgd_person.h mgd_preferences.h mgd_preparser.h mgd_sitegroup.h mgd_snippet.h mgd_snippetdir.h mgd_style.h mgd_topic.h midgard.c oop.c page.c pageelement.c pagelink.c parameter.c person.c preferences.c preparser.c sitegroup.c snippet.c snippetdir.c style.c topic.c Log: First step towards automatic documentation Index: php4/ext/midgard/article.c diff -u php4/ext/midgard/article.c:1.9 php4/ext/midgard/article.c:1.10 --- php4/ext/midgard/article.c:1.9 Sun Feb 25 11:31:17 2001 +++ php4/ext/midgard/article.c Tue Feb 27 17:00:31 2001 @@ -1,4 +1,4 @@ -/* $Id: article.c,v 1.9 2001/02/25 19:31:17 davidg Exp $ +/* $Id: article.c,v 1.10 2001/02/28 01:00:31 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -22,14 +22,14 @@ #include "mgd_oop.h" #include "mgd_article.h" -MGD_FUNCTION(is_article_owner) +MGD_FUNCTION(bool, is_article_owner, (int id)) { IDINIT; CHECK_MGD; RETVAL_LONG(isarticleowner(id)); } -MGD_FUNCTION(is_article_in_topic_tree) +MGD_FUNCTION(bool, is_article_in_topic_tree, (int topic_root, int id)) { zval **root, **article; @@ -103,7 +103,7 @@ return sort[i].sort; } -MGD_FUNCTION(list_topic_articles) +MGD_FUNCTION(mixed, list_topic_articles, (int id, [string sort, [int type, [int +up]]])) { const char *sortv = NULL; int typev = 0; @@ -177,7 +177,7 @@ up_wild); } -MGD_FUNCTION(list_reply_articles) +MGD_FUNCTION(mixed, list_reply_articles, (int id)) { IDINIT; CHECK_MGD; @@ -187,7 +187,7 @@ "article.created DESC", id); } -MGD_FUNCTION(list_topic_articles_all) +MGD_FUNCTION(mixed, list_topic_articles_all, (int id, [string sort, [int type, [int +up]]])) { int *topics; const char *sortv = NULL; @@ -268,7 +268,7 @@ } } -MGD_FUNCTION(list_topic_articles_all_fast) +MGD_FUNCTION(mixed, list_topic_articles_all_fast, (int id, [string sort, [int type, +[int up]]])) { int *topics; const char *sortv = NULL; @@ -347,7 +347,7 @@ } } -MGD_FUNCTION(list_topic_articles_all_of_person) +MGD_FUNCTION(mixed, list_topic_articles_all_of_person, (int topic, int person)) { int *topics; zval **topic, **person; @@ -373,7 +373,7 @@ } } -MGD_FUNCTION(get_article) +MGD_FUNCTION(mixed, get_article, ([int id])) { zval **id; CHECK_MGD; @@ -403,7 +403,7 @@ php_midgard_get_object(return_value, MIDGARD_OBJECT_ARTICLE, (*id)->value.lval); } -MGD_FUNCTION(get_article_by_name) +MGD_FUNCTION(mixed, get_article_by_name, ([int topic, string name])) { zval **id, **name; CHECK_MGD; @@ -446,7 +446,7 @@ (*id)->value.lval, (*name)->value.str.val); } -MGD_FUNCTION(get_reply_by_name) +MGD_FUNCTION(mixed, get_reply_by_name, ([int article, string name])) { zval **id, **name; CHECK_MGD; @@ -478,7 +478,13 @@ (*id)->value.lval, (*name)->value.str.val); } -MGD_FUNCTION(create_article) +MGD_FUNCTION(int, create_article, (int up, int topic, string name, + string title, +string abstract, + string +content, string author, + string url, +string calstart, + int caldays, +int icon, int view, + int print, +string extra1, string extra2, + string extra3, +int type)) { zval **up, **topic, **name, **title, **abstract, **content, **author; zval **url, **calstart, **caldays, **icon, **view, **print; @@ -592,7 +598,7 @@ PHP_CREATE_REPLIGARD("article", return_value->value.lval); } -MGD_FUNCTION(update_article_score) +MGD_FUNCTION(bool, update_article_score, (int id, int scor
[PHP-CVS] cvs: php4 /ext/midgard attachment.c
davidg Wed Feb 28 07:50:06 2001 EDT Modified files: /php4/ext/midgard attachment.c Log: function reference: attachments Index: php4/ext/midgard/attachment.c diff -u php4/ext/midgard/attachment.c:1.6 php4/ext/midgard/attachment.c:1.7 --- php4/ext/midgard/attachment.c:1.6 Tue Feb 27 17:00:31 2001 +++ php4/ext/midgard/attachment.c Wed Feb 28 07:50:06 2001 @@ -1,4 +1,4 @@ -/* $Id: attachment.c,v 1.6 2001/02/28 01:00:31 davidg Exp $ +/* $Id: attachment.c,v 1.7 2001/02/28 15:50:06 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -70,7 +70,7 @@ (*name)->value.str.val); } -MGD_FUNCTION(ret_type, oop_attachment_create, (type param)) +MGD_FUNCTION(int, oop_attachment_create, (string name, string title, string mimetype, +[int score])) { zval *self; zval **zv_table, **zv_id; @@ -192,7 +192,7 @@ mgd_free_pool(pool); } -MGD_FUNCTION(ret_type, oop_attachment_list, (type param)) +MGD_FUNCTION(mixed, oop_attachment_list, ([string sort])) { zval *self, **zv_table, **zv_id, **zv_order; char *order = NULL; @@ -229,7 +229,7 @@ (*zv_table)->value.str.val, (*zv_id)->value.lval); } -MGD_FUNCTION(ret_type, open_attachment, (type param)) +MGD_FUNCTION(int, open_attachment, ([int id, [string mode]])) { int pid; int ptable; @@ -330,7 +330,7 @@ mgd_release(res); } -MGD_FUNCTION(ret_type, get_attachment, (type param)) +MGD_FUNCTION(mixed, get_attachment, (int id)) { zval **id; zval *self; @@ -338,11 +338,6 @@ CHECK_MGD; switch (ZEND_NUM_ARGS()) { - /* EEH/TODO: Why this? - case 0: - php_midgard_bless(return_value, &MidgardAttachment); - return; - */ case 1: if (zend_get_parameters_ex(1, &id) != SUCCESS) WRONG_PARAM_COUNT; break; @@ -359,7 +354,7 @@ php_midgard_get_object(return_value, MIDGARD_OBJECT_BLOBS, aid); } -MGD_FUNCTION(ret_type, serve_attachment, (type param)) +MGD_FUNCTION(bool, serve_attachment, (int id)) { midgard_res *res; const char *location, *mimetype; @@ -450,7 +445,7 @@ RETVAL_TRUE; } -MGD_FUNCTION(ret_type, stat_attachment, (type param)) +MGD_FUNCTION(mixed, stat_attachment, (int id)) { midgard_res *res; const char *location; @@ -537,7 +532,7 @@ #endif } -MGD_FUNCTION(ret_type, delete_attachment, (type param)) +MGD_FUNCTION(bool, delete_attachment, (int id)) { int pid; int ptable; @@ -610,7 +605,7 @@ mgd_release(res); } -MGD_FUNCTION(ret_type, update_attachment, (type param)) +MGD_FUNCTION(bool, update_attachment, (int id, string name, string title, string +mimetype, [int score, [int author]])) { zval **id, **name, **title, **mimetype, **score, **author, *self; int ptable, pid; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard mgd_internal.h midgard.c
davidg Tue Mar 6 09:56:17 2001 EDT Modified files: /php4/ext/midgard mgd_internal.h midgard.c Log: added ability to break tree walking Index: php4/ext/midgard/mgd_internal.h diff -u php4/ext/midgard/mgd_internal.h:1.8 php4/ext/midgard/mgd_internal.h:1.9 --- php4/ext/midgard/mgd_internal.h:1.8 Tue Feb 27 17:00:31 2001 +++ php4/ext/midgard/mgd_internal.h Tue Mar 6 09:56:17 2001 @@ -1,4 +1,4 @@ -/* $Id: mgd_internal.h,v 1.8 2001/02/28 01:00:31 davidg Exp $ +/* $Id: mgd_internal.h,v 1.9 2001/03/06 17:56:17 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -112,7 +112,7 @@ PHP_UPDATE_REPLIGARD(#roottable, (*root)->value.lval); \ } -void midgard_user_call_func(midgard *mgd, int id, int level, void * xparam); +int midgard_user_call_func(midgard *mgd, int id, int level, void * xparam); #define MGD_WALK_FUNCTION(table) \ MGD_WALK_FUNCTION_EX(table, table, up) @@ -162,13 +162,14 @@ \ xp[0] = (*xparam); \ xp[1] = (*midgard_user_call_func_name); \ - mgd_walk_table_tree(mgd_handle(), #table, #upfield, (*id)->value.lval, \ + RETVAL_LONG( \ + mgd_walk_table_tree(mgd_handle(), #table, #upfield, (*id)->value.lval, +\ (*level)->value.lval, \ order ? (*order)->value.lval : 1, \ (void *)xp, \ midgard_user_call_func, \ - sort ? (*sort)->value.str.val : NULL); \ - RETURN_TRUE; \ + sort ? +(*sort)->value.str.val : NULL) \ + ); \ } \ \ /* }}} */ Index: php4/ext/midgard/midgard.c diff -u php4/ext/midgard/midgard.c:1.20 php4/ext/midgard/midgard.c:1.21 --- php4/ext/midgard/midgard.c:1.20 Tue Feb 27 17:00:32 2001 +++ php4/ext/midgard/midgard.c Tue Mar 6 09:56:17 2001 @@ -1,4 +1,4 @@ -/* $Id: midgard.c,v 1.20 2001/02/28 01:00:32 davidg Exp $ +/* $Id: midgard.c,v 1.21 2001/03/06 17:56:17 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -745,16 +745,17 @@ } } -void midgard_user_call_func(midgard *mgd, int id, int level, void *xparam) +int midgard_user_call_func(midgard *mgd, int id, int level, void *xparam) { zval *args[3]; zval ** xp = (zval **)xparam; zval *return_value; + int retval; if(!PZVAL_IS_REF(xp[0])) { /* DG: Do we force the user to pass it by reference ? */ php_error(E_WARNING,"You must pass the fourth parameter by reference."); - return; + return 0; } ALLOC_ZVAL(return_value); ZVAL_NULL(return_value); ALLOC_ZVAL(args[0]);ZVAL_LONG(args[0], id); @@ -768,11 +769,17 @@ (xp[1])->value.str.val); zval_dtor(return_value); zval_dtor(args[0]); zval_dtor(args[1]); - return; + return 0; } - + if(return_value->type == IS_NULL) + retval = 1; + else { + convert_to_long_ex(&return_value); + retval = return_value->value.lval; + } zval_dtor(return_value); zval_dtor(args[0]); zval_dtor(args[1]); + return retval; } #if YOU_WANT_TO_TEST @@ -826,15 +833,17 @@ xp[0] = (*xparam); xp[1] = (*midgard_user_call_func_name); - mgd_walk_table_tree(mgd_handle(), mgd_table_name[(*tableid)->value.lval], + RETVAL_LONG( + mgd_walk_table_tree(mgd_handle(), + mgd_table_name[(*tableid)->value.lval], (*upfield)->value.str.val, (*id)->value.lval, (*level)->value.lval, order ? (*order)->value.lval : 1, (void *)xp, midgard_user_call_func, - sort ? (*sort)->value.str.val : NULL); - RETURN_TRUE; + sort ? +(*sort)->
[PHP-CVS] cvs: php4 /ext/midgard article.c mgd_session.h session.c session.sql
davidg Thu Mar 8 02:25:15 2001 EDT Added files: /php4/ext/midgard session.c mgd_session.h session.sql Modified files: /php4/ext/midgard article.c Log: Session management (experimental code) Index: php4/ext/midgard/article.c diff -u php4/ext/midgard/article.c:1.11 php4/ext/midgard/article.c:1.12 --- php4/ext/midgard/article.c:1.11 Tue Mar 6 02:35:02 2001 +++ php4/ext/midgard/article.c Thu Mar 8 02:25:15 2001 @@ -1,4 +1,4 @@ -/* $Id: article.c,v 1.11 2001/03/06 10:35:02 emile Exp $ +/* $Id: article.c,v 1.12 2001/03/08 10:25:15 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -770,7 +770,7 @@ MGD_FUNCTION(bool, update_article, (int id, int topic, string name, string title, string abstract, - string content, string author, + string +content, int author, string url, string calstart, int caldays, int icon, int view, int print, string extra1, string extra2, Index: php4/ext/midgard/session.c +++ php4/ext/midgard/session.c /* $Id: session.c,v 1.1 2001/03/08 10:25:15 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2001 David Guerizec, Aurora SA <[EMAIL PROTECTED]> This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "php_midgard.h" #if HAVE_MIDGARD #if HAVE_MIDGARD_SESSION #include "php.h" #include "../session/php_session.h" #include "mgd_session.h" #define GET_MGD midgard * mgd = mgd_handle(); typedef struct { int id; int ready; } ps_midgard; ps_module ps_mod_midgard = { PS_MOD(midgard) }; static int ps_midgard_valid_key(const char *key) { size_t len; const char *p; char c; int ret = 1; for (p = key; (c = *p); p++) { /* valid characters are a..z,A..Z,0..9 */ if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9'))) { ret = 0; break; } } len = p - key; if (len == 0) ret = 0; return ret; } static int ps_midgard_write(ps_midgard * data, const char * key, const char * val) { GET_MGD; if(!data->ready) return FAILURE; if(data->id) { if(mgd_update(mgd, "session", data->id, "sess_data='$s', " "expire=UNIX_TIMESTAMP() + 3600, " "changed=UNIX_TIMESTAMP()", val)) return SUCCESS; assert(0); } else { if((data->id = mgd_create(mgd, "session", "sess_key, sess_data, person, expire, changed", "$q, $q, $d, UNIX_TIMESTAMP() + 3600, UNIX_TIMESTAMP()", key, val, mgd_user(mgd return SUCCESS; assert(0); } return FAILURE; } static void ps_midgard_open(ps_midgard *data, const char *key) { GET_MGD; if(data->id) { php_error(E_WARNING, "Called twice ??"); } data->id = 0; if(!mgd) { php_error(E_WARNING,
[PHP-CVS] cvs: php4 /ext/midgard README.session config.m4.session session.modules.c
davidg Thu Mar 8 02:39:32 2001 EDT Added files: /php4/ext/midgard session.modules.c README.session config.m4.session Log: More on session installation. Index: php4/ext/midgard/session.modules.c +++ php4/ext/midgard/session.modules.c /* * To add a PHP session module, #include its header file and * add a ps_xxx_ptr in the struct... */ #include "mod_files.h" #include "mod_mm.h" #include "mod_user.h" #if HAVE_MIDGARD_SESSION #include "../midgard/mgd_session.h" #endif static ps_module *ps_modules[] = { ps_files_ptr, ps_mm_ptr, ps_user_ptr, #if HAVE_MIDGARD_SESSION ps_midgard_ptr, #endif }; Index: php4/ext/midgard/README.session +++ php4/ext/midgard/README.session To enable the session management: - add session.c in the Makefile.in to the LTLIBRARY_SOURCES: LTLIBRARY_SOURCES = mgd_errno.c midgard.c article.c \ parameter.c attachment.c oop.c \ topic.c element.c mail.c \ group.c file.c host.c image.c member.c \ calendar.c event.c eventmember.c page.c \ pageelement.c pagelink.c person.c \ preferences.c snippet.c \ snippetdir.c style.c sitegroup.c \ preparser-parser.c preparser-scanner.c \ preparser.c session.c - copy config.m4.session over config.m4 - copy session.modules.c over ext/session/modules.c Then run: $ phpize $ ./configure --with-midgard[=/path/to/midgard] --enable-mgd-session $ make # make install Then edit your php.ini: session.save_handler = midgard session.auto_start = 0 Restart apache. To test it, insert in a Midgard page the following code: --8<-- Hello visitor, you have seen this page &(count); times. is necessary to preserve the session id # in the case that the user has disabled cookies ?> To continue, click here --8<-- Index: php4/ext/midgard/config.m4.session +++ php4/ext/midgard/config.m4.session dnl $Id: config.m4.session,v 1.1 2001/03/08 10:39:31 davidg Exp $ dnl Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> dnl Copyright (C) 2000 The Midgard Project ry dnl Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> dnl dnl This program is free software; you can redistribute it and/or modify it dnl under the terms of the GNU Lesser General Public License as published dnl by the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA AC_PROG_YACC AC_DECL_YYTEXT AC_PROG_LEX PHP_ARG_WITH(midgard, for midgard support, [ --with-midgard Include midgard 1.4 support]) if test "$PHP_MIDGARD" != "no"; then if test "$PHP_MIDGARD" != "yes"; then AC_ADD_LIBRARY_WITH_PATH(midgard, "$PHP_MIDGARD/lib", MIDGARD_SHARED_LIBADD) AC_ADD_INCLUDE("$PHP_MIDGARD/include") else AC_ADD_LIBRARY(midgard) fi AC_DEFINE(HAVE_MIDGARD, 1, [ ]) PHP_EXTENSION(midgard, $ext_shared) dnl EEH/TODO: Add checks for apache-static compilation AC_PATH_PROG(APXS, apxs) if test -z $APXS; then AC_MSG_ERROR(apxs not found.) fi APACHE_INCLUDES=`$APXS -q INCLUDEDIR` AC_ADD_INCLUDE($APACHE_INCLUDES) AC_PATH_PROG(GLIBCONFIG, glib-config) dnl Ackackack... why do people do this? if test -z $GLIBCONFIG; then AC_PATH_PROG(GLIBCONFIG, glib12-config) fi if test -z $GLIBCONFIG; then AC_MSG_ERROR(glib-config not found. Did you install glib?) fi CFLAGS="$CFLAGS "`$GLIBCONFIG --cflags` LIBS="$LIBS "`$GLIBCONFIG --libs` LFLAGS="$LFLAGS -Pmgd -olex.yy.c" PHP_SUBST(GLIBCONFIG) AC_MSG_CHECKING(for midgard experimental functions support) AC_ARG_ENABLE(mgd-experimental, [ --enable-mgd-experimental Enable midgard 1.4.1 experimental functions support], PHP_MIDGARD_EXPERIMENTAL=[$]enableval, PHP_MIDGARD_EXPERIMENTAL="no") echo "$PHP_MIDGARD_EXPERIMENTAL"; if test "$PHP_MIDGARD_EXPERIMENTAL" != "no"; then AC_DEFINE(YOU_WANT_TO_TEST, 1, [ ]) fi AC_MSG_CHECKING(for midgard [experimental] session support) AC_ARG_ENABLE(mgd-session, [ --enable-mgd-session Enable midgard 1.4.1 [experimental] session support], PHP_MIDGARD_SESSION=[$]enableval, PHP_MIDGARD_SESSION="no") echo "$PHP_MIDGARD_SESSION"; if test "$PHP_MIDGARD_SESSION" != "no"; then AC_DEFINE(HAVE_MIDG
[PHP-CVS] cvs: php4 /ext/midgard README.session
davidg Thu Mar 8 02:42:33 2001 EDT Modified files: /php4/ext/midgard README.session Log: Corrected the README.session Index: php4/ext/midgard/README.session diff -u php4/ext/midgard/README.session:1.1 php4/ext/midgard/README.session:1.2 --- php4/ext/midgard/README.session:1.1 Thu Mar 8 02:39:31 2001 +++ php4/ext/midgard/README.session Thu Mar 8 02:42:29 2001 @@ -17,9 +17,10 @@ - copy session.modules.c over ext/session/modules.c -Then run: -$ phpize -$ ./configure --with-midgard[=/path/to/midgard] --enable-mgd-session +Then you have to compile PHP4 with Midgard: +cd ../../ # cd to top directory of PHP sources +$ ./buildconf +$ ./configure --with-apxs --with-midgard[=/path/to/midgard] --enable-mgd-session +--with-whatever-options $ make # make install -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard README.session
davidg Thu Mar 8 02:44:27 2001 EDT Modified files: /php4/ext/midgard README.session Log: Forgot to talk about the session table Index: php4/ext/midgard/README.session diff -u php4/ext/midgard/README.session:1.2 php4/ext/midgard/README.session:1.3 --- php4/ext/midgard/README.session:1.2 Thu Mar 8 02:42:29 2001 +++ php4/ext/midgard/README.session Thu Mar 8 02:44:27 2001 @@ -1,5 +1,8 @@ To enable the session management: +- create the session table in Midgard DB: +$ mysql -u midgard -p midgard < session.sql + - add session.c in the Makefile.in to the LTLIBRARY_SOURCES: LTLIBRARY_SOURCES = mgd_errno.c midgard.c article.c \ parameter.c attachment.c oop.c \ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard config.m4
davidg Thu Mar 8 02:49:18 2001 EDT Modified files: /php4/ext/midgard config.m4 Log: Midgard experimental functions support was not displayed correctly in ./configure Index: php4/ext/midgard/config.m4 diff -u php4/ext/midgard/config.m4:1.10 php4/ext/midgard/config.m4:1.11 --- php4/ext/midgard/config.m4:1.10 Fri Feb 23 15:14:42 2001 +++ php4/ext/midgard/config.m4 Thu Mar 8 02:49:18 2001 @@ -1,4 +1,4 @@ -dnl $Id: config.m4,v 1.10 2001/02/23 23:14:42 davidg Exp $ +dnl $Id: config.m4,v 1.11 2001/03/08 10:49:18 davidg Exp $ dnl Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> dnl Copyright (C) 2000 The Midgard Project ry @@ -61,7 +61,7 @@ AC_ARG_ENABLE(mgd-experimental, [ --enable-mgd-experimental Enable midgard 1.4.1 experimental functions support], PHP_MIDGARD_EXPERIMENTAL=[$]enableval, PHP_MIDGARD_EXPERIMENTAL="no") echo "$PHP_MIDGARD_EXPERIMENTAL"; - if test "$PHP_MIDGARD_EXPERIMENTAL" = "yes"; then + if test "$PHP_MIDGARD_EXPERIMENTAL" != "no"; then AC_DEFINE(YOU_WANT_TO_TEST, 1, [ ]) fi fi -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard article.c
davidg Fri Mar 9 04:06:27 2001 EDT Modified files: /php4/ext/midgard article.c Log: Fixed typo. Index: php4/ext/midgard/article.c diff -u php4/ext/midgard/article.c:1.12 php4/ext/midgard/article.c:1.13 --- php4/ext/midgard/article.c:1.12 Thu Mar 8 02:25:15 2001 +++ php4/ext/midgard/article.c Fri Mar 9 04:06:26 2001 @@ -1,4 +1,4 @@ -/* $Id: article.c,v 1.12 2001/03/08 10:25:15 davidg Exp $ +/* $Id: article.c,v 1.13 2001/03/09 12:06:26 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -543,13 +543,13 @@ convert_to_string_ex(extra3); convert_to_long_ex(type); - if (!mgd_exists_id(mgd_handle(), "person", "id=$id", (*author)->value.lval)) + if (!mgd_exists_id(mgd_handle(), "person", "id=$d", (*author)->value.lval)) RETURN_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); - if (!mgd_exists_id(mgd_handle(), "topic", "id=$id", (*topic)->value.lval)) + if (!mgd_exists_id(mgd_handle(), "topic", "id=$d", (*topic)->value.lval)) RETURN_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); - if ((*up)->value.lval != 0 && !mgd_exists_id(mgd_handle(), "article", "id=$id", (*up)->value.lval)) + if ((*up)->value.lval != 0 && !mgd_exists_id(mgd_handle(), "article", "id=$d", +(*up)->value.lval)) RETURN_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); if (!istopicowner((*topic)->value.lval)) { @@ -846,13 +846,13 @@ RETURN_FALSE_BECAUSE(MGD_ERR_ACCESS_DENIED); } - if (!mgd_exists_id(mgd_handle(), "person", "id=$id", (*author)->value.lval)) + if (!mgd_exists_id(mgd_handle(), "person", "id=$d", (*author)->value.lval)) RETURN_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); - if (!mgd_exists_id(mgd_handle(), "topic", "id=$id", (*topic)->value.lval)) + if (!mgd_exists_id(mgd_handle(), "topic", "id=$d", (*topic)->value.lval)) RETURN_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); - if ((*up)->value.lval != 0 && !mgd_exists_id(mgd_handle(), "article", "id=$id", (*up)->value.lval)) + if ((*up)->value.lval != 0 && !mgd_exists_id(mgd_handle(), "article", "id=$d", +(*up)->value.lval)) RETURN_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); if (!istopicowner((*topic)->value.lval)) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard article.c
davidg Fri Mar 9 04:16:58 2001 EDT Modified files: /php4/ext/midgard article.c Log: still a typo Index: php4/ext/midgard/article.c diff -u php4/ext/midgard/article.c:1.13 php4/ext/midgard/article.c:1.14 --- php4/ext/midgard/article.c:1.13 Fri Mar 9 04:06:26 2001 +++ php4/ext/midgard/article.c Fri Mar 9 04:16:57 2001 @@ -1,4 +1,4 @@ -/* $Id: article.c,v 1.13 2001/03/09 12:06:26 davidg Exp $ +/* $Id: article.c,v 1.14 2001/03/09 12:16:57 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -480,7 +480,7 @@ MGD_FUNCTION(int, create_article, (int up, int topic, string name, string title, string abstract, - string content, string author, + string +content, int author, string url, string calstart, int caldays, int icon, int view, int print, string extra1, string extra2, -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard sitegroup.c
davidg Sun Mar 11 06:36:43 2001 EDT Modified files: /php4/ext/midgard sitegroup.c Log: Added missing parameter. Index: php4/ext/midgard/sitegroup.c diff -u php4/ext/midgard/sitegroup.c:1.7 php4/ext/midgard/sitegroup.c:1.8 --- php4/ext/midgard/sitegroup.c:1.7Tue Mar 6 00:12:52 2001 +++ php4/ext/midgard/sitegroup.cSun Mar 11 06:36:42 2001 @@ -1,4 +1,4 @@ -/* $Id: sitegroup.c,v 1.7 2001/03/06 08:12:52 emile Exp $ +/* $Id: sitegroup.c,v 1.8 2001/03/11 14:36:42 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -266,7 +266,7 @@ "sitegroup=$d", (*zv_id)->value.lval, (*zv_sitegroup)->value.lval); mgd_update_repligard(mgd_handle(), (*zv_table)->value.str.val, (*zv_id)->value.lval, - (*zv_sitegroup)->value.lval); + "sitegroup=$d", (*zv_sitegroup)->value.lval); } MidgardProperty MidgardSitegroupProperties [] = { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard attachment.c
davidg Sun Mar 11 07:40:03 2001 EDT Modified files: /php4/ext/midgard attachment.c Log: added missing conversion. Index: php4/ext/midgard/attachment.c diff -u php4/ext/midgard/attachment.c:1.8 php4/ext/midgard/attachment.c:1.9 --- php4/ext/midgard/attachment.c:1.8 Sat Mar 10 14:43:10 2001 +++ php4/ext/midgard/attachment.c Sun Mar 11 07:40:03 2001 @@ -1,4 +1,4 @@ -/* $Id: attachment.c,v 1.8 2001/03/10 22:43:10 emile Exp $ +/* $Id: attachment.c,v 1.9 2001/03/11 15:40:03 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -37,6 +37,7 @@ { zval **table, **id; +mgd_log_debug(0, "get_blob_id"); if (self == NULL) { if (calltype) *calltype = MGD_BLOB_CALL_FUNC; if (name == NULL) return MGD_ERR_INVALID_NAME; @@ -50,6 +51,8 @@ if (!MGD_PROPFIND(self, "id", id)) { return MGD_ERR_NOT_OBJECT; } + else + convert_to_long_ex(id); if ((*table)->type != IS_STRING) { return MGD_ERR_NOT_OBJECT; @@ -60,10 +63,14 @@ convert_to_long_ex(id); return (*id)->value.lval; } +mgd_log_debug(0, "before $s", (*table)->value.str.val); if (calltype) *calltype = MGD_BLOB_CALL_OTHER; if (name == NULL) return MGD_ERR_INVALID_NAME; convert_to_string_ex(name); +mgd_log_debug(0, "before return: ptable=$q AND pid=$d AND name=$q", +(*table)->value.str.val, (*id)->value.lval, +(*name)->value.str.val); return mgd_exists_id(mgd_handle(), "blobs", "ptable=$q AND pid=$d AND name=$q", (*table)->value.str.val, (*id)->value.lval, -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard attachment.c config.m4 config.m4.session
davidg Sun Mar 11 15:30:36 2001 EDT Modified files: /php4/ext/midgard attachment.c config.m4 config.m4.session Log: added PHP_SUBST(MIDGARD_SHARED_LIB) to dynamically link against libmidgard in config.m4 removed debug info in attachments Index: php4/ext/midgard/attachment.c diff -u php4/ext/midgard/attachment.c:1.9 php4/ext/midgard/attachment.c:1.10 --- php4/ext/midgard/attachment.c:1.9 Sun Mar 11 07:40:03 2001 +++ php4/ext/midgard/attachment.c Sun Mar 11 15:30:36 2001 @@ -1,4 +1,4 @@ -/* $Id: attachment.c,v 1.9 2001/03/11 15:40:03 davidg Exp $ +/* $Id: attachment.c,v 1.10 2001/03/11 23:30:36 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -37,7 +37,6 @@ { zval **table, **id; -mgd_log_debug(0, "get_blob_id"); if (self == NULL) { if (calltype) *calltype = MGD_BLOB_CALL_FUNC; if (name == NULL) return MGD_ERR_INVALID_NAME; @@ -63,14 +62,10 @@ convert_to_long_ex(id); return (*id)->value.lval; } -mgd_log_debug(0, "before $s", (*table)->value.str.val); if (calltype) *calltype = MGD_BLOB_CALL_OTHER; if (name == NULL) return MGD_ERR_INVALID_NAME; convert_to_string_ex(name); -mgd_log_debug(0, "before return: ptable=$q AND pid=$d AND name=$q", -(*table)->value.str.val, (*id)->value.lval, -(*name)->value.str.val); return mgd_exists_id(mgd_handle(), "blobs", "ptable=$q AND pid=$d AND name=$q", (*table)->value.str.val, (*id)->value.lval, Index: php4/ext/midgard/config.m4 diff -u php4/ext/midgard/config.m4:1.11 php4/ext/midgard/config.m4:1.12 --- php4/ext/midgard/config.m4:1.11 Thu Mar 8 02:49:18 2001 +++ php4/ext/midgard/config.m4 Sun Mar 11 15:30:36 2001 @@ -1,4 +1,4 @@ -dnl $Id: config.m4,v 1.11 2001/03/08 10:49:18 davidg Exp $ +dnl $Id: config.m4,v 1.12 2001/03/11 23:30:36 davidg Exp $ dnl Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> dnl Copyright (C) 2000 The Midgard Project ry @@ -21,6 +21,8 @@ AC_PROG_YACC AC_DECL_YYTEXT AC_PROG_LEX + +PHP_SUBST(MIDGARD_SHARED_LIB) PHP_ARG_WITH(midgard, for midgard support, [ --with-midgard Include midgard 1.4 support]) Index: php4/ext/midgard/config.m4.session diff -u php4/ext/midgard/config.m4.session:1.1 php4/ext/midgard/config.m4.session:1.2 --- php4/ext/midgard/config.m4.session:1.1 Thu Mar 8 02:39:31 2001 +++ php4/ext/midgard/config.m4.session Sun Mar 11 15:30:36 2001 @@ -1,4 +1,4 @@ -dnl $Id: config.m4.session,v 1.1 2001/03/08 10:39:31 davidg Exp $ +dnl $Id: config.m4.session,v 1.2 2001/03/11 23:30:36 davidg Exp $ dnl Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> dnl Copyright (C) 2000 The Midgard Project ry @@ -21,6 +21,8 @@ AC_PROG_YACC AC_DECL_YYTEXT AC_PROG_LEX + +PHP_SUBST(MIDGARD_SHARED_LIB) PHP_ARG_WITH(midgard, for midgard support, [ --with-midgard Include midgard 1.4 support]) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard config.m4 config.m4.session
davidg Sun Mar 11 15:45:58 2001 EDT Modified files: /php4/ext/midgard config.m4 config.m4.session Log: fixed misplaced PHP_SUBST Index: php4/ext/midgard/config.m4 diff -u php4/ext/midgard/config.m4:1.12 php4/ext/midgard/config.m4:1.13 --- php4/ext/midgard/config.m4:1.12 Sun Mar 11 15:30:36 2001 +++ php4/ext/midgard/config.m4 Sun Mar 11 15:45:57 2001 @@ -1,4 +1,4 @@ -dnl $Id: config.m4,v 1.12 2001/03/11 23:30:36 davidg Exp $ +dnl $Id: config.m4,v 1.13 2001/03/11 23:45:57 davidg Exp $ dnl Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> dnl Copyright (C) 2000 The Midgard Project ry @@ -22,8 +22,6 @@ AC_DECL_YYTEXT AC_PROG_LEX -PHP_SUBST(MIDGARD_SHARED_LIB) - PHP_ARG_WITH(midgard, for midgard support, [ --with-midgard Include midgard 1.4 support]) @@ -58,6 +56,8 @@ LFLAGS="$LFLAGS -Pmgd -olex.yy.c" PHP_SUBST(GLIBCONFIG) + + PHP_SUBST(MIDGARD_SHARED_LIB) AC_MSG_CHECKING(for midgard experimental functions support) AC_ARG_ENABLE(mgd-experimental, Index: php4/ext/midgard/config.m4.session diff -u php4/ext/midgard/config.m4.session:1.2 php4/ext/midgard/config.m4.session:1.3 --- php4/ext/midgard/config.m4.session:1.2 Sun Mar 11 15:30:36 2001 +++ php4/ext/midgard/config.m4.session Sun Mar 11 15:45:57 2001 @@ -1,4 +1,4 @@ -dnl $Id: config.m4.session,v 1.2 2001/03/11 23:30:36 davidg Exp $ +dnl $Id: config.m4.session,v 1.3 2001/03/11 23:45:57 davidg Exp $ dnl Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> dnl Copyright (C) 2000 The Midgard Project ry @@ -22,8 +22,6 @@ AC_DECL_YYTEXT AC_PROG_LEX -PHP_SUBST(MIDGARD_SHARED_LIB) - PHP_ARG_WITH(midgard, for midgard support, [ --with-midgard Include midgard 1.4 support]) @@ -58,6 +56,8 @@ LFLAGS="$LFLAGS -Pmgd -olex.yy.c" PHP_SUBST(GLIBCONFIG) + + PHP_SUBST(MIDGARD_SHARED_LIB) AC_MSG_CHECKING(for midgard experimental functions support) AC_ARG_ENABLE(mgd-experimental, -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard article.c
davidg Mon Mar 12 02:19:37 2001 EDT Modified files: /php4/ext/midgard article.c Log: added NULL-check Index: php4/ext/midgard/article.c diff -u php4/ext/midgard/article.c:1.14 php4/ext/midgard/article.c:1.15 --- php4/ext/midgard/article.c:1.14 Fri Mar 9 04:16:57 2001 +++ php4/ext/midgard/article.c Mon Mar 12 02:19:37 2001 @@ -1,4 +1,4 @@ -/* $Id: article.c,v 1.14 2001/03/09 12:16:57 davidg Exp $ +/* $Id: article.c,v 1.15 2001/03/12 10:19:37 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -645,7 +645,7 @@ convert_to_long_ex(id); convert_to_long_ex(up); - if ((*up)->value.lval != 0) { + if (up && ((*up)->value.lval != 0)) { #if HAVE_MIDGARD_SITEGROUPS if (!mgd_exists_bool(mgd_handle(), "article src, article tgt", "src.id=$d AND tgt.id=$d" -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard preparser-scanner.l
davidg Tue Mar 13 00:03:08 2001 EDT Modified files: /php4/ext/midgard preparser-scanner.l Log: Fixed a bug that prevented the preparser to expand any Midgard syntax formatter after a //-style comment anywhere in the page. Index: php4/ext/midgard/preparser-scanner.l diff -u php4/ext/midgard/preparser-scanner.l:1.5 php4/ext/midgard/preparser-scanner.l:1.6 --- php4/ext/midgard/preparser-scanner.l:1.5Fri Feb 23 16:00:59 2001 +++ php4/ext/midgard/preparser-scanner.lTue Mar 13 00:03:08 2001 @@ -1,6 +1,6 @@ %{ -/* $Id: preparser-scanner.l,v 1.5 2001/02/24 00:00:59 davidg Exp $ +/* $Id: preparser-scanner.l,v 1.6 2001/03/13 08:03:08 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -29,17 +29,10 @@ static int par_stack; static char in_string=0; -/* -{ANY}|{LCOMMENT} { -#ifdef SCANNER_DEBUG - mgd_append_output_buffer_const(" <6: misc char> "); -#endif - mgd_append_output_buffer(yytext); -} -*/ %} %x IN_PHP +%x IN_LCOMMENT %x IN_TEMPLATE %x IN_FORMAT %x IN_SNIPPET @@ -60,7 +53,7 @@ qstring[\'][^\'\n]*[\'] WHITESPACE [ \n\r\t] ANY.|{WHITESPACE} -LCOMMENT "//".* +LCOMMENT "//" quote [\'] dquote [\"] MIDGARD_TEMPLATE_NAME [a-zA-Z0-9_ \x7f-\xff-]+ @@ -90,12 +83,30 @@ mgd_append_output_buffer(yytext); yy_pop_state(); } + +{ANY} { +#ifdef SCANNER_DEBUG + mgd_append_output_buffer_const(" <6: misc char> "); +#endif + mgd_append_output_buffer(yytext); +} -{ANY}|{LCOMMENT} { +{LCOMMENT} { #ifdef SCANNER_DEBUG mgd_append_output_buffer_const(" <6: misc char> "); #endif mgd_append_output_buffer(yytext); + yy_push_state(IN_LCOMMENT); +} + +("\n"|"?>"|"") { +#ifdef SCANNER_DEBUG + mgd_append_output_buffer_const(" <4: Found php end> "); +#endif + mgd_append_output_buffer(yytext); + yy_pop_state(); // pop IN_LCOMMENT + if(*yytext != '\n') +yy_pop_state(); // pop IN_PHP } {qstring}|{dqstring} { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard preparser-scanner.l
davidg Tue Mar 13 04:19:41 2001 EDT Modified files: /php4/ext/midgard preparser-scanner.l Log: fixed bug http://www.midgard-project.org/bugs/?id=135 Index: php4/ext/midgard/preparser-scanner.l diff -u php4/ext/midgard/preparser-scanner.l:1.6 php4/ext/midgard/preparser-scanner.l:1.7 --- php4/ext/midgard/preparser-scanner.l:1.6Tue Mar 13 00:03:08 2001 +++ php4/ext/midgard/preparser-scanner.lTue Mar 13 04:19:39 2001 @@ -1,6 +1,6 @@ %{ -/* $Id: preparser-scanner.l,v 1.6 2001/03/13 08:03:08 davidg Exp $ +/* $Id: preparser-scanner.l,v 1.7 2001/03/13 12:19:39 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -32,6 +32,8 @@ %} %x IN_PHP +%x IN_PHPQ +%x IN_PHPQQ %x IN_LCOMMENT %x IN_TEMPLATE %x IN_FORMAT @@ -84,6 +86,44 @@ yy_pop_state(); } +{quote} { + yy_push_state(IN_PHPQ); + in_string = mgdtext[0]; + mgd_append_output_buffer(yytext); +} + +{dquote} { + yy_push_state(IN_PHPQQ); + in_string = mgdtext[0]; + mgd_append_output_buffer(yytext); +} + +[\\]{quote} { + mgd_append_output_buffer(yytext); +} + +{quote} { + mgd_append_output_buffer(yytext); + yy_pop_state(); +} + +{ANY} { + mgd_append_output_buffer(yytext); +} + +[\\]{dquote} { + mgd_append_output_buffer(yytext); +} + +{dquote} { + mgd_append_output_buffer(yytext); + yy_pop_state(); +} + +{ANY} { + mgd_append_output_buffer(yytext); +} + {ANY} { #ifdef SCANNER_DEBUG mgd_append_output_buffer_const(" <6: misc char> "); @@ -109,13 +149,6 @@ yy_pop_state(); // pop IN_PHP } -{qstring}|{dqstring} { -#ifdef SCANNER_DEBUG - mgd_append_output_buffer_const(" <5: String> "); -#endif - mgd_append_output_buffer(yytext); -} - "<"[\[\(]/{MIDGARD_TEMPLATE_NAME}[\]\)]">" { #ifdef SCANNER_DEBUG mgd_append_output_buffer_const(" <9: Found start of element> "); @@ -344,6 +377,15 @@ } %% +/* +{qstring}|{dqstring} { +#ifdef SCANNER_DEBUG + mgd_append_output_buffer_const(" <5: String> "); +#endif + mgd_append_output_buffer(yytext); +} + +*/ char * php_eval_midgard(midgard_pool * pool, const char *name, char *value, int exit_php) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard snippet.c
davidg Thu Mar 15 01:09:58 2001 EDT Modified files: /php4/ext/midgard snippet.c Log: Snippet author is a string. Index: php4/ext/midgard/snippet.c diff -u php4/ext/midgard/snippet.c:1.7 php4/ext/midgard/snippet.c:1.8 --- php4/ext/midgard/snippet.c:1.7 Sat Mar 10 14:43:10 2001 +++ php4/ext/midgard/snippet.c Thu Mar 15 01:09:53 2001 @@ -1,4 +1,4 @@ -/* $Id: snippet.c,v 1.7 2001/03/10 22:43:10 emile Exp $ +/* $Id: snippet.c,v 1.8 2001/03/15 09:09:53 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -124,9 +124,6 @@ convert_to_string_ex(code); convert_to_string_ex(doc); convert_to_string_ex(author); - - if (!mgd_exists_id(mgd_handle(), "person", "id=$d", (*author)->value.lval)) - RETURN_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); if (!mgd_exists_id(mgd_handle(), "snippetdir", "id=$d", (*snippetdir)->value.lval)) RETURN_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard php_midgard.h.in
davidg Mon Mar 19 03:54:31 2001 EDT Modified files: /php4/ext/midgard php_midgard.h.in Log: fixed bad #endif syntax Index: php4/ext/midgard/php_midgard.h.in diff -u php4/ext/midgard/php_midgard.h.in:1.2 php4/ext/midgard/php_midgard.h.in:1.3 --- php4/ext/midgard/php_midgard.h.in:1.2 Mon Mar 19 03:50:17 2001 +++ php4/ext/midgard/php_midgard.h.in Mon Mar 19 03:54:29 2001 @@ -1,4 +1,4 @@ -/* $Id: php_midgard.h.in,v 1.2 2001/03/19 11:50:17 ab Exp $ +/* $Id: php_midgard.h.in,v 1.3 2001/03/19 11:54:29 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -30,7 +30,7 @@ #include "@MIDCONFIG_FILE@" #else #include "php_config.h" -#fi +#endif #if HAVE_MIDGARD -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard config.m4
davidg Mon Mar 19 04:38:35 2001 EDT Modified files: /php4/ext/midgard config.m4 Log: fixed a compatibility problem with 4.0.4 Index: php4/ext/midgard/config.m4 diff -u php4/ext/midgard/config.m4:1.16 php4/ext/midgard/config.m4:1.17 --- php4/ext/midgard/config.m4:1.16 Mon Mar 19 01:56:06 2001 +++ php4/ext/midgard/config.m4 Mon Mar 19 04:38:35 2001 @@ -1,4 +1,4 @@ -dnl $Id: config.m4,v 1.16 2001/03/19 09:56:06 ab Exp $ +dnl $Id: config.m4,v 1.17 2001/03/19 12:38:35 davidg Exp $ dnl Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> dnl Copyright (C) 2000 The Midgard Project ry @@ -32,7 +32,6 @@ else AC_ADD_LIBRARY(midgard) fi - AC_DEFINE(HAVE_MIDGARD, 1, [ ]) PHP_EXTENSION(midgard, $ext_shared) dnl EEH/TODO: Add checks for apache-static compilation @@ -75,4 +74,5 @@ PHP_SUBST(MIDCONFIG_FILE) AC_SUBST(MIDCONFIG_FILE) AC_OUTPUT(php_midgard.h, [], []) + AC_DEFINE(HAVE_MIDGARD, 1, [ ]) fi -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard config.m4.session
davidg Mon Mar 19 04:41:20 2001 EDT Modified files: /php4/ext/midgard config.m4.session Log: fixed compilation with php-4.0.4 Index: php4/ext/midgard/config.m4.session diff -u php4/ext/midgard/config.m4.session:1.6 php4/ext/midgard/config.m4.session:1.7 --- php4/ext/midgard/config.m4.session:1.6 Mon Mar 19 01:56:06 2001 +++ php4/ext/midgard/config.m4.session Mon Mar 19 04:41:19 2001 @@ -1,4 +1,4 @@ -dnl $Id: config.m4.session,v 1.6 2001/03/19 09:56:06 ab Exp $ +dnl $Id: config.m4.session,v 1.7 2001/03/19 12:41:19 davidg Exp $ dnl Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> dnl Copyright (C) 2000 The Midgard Project ry @@ -32,7 +32,6 @@ else AC_ADD_LIBRARY(midgard) fi - AC_DEFINE(HAVE_MIDGARD, 1, [ ]) PHP_EXTENSION(midgard, $ext_shared) dnl EEH/TODO: Add checks for apache-static compilation @@ -82,4 +81,5 @@ PHP_SUBST(MIDCONFIG_FILE) AC_SUBST(MIDCONFIG_FILE) AC_OUTPUT(php_midgard.h, [], []) + AC_DEFINE(HAVE_MIDGARD, 1, [ ]) fi -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard config.m4 php_midgard.h
davidg Mon Mar 19 15:37:03 2001 EDT Modified files: /php4/ext/midgard config.m4 php_midgard.h Log: Fixed the build (hope so). Index: php4/ext/midgard/config.m4 diff -u php4/ext/midgard/config.m4:1.19 php4/ext/midgard/config.m4:1.20 --- php4/ext/midgard/config.m4:1.19 Mon Mar 19 10:38:09 2001 +++ php4/ext/midgard/config.m4 Mon Mar 19 15:37:03 2001 @@ -1,4 +1,4 @@ -dnl $Id: config.m4,v 1.19 2001/03/19 18:38:09 sniper Exp $ +dnl $Id: config.m4,v 1.20 2001/03/19 23:37:03 davidg Exp $ dnl Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> dnl Copyright (C) 2000 The Midgard Project ry @@ -66,12 +66,8 @@ fi if test "$php_always_shared" = "yes"; then -MIDCONFIG_FILE="config.h" - else -MIDCONFIG_FILE="php_config.h" +AC_DEFINE(MGD_INCLUDE_PHP_CONFIG, 1, [ ]) fi - PHP_SUBST(MIDCONFIG_FILE) - PHP_OUTPUT(php_midgard.h, [], []) AC_DEFINE(HAVE_MIDGARD, 1, [ ]) PHP_EXTENSION(midgard, $ext_shared) fi Index: php4/ext/midgard/php_midgard.h diff -u php4/ext/midgard/php_midgard.h:1.9 php4/ext/midgard/php_midgard.h:1.10 --- php4/ext/midgard/php_midgard.h:1.9 Sun Mar 18 10:29:55 2001 +++ php4/ext/midgard/php_midgard.h Mon Mar 19 15:37:03 2001 @@ -1,4 +1,4 @@ -/* $Id: php_midgard.h,v 1.9 2001/03/18 18:29:55 ab Exp $ +/* $Id: php_midgard.h,v 1.10 2001/03/19 23:37:03 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -25,7 +25,14 @@ gets defined. */ #include "php.h" -#include "config.h" + +#if (PHP_API_VERSION >= 20010119) +#ifndef MGD_INCLUDE_PHP_CONFIG +#include "php_config.h" +#endif // MGD_INCLUDE_PHP_CONFIG +#else +#include "php_config.h" +#endif #if HAVE_MIDGARD -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard php_midgard.h.in
davidg Mon Mar 19 15:39:10 2001 EDT Removed files: /php4/ext/midgard php_midgard.h.in Log: deleted unneeded file -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard test-db.tar.gz
davidg Mon Feb 12 10:10:40 2001 EDT Removed files: /php4/ext/midgard test-db.tar.gz Log: This file is not needed anymore, check the midgard CVS for the up-to-date file: http://cvs.midgard-project.org/cvsweb.pl in /midgard/data -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard midgard-logo.h midgard-team.h midgard.c
davidg Fri Feb 16 13:49:01 2001 EDT Removed files: /php4/ext/midgard midgard-logo.h midgard-team.h Modified files: /php4/ext/midgard midgard.c Log: deleting logo & picture to slim down the Midgard extension Index: php4/ext/midgard/midgard.c diff -u php4/ext/midgard/midgard.c:1.1 php4/ext/midgard/midgard.c:1.2 --- php4/ext/midgard/midgard.c:1.1 Mon Feb 12 09:23:36 2001 +++ php4/ext/midgard/midgard.c Fri Feb 16 13:49:01 2001 @@ -1,5 +1,5 @@ /* - $Id: midgard.c,v 1.1 2001/02/12 17:23:36 emile Exp $ + $Id: midgard.c,v 1.2 2001/02/16 21:49:01 davidg Exp $ +--+ | PHP version 4.0 | +--+ @@ -30,20 +30,8 @@ gets defined. */ #if HAVE_MIDGARD -#if ( PHP_API_VERSION >= 19990421 ) -#define MGD_PHP_LOGO 1 -#else -#define MGD_PHP_LOGO 0 -#endif - -#define MIDGARD_LOGO_GUID "PHPE9568F37-D428-11d2-A769-00AA001ACF42" -#define MIDGARD_LOGO_MIME "image/gif" -#define MIDGARD_TEAM_GUID "PHPE9568F38-D428-11d2-A769-00AA001ACF42" -#define MIDGARD_TEAM_MIME "image/jpeg" #include -#include "midgard-logo.h" -#include "midgard-team.h" #include "mgd_errno.h" #include "mgd_internal.h" #include "mgd_oop.h" @@ -375,17 +363,6 @@ SLS_FETCH(); MGDLS_FETCH(); -#if MGD_PHP_LOGO - php_register_info_logo(MIDGARD_LOGO_GUID, - MIDGARD_LOGO_MIME, - midgard_logo, - sizeof(midgard_logo)); - php_register_info_logo(MIDGARD_TEAM_GUID, - MIDGARD_TEAM_MIME, - midgard_team, - sizeof(midgard_team)); -#endif - midgard_module = ap_find_linked_module("mod_midgard.c"); if (!midgard_module) { MGDG(rcfg) = NULL; @@ -443,33 +420,11 @@ } php_info_print_table_end(); php_info_print_box_start(0); -#if MGD_PHP_LOGO - PUTS("http://www.midgard-project.org/\">\n"); -#else PUTS("http://www.midgard-project.org/\">"); PUTS("The Midgard Project Home Page\n"); -#endif php_printf("This program makes use of the Midgard Content Management engine:"); php_printf("© 1998-2001 The Midgard Project Ry - 2000-2001 Aurora Linux\n"); php_info_print_box_end(); - -#if MGD_PHP_LOGO - php_info_print_box_start(0); - PUTS("http://www.midgard-project.org/\">\n"); - php_printf("The Midgard Team"); - php_printf("From left to right, top to bottom:"); - php_printf("Alexander Bokovoy, David Guerizec, Henri Bergius, Xavier Ordoquy, Armand Verstappen"); - php_printf("Ami Ganguli, Emiliano Heyns, Loic Dachary"); - php_info_print_box_end(); -#endif /* Remove comments if you have entries in php.ini DISPLAY_INI_ENTRIES(); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard/logo midgard-logo.gif
davidg Fri Feb 16 13:50:09 2001 EDT Removed files: /php4/ext/midgard/logo midgard-logo.gif Log: deleting logo to slim down the Midgard extension -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard midgard.c
davidg Sun Feb 18 10:45:25 2001 EDT Modified files: /php4/ext/midgard midgard.c Log: allow execution of 'normal' php scripts Index: php4/ext/midgard/midgard.c diff -u php4/ext/midgard/midgard.c:1.4 php4/ext/midgard/midgard.c:1.5 --- php4/ext/midgard/midgard.c:1.4 Sat Feb 17 15:21:50 2001 +++ php4/ext/midgard/midgard.c Sun Feb 18 10:45:24 2001 @@ -1,4 +1,4 @@ -/* $Id: midgard.c,v 1.4 2001/02/17 23:21:50 emile Exp $ +/* $Id: midgard.c,v 1.5 2001/02/18 18:45:24 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -357,38 +357,49 @@ /* Remove if there's nothing to do at request start */ PHP_RINIT_FUNCTION(midgard) { -request_rec *r; -module *midgard_module; + request_rec *r; + module *midgard_module; - SLS_FETCH(); - MGDLS_FETCH(); + SLS_FETCH(); + MGDLS_FETCH(); midgard_module = ap_find_linked_module("mod_midgard.c"); if (!midgard_module) { - MGDG(rcfg) = NULL; - MGDG(dcfg) = NULL; - return FAILURE; + MGDG(rcfg) = NULL; + MGDG(dcfg) = NULL; + php_error(E_ERROR, "Cannot get midgard module descriptor"); + return SUCCESS; } /* Failure on Apache 1.3.18-dev (Marius) ??? */ r = ((request_rec *) SG(server_context)); MGDG(rcfg) = (midgard_request_config *) - ap_get_module_config(r->request_config, midgard_module); + ap_get_module_config(r->request_config, midgard_module); if(MGDG(rcfg) == NULL) { - php_error(E_ERROR, "Cannot get midgard module config"); - return FAILURE; + MGD_LOG_START("Cannot get midgard module config") + MGD_LOG_END() + php_error(E_NOTICE, "Cannot get midgard module config"); + MGDG(rcfg) = NULL; + MGDG(dcfg) = NULL; + return SUCCESS; } + MGDG(dcfg) = (midgard_directory_config *) ap_get_module_config(r->per_dir_config, midgard_module); - if(MGDG(rcfg) == NULL) { - php_error(E_ERROR, "Cannot get midgard module directory config"); - return FAILURE; + if(MGDG(dcfg) == NULL) { + MGD_LOG_START("Cannot get midgard module directory config") + MGD_LOG_END() + php_error(E_NOTICE, "Cannot get midgard module directory config"); + MGDG(rcfg) = NULL; + MGDG(dcfg) = NULL; + return SUCCESS; } MGDG(mgd) = MGDG(rcfg)->mgd; ALLOC_INIT_ZVAL(MGDG(udf)); if(MGDG(udf)) array_init(MGDG(udf)); + return SUCCESS; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard article.c page.c topic.c
davidg Mon Feb 19 07:50:20 2001 EDT Modified files: /php4/ext/midgard article.c page.c topic.c Log: fixed bug #81, for more details, see: http://www.midgard-project.org/bugs/?id=81 Index: php4/ext/midgard/article.c diff -u php4/ext/midgard/article.c:1.3 php4/ext/midgard/article.c:1.4 --- php4/ext/midgard/article.c:1.3 Sat Feb 17 15:21:49 2001 +++ php4/ext/midgard/article.c Mon Feb 19 07:50:20 2001 @@ -1,4 +1,4 @@ -/* $Id: article.c,v 1.3 2001/02/17 23:21:49 emile Exp $ +/* $Id: article.c,v 1.4 2001/02/19 15:50:20 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -42,6 +42,16 @@ convert_to_long_ex(root); convert_to_long_ex(article); + if((*article)->value.lval == 0 || /* useless to waste time if article=0 */ + !mgd_exists_id(mgd_handle(), + "article", "id=$d", + (*article)->value.lval)) + RETURN_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); + if ((*root)->value.lval == 0) + RETURN_TRUE; /* always true if topic = 0 */ + if(!mgd_exists_id(mgd_handle(), "topic", "id=$d", (*root)->value.lval)) + RETURN_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); + #if 0 if (!isarticlereader((*article)->value.lval)) return; @@ -534,6 +544,10 @@ convert_to_string_ex(extra3); convert_to_long_ex(type); + /* author must NOT be 0 */ + if (!(*author)->value.lval) + RETURN_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); + if (!istopicowner((*topic)->value.lval)) { RETURN_FALSE_BECAUSE(MGD_ERR_ACCESS_DENIED); } @@ -555,12 +569,11 @@ ( { RETURN_FALSE_BECAUSE(MGD_ERR_SITEGROUP_VIOLATION); } - /* author must be in same SG or be 0 */ - if ((*author)->value.lval != 0 && !mgd_exists_id(mgd_handle(), "person", + /* author must be in same SG */ + if (!mgd_exists_id(mgd_handle(), "person", "id=$d AND sitegroup IN (0,$d)", (*author)->value.lval, - mgd_sitegroup(mgd_handle - ( { + mgd_sitegroup(mgd_handle( { RETURN_FALSE_BECAUSE(MGD_ERR_SITEGROUP_VIOLATION); } #endif @@ -840,6 +853,10 @@ convert_to_string_ex(extra2); convert_to_string_ex(extra3); + /* author must NOT be 0 */ + if (!(*author)->value.lval) + RETURN_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); + /* EEH: conversion to string is intentional, see update code */ if (type) convert_to_string_ex(type); @@ -865,9 +882,8 @@ RETURN_FALSE_BECAUSE(MGD_ERR_SITEGROUP_VIOLATION); } - /* author must be in same SG or be 0 */ - if ((*author)->value.lval != 0 - && !mgd_exists_bool(mgd_handle(), "article,person", + /* author must be in same SG */ + if (!mgd_exists_bool(mgd_handle(), "article,person", "article.id=$d AND person.id=$d" " AND (article.sitegroup=person.sitegroup" " OR article.sitegroup=0" " OR person.sitegroup=0)", Index: php4/ext/midgard/page.c diff -u php4/ext/midgard/page.c:1.3 php4/ext/midgard/page.c:1.4 --- php4/ext/midgard/page.c:1.3 Sat Feb 17 15:21:50 2001 +++ php4/ext/midgard/page.c Mon Feb 19 07:50:20 2001 @@ -1,4 +1,4 @@ -/* $Id: page.c,v 1.3 2001/02/17 23:21:50 emile Exp $ +/* $Id: page.c,v 1.4 2001/02/19 15:50:20 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -79,6 +79,16 @@ WRONG_PARAM_COUNT; convert_to_long_ex(root); convert_to_long_ex(page); + + if((*page)->value.lval == 0 || /* useless to waste time if page=0 */ + !mgd_exists_id(mgd_handle(), + "page", "id=$d", + (*page)->value.lval)) + RETURN_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); + if ((*root)->value.lval == 0) + RETURN_TRUE; /* always true if root=0 */ + if(!mgd_exists_id(mgd_handle(), "page", "id=$d", (*root)->value.lval)) + RETURN_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS); ids = mgd_tree(mgd_handle(), "page", (*root)->value.lval, 0, NULL); if (ids) Index: php4/ext/midgard/topic.c diff -u php4/ext/midgard/topic.c:1.3 php4/ext/midgard/topic.c:1.4 --- php4/ext/midgard/topi
[PHP-CVS] cvs: php4 /ext/midgard attachment.c
davidg Mon Feb 19 08:39:20 2001 EDT Modified files: /php4/ext/midgard attachment.c Log: Small typo fixed. Index: php4/ext/midgard/attachment.c diff -u php4/ext/midgard/attachment.c:1.3 php4/ext/midgard/attachment.c:1.4 --- php4/ext/midgard/attachment.c:1.3 Sat Feb 17 15:21:49 2001 +++ php4/ext/midgard/attachment.c Mon Feb 19 08:39:19 2001 @@ -1,4 +1,4 @@ -/* $Id: attachment.c,v 1.3 2001/02/17 23:21:49 emile Exp $ +/* $Id: attachment.c,v 1.4 2001/02/19 16:39:19 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -263,7 +263,7 @@ zv_mode = NULL; break; case 2: - if (zend_get_parameters_ex(1, &zv_id, &zv_mode) != + if (zend_get_parameters_ex(2, &zv_id, &zv_mode) != SUCCESS) { WRONG_PARAM_COUNT; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard oop.c sitegroup.c
davidg Mon Feb 19 23:27:41 2001 EDT Modified files: /php4/ext/midgard oop.c sitegroup.c Log: a few fixes on function mis-behavior. Index: php4/ext/midgard/oop.c diff -u php4/ext/midgard/oop.c:1.3 php4/ext/midgard/oop.c:1.4 --- php4/ext/midgard/oop.c:1.3 Sat Feb 17 15:21:50 2001 +++ php4/ext/midgard/oop.c Mon Feb 19 23:27:40 2001 @@ -1,4 +1,4 @@ -/* $Id: oop.c,v 1.3 2001/02/17 23:21:50 emile Exp $ +/* $Id: oop.c,v 1.4 2001/02/20 07:27:40 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -420,6 +420,9 @@ if (ZEND_NUM_ARGS() != 0) { WRONG_PARAM_COUNT; } + + convert_to_long_ex(zv_id); + convert_to_string_ex(zv_table); pool = mgd_pool(mgd_handle()); guid = Index: php4/ext/midgard/sitegroup.c diff -u php4/ext/midgard/sitegroup.c:1.3 php4/ext/midgard/sitegroup.c:1.4 --- php4/ext/midgard/sitegroup.c:1.3Sat Feb 17 15:21:50 2001 +++ php4/ext/midgard/sitegroup.cMon Feb 19 23:27:40 2001 @@ -1,4 +1,4 @@ -/* $Id: sitegroup.c,v 1.3 2001/02/17 23:21:50 emile Exp $ +/* $Id: sitegroup.c,v 1.4 2001/02/20 07:27:40 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -283,6 +283,7 @@ PHP_FALIAS(update, mgd_update_sitegroup, NULL) PHP_FALIAS(delete, mgd_delete_sitegroup, NULL) PHP_FALIAS(fetch, mgd_oop_list_fetch, NULL) + PHP_FALIAS(guid,mgd_oop_guid_get, NULL) MIDGARD_OOP_PARAMETER_METHODS MIDGARD_OOP_ATTACHMENT_METHODS { NULL, NULL, NULL} -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard midgard.c
davidg Tue Feb 20 16:29:34 2001 EDT Modified files: /php4/ext/midgard midgard.c Log: more explicit variable names. Index: php4/ext/midgard/midgard.c diff -u php4/ext/midgard/midgard.c:1.8 php4/ext/midgard/midgard.c:1.9 --- php4/ext/midgard/midgard.c:1.8 Tue Feb 20 16:24:56 2001 +++ php4/ext/midgard/midgard.c Tue Feb 20 16:29:34 2001 @@ -1,4 +1,4 @@ -/* $Id: midgard.c,v 1.8 2001/02/21 00:24:56 davidg Exp $ +/* $Id: midgard.c,v 1.9 2001/02/21 00:29:34 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -707,7 +707,7 @@ void midgard_user_call_func(midgard *mgd, int id, int level, void *xparam) { - zval arg1, arg2, arg3, *args[3]={&arg1,&arg2,&arg3}; + zval z_id, z_level, z_xparam, *args[3]={&z_id,&z_level,&z_xparam}; zval ** xp = (zval **)xparam; zval retval, *return_value = &retval; //just to make sure -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/midgard article.c mgd_article.h mgd_internal.h mgd_midgard.h mgd_page.h mgd_snippetdir.h mgd_style.h mgd_topic.h midgard.c page.c snippetdir.c style.c topic.c
davidg Tue Feb 20 16:24:56 2001 EDT Removed files: /php4/ext/midgard mgd_midgard.h Modified files: /php4/ext/midgard article.c mgd_article.h mgd_internal.h mgd_page.h mgd_snippetdir.h mgd_style.h mgd_topic.h midgard.c page.c snippetdir.c style.c topic.c Log: mgd_walk_xxx_tree() functions implemented. Index: php4/ext/midgard/article.c diff -u php4/ext/midgard/article.c:1.4 php4/ext/midgard/article.c:1.5 --- php4/ext/midgard/article.c:1.4 Mon Feb 19 07:50:20 2001 +++ php4/ext/midgard/article.c Tue Feb 20 16:24:56 2001 @@ -1,4 +1,4 @@ -/* $Id: article.c,v 1.4 2001/02/19 15:50:20 davidg Exp $ +/* $Id: article.c,v 1.5 2001/02/21 00:24:56 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -991,6 +991,8 @@ MGD_MOVE_FUNCTION(article, topic, article, topic) MGD_MOVE_FUNCTION(article, article, reply, up) + +MGD_WALK_FUNCTION(article) MidgardProperty MidgardArticleProperties [] = { { IS_LONG, "up"}, Index: php4/ext/midgard/mgd_article.h diff -u php4/ext/midgard/mgd_article.h:1.3 php4/ext/midgard/mgd_article.h:1.4 --- php4/ext/midgard/mgd_article.h:1.3 Sat Feb 17 15:21:50 2001 +++ php4/ext/midgard/mgd_article.h Tue Feb 20 16:24:56 2001 @@ -1,4 +1,4 @@ -/* $Id: mgd_article.h,v 1.3 2001/02/17 23:21:50 emile Exp $ +/* $Id: mgd_article.h,v 1.4 2001/02/21 00:24:56 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -45,5 +45,6 @@ extern MGD_FUNCTION(copy_reply); extern MGD_FUNCTION(move_reply); extern MGD_FUNCTION(delete_article_tree); +extern MGD_FUNCTION(walk_article_tree); #endif Index: php4/ext/midgard/mgd_internal.h diff -u php4/ext/midgard/mgd_internal.h:1.3 php4/ext/midgard/mgd_internal.h:1.4 --- php4/ext/midgard/mgd_internal.h:1.3 Sat Feb 17 15:21:50 2001 +++ php4/ext/midgard/mgd_internal.h Tue Feb 20 16:24:56 2001 @@ -1,4 +1,4 @@ -/* $Id: mgd_internal.h,v 1.3 2001/02/17 23:21:50 emile Exp $ +/* $Id: mgd_internal.h,v 1.4 2001/02/21 00:24:56 davidg Exp $ Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]> Copyright (C) 2000 The Midgard Project ry Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]> @@ -112,67 +112,49 @@ PHP_UPDATE_REPLIGARD(#roottable, (*root)->value.lval); \ } +void midgard_user_call_func(midgard *mgd, int id, int level, void * xparam); + #define MGD_WALK_FUNCTION(table) \ /* {{{ proto void walk_ ## table ## _tree(string func, id, level, xparam[, order]) \ */ \ MGD_FUNCTION(walk_ ## table ## _tree) \ { \ - zval **id, **level, **xparam, **order; \ - zval **old_user_func; \ - midgard_tree *tree; int mlevel, i; \ - TLS_VARS; \ + zval **id, **level, **xparam, *xp[2], **order; \ + zval **midgard_user_call_func_name; \ + CHECK_MGD; \ \ - old_user_func = midgard_user_call_func_name; \ switch (ZEND_NUM_ARGS()) { \ case 5: \ if (zend_get_parameters_ex(5, &midgard_user_call_func_name, &id, \ &level, &xparam, &order) == FAILURE) { \ - midgard_user_call_func_name = old_user_func; \ WRONG_PARAM_COUNT; \ } \ break; \ case 4: \ if (zend_get_parameters_ex(4, &midgard_user_call_func_name, &id, \ &level, &xparam) == FAILURE) { \ - midgard_user_call_func_name = old_user_func; \ WRONG_PARAM_COUNT; \ } else { \ order = NULL; \ } \ break; \ default: \ - midgard_user_call_func_name = old_user_func; \ WRONG_PARAM_COUNT; \ break; \ }\ \ - convert_to_string_ex(midgard_user_call_func_name); \ + convert_to_string_ex(midgard_user_call_func_name); \ convert_to_long_ex(level); \ if (order) convert_to_long_ex(order); \ convert_to_long_ex(id); \ -\ - tree = mgd_tree_build(mgd_handle(), #table, &mlevel, NULL); \ \ - if (!tree) { \ - RETURN_FALSE_BECAUSE(MGD_ERR_ERROR); \ - } \ - /* Be aware of top level trees */ \ - if ((*id)->value.lval == 0) { \ - i = 0; \ - while (tree[i].id) { \ - walktree(tree, order ? (*order)->value.lval : 1, i, 0, \ -(*level)->value.lval ? (*level)->value.lval : mlevel, xparam); \ - i += tree[i].cn; \ - } \ - } else { \ - /* Traverse regular sub tree */ \ - i = mgd_tree_find(tree, id->value.lval); \ - if (i != -1) \ - walktree(tree, order ? (*order)->value.lval : 1, i, tree[i].lv-1, \ - (*level)->value.lval ? (*level)->value.lval : mlevel, xparam); \ - } \ - free(tree); \ - midgard_user_call_func_name = old_user_func; \ + xp[0] = (*xparam); \ + xp[1] = (*midgard_user_call