Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add the PT() and PDT() macros for extracting query parameters with leading and trailing whitespace removed. Use those macros to in the check-in edit page. Do not create branches or tags with empty names. Ticket [e613f452fada00]. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
655e78209bc8fd35c58596cc9490d0c5 |
User & Date: | drh 2011-04-18 12:29:15.159 |
Context
2011-04-18
| ||
12:45 | Update the download page generator script to also generate a page showing the SHA1 checksums of all build products. ... (check-in: cea065c7 user: drh tags: trunk) | |
12:29 | Add the PT() and PDT() macros for extracting query parameters with leading and trailing whitespace removed. Use those macros to in the check-in edit page. Do not create branches or tags with empty names. Ticket [e613f452fada00]. ... (check-in: 655e7820 user: drh tags: trunk) | |
12:01 | Fix an invalid call to free() that occurs when "fossil add ." is run. Ticket [157ef3e5a7a06b]. ... (check-in: ed5c19cd user: drh tags: trunk) | |
Changes
Changes to src/cgi.c.
︙ | ︙ | |||
53 54 55 56 57 58 59 | /* ** Shortcuts for cgi_parameter. P("x") returns the value of query parameter ** or cookie "x", or NULL if there is no such parameter or cookie. PD("x","y") ** does the same except "y" is returned in place of NULL if there is not match. */ #define P(x) cgi_parameter((x),0) #define PD(x,y) cgi_parameter((x),(y)) | | | | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | /* ** Shortcuts for cgi_parameter. P("x") returns the value of query parameter ** or cookie "x", or NULL if there is no such parameter or cookie. PD("x","y") ** does the same except "y" is returned in place of NULL if there is not match. */ #define P(x) cgi_parameter((x),0) #define PD(x,y) cgi_parameter((x),(y)) #define PT(x) cgi_parameter_trimmed((x),0) #define PDT(x,y) cgi_parameter_trimmed((x),(y)) /* ** Destinations for output text. */ #define CGI_HEADER 0 #define CGI_BODY 1 |
︙ | ︙ | |||
785 786 787 788 789 790 791 792 793 794 795 796 797 798 | CGIDEBUG(("env-match [%s] = [%s]\n", zName, zValue)); return zValue; } } CGIDEBUG(("no-match [%s]\n", zName)); return zDefault; } /* ** Return the name of the i-th CGI parameter. Return NULL if there ** are fewer than i registered CGI parmaeters. */ const char *cgi_parameter_name(int i){ if( i>=0 && i<nUsedQP ){ | > > > > > > > > > > > > > > > > > | 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 | CGIDEBUG(("env-match [%s] = [%s]\n", zName, zValue)); return zValue; } } CGIDEBUG(("no-match [%s]\n", zName)); return zDefault; } /* ** Return the value of a CGI parameter with leading and trailing ** spaces removed. */ char *cgi_parameter_trimmed(const char *zName, const char *zDefault){ const char *zIn; char *zOut; int i; zIn = cgi_parameter(zName, 0); if( zIn==0 ) zIn = zDefault; while( fossil_isspace(zIn[0]) ) zIn++; zOut = fossil_strdup(zIn); for(i=0; zOut[i]; i++){} while( i>0 && fossil_isspace(zOut[i-1]) ) zOut[--i] = 0; return zOut; } /* ** Return the name of the i-th CGI parameter. Return NULL if there ** are fewer than i registered CGI parmaeters. */ const char *cgi_parameter_name(int i){ if( i>=0 && i<nUsedQP ){ |
︙ | ︙ |
Changes to src/info.c.
︙ | ︙ | |||
1577 1578 1579 1580 1581 1582 1583 | if( P("cancel") ){ cgi_redirectf("ci?name=%s", zUuid); } zNewComment = PD("c",zComment); zUser = db_text(0, "SELECT coalesce(euser,user)" " FROM event WHERE objid=%d", rid); if( zUser==0 ) fossil_redirect_home(); | | | | | | | | 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 | if( P("cancel") ){ cgi_redirectf("ci?name=%s", zUuid); } zNewComment = PD("c",zComment); zUser = db_text(0, "SELECT coalesce(euser,user)" " FROM event WHERE objid=%d", rid); if( zUser==0 ) fossil_redirect_home(); zNewUser = PDT("u",zUser); zDate = db_text(0, "SELECT datetime(mtime)" " FROM event WHERE objid=%d", rid); if( zDate==0 ) fossil_redirect_home(); zNewDate = PDT("dt",zDate); zColor = db_text("", "SELECT bgcolor" " FROM event WHERE objid=%d", rid); zNewColor = PDT("clr",zColor); if( fossil_strcmp(zNewColor,"##")==0 ){ zNewColor = PT("clrcust"); } fPropagateColor = db_int(0, "SELECT tagtype FROM tagxref" " WHERE rid=%d AND tagid=%d", rid, TAG_BGCOLOR)==2; fNewPropagateColor = P("clr")!=0 ? P("pclr")!=0 : fPropagateColor; zNewTagFlag = P("newtag") ? " checked" : ""; zNewTag = PDT("tagname",""); zNewBrFlag = P("newbr") ? " checked" : ""; zNewBranch = PDT("brname",""); zCloseFlag = P("close") ? " checked" : ""; if( P("apply") ){ Blob ctrl; char *zNow; int nChng = 0; login_verify_csrf_secret(); |
︙ | ︙ | |||
1649 1650 1651 1652 1653 1654 1655 | db_multi_exec("REPLACE INTO newtags VALUES(%Q,'-',NULL)", zTag); } } db_finalize(&q); if( zCloseFlag[0] ){ db_multi_exec("REPLACE INTO newtags VALUES('closed','+',NULL)"); } | | | | 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 | db_multi_exec("REPLACE INTO newtags VALUES(%Q,'-',NULL)", zTag); } } db_finalize(&q); if( zCloseFlag[0] ){ db_multi_exec("REPLACE INTO newtags VALUES('closed','+',NULL)"); } if( zNewTagFlag[0] && zNewTag[0] ){ db_multi_exec("REPLACE INTO newtags VALUES('sym-%q','+',NULL)", zNewTag); } if( zNewBrFlag[0] && zNewBranch[0] ){ db_multi_exec( "REPLACE INTO newtags " " SELECT tagname, '-', NULL FROM tagxref, tag" " WHERE tagxref.rid=%d AND tagtype==2" " AND tagname GLOB 'sym-*'" " AND tag.tagid=tagxref.tagid", rid |
︙ | ︙ |