emile Wed Mar 21 06:53:29 2001 EDT
Modified files:
/php4/ext/midgard article.c
Log:
Disallow duplicate article names under one parent
Index: php4/ext/midgard/article.c
diff -u php4/ext/midgard/article.c:1.17 php4/ext/midgard/article.c:1.18
--- php4/ext/midgard/article.c:1.17 Fri Mar 16 07:01:35 2001
+++ php4/ext/midgard/article.c Wed Mar 21 06:53:28 2001
@@ -1,4 +1,4 @@
-/* $Id: article.c,v 1.17 2001/03/16 15:01:35 emile Exp $
+/* $Id: article.c,v 1.18 2001/03/21 14:53:28 emile Exp $
Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]>
Copyright (C) 2000 The Midgard Project ry
Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]>
@@ -556,6 +556,11 @@
RETURN_FALSE_BECAUSE(MGD_ERR_ACCESS_DENIED);
}
+ if (mgd_exists_id(mgd_handle(), "article", "topic=$d AND name=$q",
+ (*topic)->value.lval, (*name)->value.str.val)) {
+ RETURN_FALSE_BECAUSE(MGD_ERR_DUPLICATE);
+ }
+
php_midgard_create(return_value, "article",
"up,topic,name,title,abstract,content,author,"
"url,calstart,caldays,icon,view,print,"
@@ -857,6 +862,11 @@
upval = atol((*up)->value.str.val);
if (upval != 0 && !mgd_exists_id(mgd_handle(), "article", "id=$d", upval))
RETURN_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS);
+ }
+
+ if (mgd_exists_id(mgd_handle(), "article", "topic=$d AND name=$q AND id<>$d",
+ (*topic)->value.lval, (*name)->value.str.val, (*id)->value.lval)) {
+ RETURN_FALSE_BECAUSE(MGD_ERR_DUPLICATE);
}
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]