379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
|
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
|
+
+
-
+
+
+
+
|
blob_appendf(pErr, n ? "not terminated with \\n" : "zero-length");
return 0;
}
/* Strip off the PGP signature if there is one. Then verify the
** Z-card.
*/
{
int const oldLen = n;
remove_pgp_signature(&z, &n);
remove_pgp_signature(&z, &n);
fSigned = n<oldLen;
}
if( verify_z_card(z, n)==2 ){
blob_reset(pContent);
blob_appendf(pErr, "incorrect Z-card cksum");
return 0;
}
/* Verify that the first few characters of the artifact look like
|
403
404
405
406
407
408
409
410
411
412
413
414
415
416
|
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
|
+
|
*/
p = fossil_malloc( sizeof(*p) );
memset(p, 0, sizeof(*p));
memcpy(&p->content, pContent, sizeof(p->content));
p->rid = rid;
blob_zero(pContent);
pContent = &p->content;
p->fSigned = fSigned;
/* Begin parsing, card by card.
*/
x.z = z;
x.zEnd = &z[n];
x.atEol = 1;
while( (cType = next_card(&x))!=0 && cType>=cPrevType ){
|
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
|
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
|
-
+
-
+
+
|
"REPLACE INTO event(type,mtime,objid,user,comment,"
"bgcolor,euser,ecomment,omtime)"
"VALUES('ci',"
" coalesce("
" (SELECT julianday(value) FROM tagxref WHERE tagid=%d AND rid=%d),"
" %.17g"
" ),"
" %d,%Q,%Q,"
" %d,%Q,%Q || %Q,"
" (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d AND tagtype>0),"
" (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d),"
" (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d),%.17g);",
TAG_DATE, rid, p->rDate,
rid, p->zUser, p->zComment,
rid, p->zUser, p->zComment,
p->fSigned ? " (*PGP SIGNED*)" : "",
TAG_BGCOLOR, rid,
TAG_USER, rid,
TAG_COMMENT, rid, p->rDate
);
zCom = db_text(0, "SELECT coalesce(ecomment, comment) FROM event"
" WHERE rowid=last_insert_rowid()");
wiki_extract_links(zCom, rid, 0, p->rDate, 1, WIKI_INLINE);
|