Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch ticket-enhancements Through [7136ff4c65] Excluding Merge-Ins
This is equivalent to a diff from fe453a4893 to 7136ff4c65
|
2012-11-25
| ||
| 11:16 | Use binary mode for CGI trace files. Make CGI trace cross-platform. check-in: 6a8084abcb user: drh tags: ticket-enhancements | |
| 02:57 | Use binary mode for CGI related trace files. Closed-Leaf check-in: 95f02a572e user: mistachkin tags: cgiTraceBinary | |
|
2012-11-24
| ||
| 23:54 | Bug fixes in the TICKETCHNG update mechanism. check-in: 7136ff4c65 user: drh tags: ticket-enhancements | |
| 23:07 | When --httptrace is used with "fossil ui" or "fossil server", create log files containing the text of each HTTP request. check-in: 6f3d328fbf user: drh tags: ticket-enhancements | |
|
2012-11-23
| ||
| 19:33 | some unnecessary spacing check-in: d13143eb3b user: jan.nijtmans tags: trunk | |
| 15:57 | All markup of the form <verbatim-ID>...</verbatim> with an options "links" or "links=BOOLEAN" attribute. Improved TH1 tracing and error reporting capabilities. Improved documentation on how reports work. check-in: 23c75abde4 user: drh tags: ticket-enhancements | |
| 11:29 | merge trunk "filename contains illegal characters" is now a warning check-in: d3bee356ba user: jan.nijtmans tags: ticket-d17d6e5b17 | |
| 10:35 | Disallow invalid unicode characters Closed-Leaf check-in: 9242c09ff9 user: jan.nijtmans tags: invalid-unicode | |
| 01:50 | When db_open_config() is called with the useAttach parameter set to non-zero, it may need to close and reopen the database using ATTACH if that was not done previously. check-in: fe453a4893 user: drh tags: trunk | |
|
2012-11-22
| ||
| 23:35 | Be consistent about display of check-in comments as either text/plain or text/x-fossil-wiki. When the user configures text/plain, use that format everywhere. check-in: 2c6fa9c3b0 user: drh tags: trunk | |
| 10:16 | Modify db_open_config() and associated routines to make their internal state more consistent and discoverable. Closed-Leaf check-in: 52a6868700 user: mistachkin tags: dbOpenConfig | |
Changes to src/attach.c.
| ︙ | |||
528 529 530 531 532 533 534 | 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 | - + + |
output_text_with_line_numbers(z, zLn);
}else{
@ <pre>
@ %h(z)
@ </pre>
}
}else if( strncmp(zMime, "image/", 6)==0 ){
|
| ︙ |
Changes to src/cgi.c.
| ︙ | |||
781 782 783 784 785 786 787 788 789 790 791 792 793 794 | 781 782 783 784 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 816 817 818 819 820 821 822 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
}else{ /* generic error message */
json_err( FSL_JSON_E_INVALID_REQUEST, NULL, 1 );
}
fossil_exit( g.isHTTP ? 0 : 1);
}
#endif /* FOSSIL_ENABLE_JSON */
/*
** Log HTTP traffic to a file. Begin the log on first use. Close the log
** when the argument is NULL.
*/
void cgi_trace(const char *z){
static FILE *pLog = 0;
if( g.fHttpTrace==0 ) return;
if( z==0 ){
if( pLog ) fclose(pLog);
pLog = 0;
return;
}
if( pLog==0 ){
char zFile[50];
unsigned r;
sqlite3_randomness(sizeof(r), &r);
sqlite3_snprintf(sizeof(zFile), zFile, "httplog-%08x.txt", r);
pLog = fopen(zFile, "w");
if( pLog ){
fprintf(stderr, "# open log on %s\n", zFile);
}else{
fprintf(stderr, "# failed to open %s\n", zFile);
return;
}
}
fputs(z, pLog);
}
/*
** Initialize the query parameter database. Information is pulled from
** the QUERY_STRING environment variable (if it exists), from standard
** input if there is POST data, and from HTTP_COOKIE.
*/
void cgi_init(void){
|
| ︙ | |||
823 824 825 826 827 828 829 830 831 832 833 834 835 836 | 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 | + |
if( len>0 && zType ){
blob_zero(&g.cgiIn);
if( fossil_strcmp(zType,"application/x-www-form-urlencoded")==0
|| strncmp(zType,"multipart/form-data",19)==0 ){
z = fossil_malloc( len+1 );
len = fread(z, 1, len, g.httpIn);
z[len] = 0;
cgi_trace(z);
if( zType[0]=='a' ){
add_param_list(z, '&');
}else{
process_multipart_form_data(z, len);
}
}else if( fossil_strcmp(zType, "application/x-fossil")==0 ){
blob_read_from_channel(&g.cgiIn, g.httpIn, len);
|
| ︙ | |||
1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 | 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 | + |
struct sockaddr_in remoteName;
socklen_t size = sizeof(struct sockaddr_in);
char zLine[2000]; /* A single line of input. */
g.fullHttpReply = 1;
if( fgets(zLine, sizeof(zLine),g.httpIn)==0 ){
malformed_request();
}
cgi_trace(zLine);
zToken = extract_token(zLine, &z);
if( zToken==0 ){
malformed_request();
}
if( fossil_strcmp(zToken,"GET")!=0 && fossil_strcmp(zToken,"POST")!=0
&& fossil_strcmp(zToken,"HEAD")!=0 ){
malformed_request();
|
| ︙ | |||
1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 | 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 | + |
/* Get all the optional fields that follow the first line.
*/
while( fgets(zLine,sizeof(zLine),g.httpIn) ){
char *zFieldName;
char *zVal;
cgi_trace(zLine);
zFieldName = extract_token(zLine,&zVal);
if( zFieldName==0 || *zFieldName==0 ) break;
while( fossil_isspace(*zVal) ){ zVal++; }
i = strlen(zVal);
while( i>0 && fossil_isspace(zVal[i-1]) ){ i--; }
zVal[i] = 0;
for(i=0; zFieldName[i]; i++){
|
| ︙ | |||
1210 1211 1212 1213 1214 1215 1216 | 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 | - + |
}else if( fossil_strcmp(zFieldName,"referer:")==0 ){
cgi_setenv("HTTP_REFERER", zVal);
#endif
}else if( fossil_strcmp(zFieldName,"user-agent:")==0 ){
cgi_setenv("HTTP_USER_AGENT", zVal);
}
}
|
| ︙ |
Changes to src/db.c.
| ︙ | |||
1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 | 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 | + + + |
" VALUES('server-code', lower(hex(randomblob(20))),now());"
"INSERT INTO config(name,value,mtime)"
" VALUES('project-code', lower(hex(randomblob(20))),now());"
);
}
if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
if( !db_is_global("localauth") ) db_set_int("localauth", 0, 0);
if( !db_is_global("timeline-plaintext") ){
db_set_int("timeline-plaintext", 1, 0);
}
db_create_default_users(0, zDefaultUser);
user_select();
if( zTemplate ){
/*
** Copy all settings from the supplied template repository.
*/
|
| ︙ |
Changes to src/info.c.
| ︙ | |||
1652 1653 1654 1655 1656 1657 1658 | 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 | - + + + |
output_text_with_line_numbers(z, zLn);
}else{
@ <pre>
@ %h(z)
@ </pre>
}
}else if( strncmp(zMime, "image/", 6)==0 ){
|
| ︙ | |||
1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 | 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 | + + + + + + |
}
}
style_header("Ticket Change Details");
style_submenu_element("Raw", "Raw", "%R/artifact/%S", zUuid);
style_submenu_element("History", "History", "%R/tkthistory/%s", zTktName);
style_submenu_element("Page", "Page", "%R/tktview/%t", zTktName);
style_submenu_element("Timeline", "Timeline", "%R/tkttimeline/%t", zTktName);
if( P("plaintext") ){
style_submenu_element("Formatted", "Formatted", "%R/info/%S", zUuid);
}else{
style_submenu_element("Plaintext", "Plaintext",
"%R/info/%S?plaintext", zUuid);
}
@ <div class="section">Overview</div>
@ <p><table class="label-value">
@ <tr><th>Artifact ID:</th>
@ <td>%z(href("%R/artifact/%s",zUuid))%s(zUuid)</a>
if( g.perm.Setup ){
@ (%d(rid))
|
| ︙ | |||
1745 1746 1747 1748 1749 1750 1751 | 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 | - + |
@ <input type="submit" value="Submit">
@ </form>
@ </blockquote>
}
@ <div class="section">Changes</div>
@ <p>
|
| ︙ |
Changes to src/main.c.
| ︙ | |||
1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 | 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 | + + + + |
/*
** Note that the following command is used by ssh:// processing.
**
** COMMAND: test-http
** Works like the http command but gives setup permission to all users.
*/
void cmd_test_http(void){
g.thTrace = find_option("th-trace", 0, 0)!=0;
if( g.thTrace ){
blob_zero(&g.thLog);
}
login_set_capabilities("sx", 0);
g.useLocalauth = 1;
cgi_set_parameter("REMOTE_ADDR", "127.0.0.1");
g.httpIn = stdin;
g.httpOut = stdout;
find_server_repository(0);
g.cgiOutput = 1;
|
| ︙ |
Changes to src/manifest.c.
| ︙ | |||
1550 1551 1552 1553 1554 1555 1556 | 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 | - + - + |
if( !isNew ){
for(i=0; i<pManifest->nField; i++){
if( fossil_strcmp(pManifest->aField[i].zName, zStatusColumn)==0 ){
zNewStatus = pManifest->aField[i].zValue;
}
}
if( zNewStatus ){
|
| ︙ | |||
1866 1867 1868 1869 1870 1871 1872 | 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 | - - + + + - - + + + |
p->zAttachTarget, p->zAttachName
);
if( strlen(p->zAttachTarget)!=UUID_SIZE
|| !validate16(p->zAttachTarget, UUID_SIZE)
){
char *zComment;
if( p->zAttachSrc && p->zAttachSrc[0] ){
|
| ︙ |
Changes to src/report.c.
| ︙ | |||
486 487 488 489 490 491 492 493 494 | 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | + + + + + - - + + + + |
@
@ <li><p>If a column of the result set is named "#" then that column
@ is assumed to hold a ticket number. A hyperlink will be created from
@ that column to a detailed view of the ticket.</p></li>
@
@ <li><p>If a column of the result set is named "bgcolor" then the content
@ of that column determines the background color of the row.</p></li>
@
@ <li><p>The text of all columns prior to the first column whose name begins
@ with underscore ("_") is shown character-for-character as it appears in
@ the database. In other words, it is assumed to have a mimetype of
@ text/plain.
@
@ <li><p>The first column whose name begins with underscore ("_") and all
|
| ︙ | |||
587 588 589 590 591 592 593 | 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 | - - + + | @ owner AS 'By', @ subsystem AS 'Subsys', @ sdate(changetime) AS 'Changed', @ assignedto AS 'Assigned', @ severity AS 'Svr', @ priority AS 'Pri', @ title AS 'Title', |
| ︙ | |||
617 618 619 620 621 622 623 624 625 626 627 628 629 630 | 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 | + + + |
struct GenerateHTML {
int rn; /* Report number */
int nCount; /* Row number */
int nCol; /* Number of columns */
int isMultirow; /* True if multiple table rows per query result row */
int iNewRow; /* Index of first column that goes on separate row */
int iBg; /* Index of column that defines background color */
int wikiFlags; /* Flags passed into wiki_convert() */
const char *zWikiStart; /* HTML before display of multi-line wiki */
const char *zWikiEnd; /* HTML after display of multi-line wiki */
};
/*
** The callback function for db_query
*/
static int generate_html(
void *pUser, /* Pointer to output state */
|
| ︙ | |||
661 662 663 664 665 666 667 668 669 670 671 672 673 674 | 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 | + + + + + + + + + + + + + |
if( g.perm.Write && azName[i][0]=='#' ){
pState->nCol++;
}
if( !pState->isMultirow ){
if( azName[i][0]=='_' ){
pState->isMultirow = 1;
pState->iNewRow = i;
pState->wikiFlags = WIKI_NOBADLINKS;
pState->zWikiStart = "";
pState->zWikiEnd = "";
if( P("plaintext") ){
pState->wikiFlags |= WIKI_LINKSONLY;
pState->zWikiStart = "<pre class='verbatim'>";
pState->zWikiEnd = "</pre>";
style_submenu_element("Formatted", "Formatted",
"%R/rptview?rn=%d", pState->rn);
}else{
style_submenu_element("Plaintext", "Plaintext",
"%R/rptview?rn=%d&plaintext", pState->rn);
}
}else{
pState->nCol++;
}
}
}
/* The first time this routine is called, output a table header
|
| ︙ | |||
726 727 728 729 730 731 732 | 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 | + - + + - + + |
if( pState->iNewRow>=0 && i>=pState->iNewRow ){
if( zTid && g.perm.Write ){
@ <td valign="top">%z(href("%R/tktedit/%h",zTid))edit</a></td>
zTid = 0;
}
if( zData[0] ){
Blob content;
@ </tr>
|
| ︙ |
Changes to src/schema.c.
| ︙ | |||
395 396 397 398 399 400 401 402 403 404 405 406 407 408 | 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | + + + + + + + + + + + | @ severity TEXT, @ foundin TEXT, @ private_contact TEXT, @ resolution TEXT, @ title TEXT, @ comment TEXT @ ); @ CREATE TABLE ticketchng( @ -- Do not change any column that begins with tkt_ @ tkt_id INTEGER REFERENCES ticket, @ tkt_mtime DATE, @ -- Add as many fields as required below this line @ login TEXT, @ username TEXT, @ mimetype TEXT, @ icomment TEXT @ ); @ CREATE INDEX ticketchng_idx1 ON ticketchng(tkt_id, tkt_mtime); ; /* ** Predefined tagid values */ #if INTERFACE # define TAG_BGCOLOR 1 /* Set the background color for display */ |
| ︙ |
Changes to src/th.c.
| ︙ | |||
1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 | 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 | + + + + + + + |
if( !pValue->zData ){
Th_ErrorMessage(interp, "no such variable:", zVar, nVar);
return TH_ERROR;
}
return Th_SetResult(interp, pValue->zData, pValue->nData);
}
/*
** Return true if variable (zVar, nVar) exists.
*/
int Th_ExistsVar(Th_Interp *interp, const char *zVar, int nVar){
return thFindValue(interp, zVar, nVar, 0, 0)!=0;
}
/*
** String (zVar, nVar) must contain the name of a scalar variable or
** array member. If the variable does not exist it is created. The
** variable is set to the value supplied in string (zValue, nValue).
**
** If (zVar, nVar) refers to an existing array, TH_ERROR is returned
|
| ︙ |
Changes to src/th.h.
| ︙ | |||
47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | + | */ int Th_Expr(Th_Interp *interp, const char *, int); /* ** Access TH variables in the current stack frame. If the variable name ** begins with "::", the lookup is in the top level (global) frame. */ int Th_ExistsVar(Th_Interp *, const char *, int); int Th_GetVar(Th_Interp *, const char *, int); int Th_SetVar(Th_Interp *, const char *, int, const char *, int); int Th_LinkVar(Th_Interp *, const char *, int, int, const char *, int); int Th_UnsetVar(Th_Interp *, const char *, int); typedef int (*Th_CommandProc)(Th_Interp *, void *, int, const char **, int *); |
| ︙ |
Changes to src/th_lang.c.
| ︙ | |||
815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 | 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + |
Th_SetResult(interp, zByte, nByte);
Th_Free(interp, zByte);
return TH_OK;
}
/*
** TH Syntax:
**
** string trim STRING
** string trimleft STRING
** string trimright STRING
*/
static int string_trim_command(
Th_Interp *interp, void *ctx, int argc, const char **argv, int *argl
){
int n;
const char *z;
if( argc!=3 ){
return Th_WrongNumArgs(interp, "string trim string");
}
z = argv[2];
n = argl[2];
if( argl[1]<5 || argv[1][4]=='l' ){
while( n && th_isspace(z[0]) ){ z++; n--; }
}
if( argl[1]<5 || argv[1][4]=='r' ){
while( n && th_isspace(z[n-1]) ){ n--; }
}
Th_SetResult(interp, z, n);
return TH_OK;
}
/*
** TH Syntax:
**
** info exists VAR
*/
static int info_exists_command(
Th_Interp *interp, void *ctx, int argc, const char **argv, int *argl
){
int rc;
if( argc!=3 ){
return Th_WrongNumArgs(interp, "info exists var");
}
|
| ︙ | |||
895 896 897 898 899 900 901 902 903 904 905 906 907 908 | 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 | + + + |
{ "compare", string_compare_command },
{ "first", string_first_command },
{ "is", string_is_command },
{ "last", string_last_command },
{ "length", string_length_command },
{ "range", string_range_command },
{ "repeat", string_repeat_command },
{ "trim", string_trim_command },
{ "trimleft", string_trim_command },
{ "trimright", string_trim_command },
{ 0, 0 }
};
return Th_CallSubCommand(interp, ctx, argc, argv, argl, aSub);
}
/*
** TH Syntax:
|
| ︙ |
Changes to src/th_main.c.
| ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | + | ******************************************************************************* ** ** This file contains an interface between the TH scripting language ** (an independent project) and fossil. */ #include "config.h" #include "th_main.h" #include "sqlite3.h" /* ** Global variable counting the number of outstanding calls to malloc() ** made by the th1 implementation. This is used to catch memory leaks ** in the interpreter. Obviously, it also means th1 is not threadsafe. */ static int nOutstandingMalloc = 0; |
| ︙ | |||
70 71 72 73 74 75 76 | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | + - - + + - + + + + + |
static int enableOutputCmd(
Th_Interp *interp,
void *p,
int argc,
const char **argv,
int *argl
){
int rc;
|
| ︙ | |||
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | + + + |
fflush(stdout);
}
if( encode ) free((char*)z);
}
}
static void sendError(const char *z, int n, int forceCgi){
int savedEnable = enableOutput;
enableOutput = 1;
if( forceCgi || g.cgiOutput ){
sendText("<hr><p class=\"thmainError\">", -1, 0);
}
sendText("ERROR: ", -1, 0);
sendText((char*)z, n, 1);
sendText(forceCgi || g.cgiOutput ? "</p>" : "\n", -1, 0);
enableOutput = savedEnable;
}
/*
** TH command: puts STRING
** TH command: html STRING
**
** Output STRING escaped for HTML (html) or unchanged (puts).
|
| ︙ | |||
565 566 567 568 569 570 571 572 573 574 575 576 577 578 | 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
}
sqlite3_randomness(n, aRand);
encode16(aRand, zOut, n);
Th_SetResult(interp, (const char *)zOut, -1);
return TH_OK;
}
/*
** TH1 command: query SQL CODE
**
** Run the SQL query given by the SQL argument. For each row in the result
** set, run CODE.
**
** In SQL, parameters such as $var are filled in using the value of variable
** "var". Result values are stored in variables with the column name prior
** to each invocation of CODE.
*/
static int queryCmd(
Th_Interp *interp,
void *p,
int argc,
const char **argv,
int *argl
){
sqlite3_stmt *pStmt;
int rc;
const char *zSql;
int nSql;
const char *zTail;
int n, i;
int res = TH_OK;
int nVar;
if( argc!=3 ){
return Th_WrongNumArgs(interp, "query SQL CODE");
}
if( g.db==0 ){
Th_ErrorMessage(interp, "database is not open", 0, 0);
return TH_ERROR;
}
zSql = argv[1];
nSql = argl[1];
while( res==TH_OK && nSql>0 ){
rc = sqlite3_prepare_v2(g.db, argv[1], argl[1], &pStmt, &zTail);
if( rc!=0 ){
Th_ErrorMessage(interp, "SQL error: ", sqlite3_errmsg(g.db), -1);
return TH_ERROR;
}
n = (int)(zTail - zSql);
zSql += n;
nSql -= n;
if( pStmt==0 ) continue;
nVar = sqlite3_bind_parameter_count(pStmt);
for(i=1; i<=nVar; i++){
const char *zVar = sqlite3_bind_parameter_name(pStmt, i);
int szVar = zVar ? th_strlen(zVar) : 0;
if( szVar>1 && zVar[0]=='$'
&& Th_GetVar(interp, zVar+1, szVar-1)==TH_OK ){
int nVal;
const char *zVal = Th_GetResult(interp, &nVal);
sqlite3_bind_text(pStmt, i, zVal, nVal, SQLITE_TRANSIENT);
}
}
while( res==TH_OK && sqlite3_step(pStmt)==SQLITE_ROW ){
int nCol = sqlite3_column_count(pStmt);
for(i=0; i<nCol; i++){
const char *zCol = sqlite3_column_name(pStmt, i);
int szCol = th_strlen(zCol);
const char *zVal = (const char*)sqlite3_column_text(pStmt, i);
int szVal = sqlite3_column_bytes(pStmt, i);
Th_SetVar(interp, zCol, szCol, zVal, szVal);
}
res = Th_Eval(interp, 0, argv[2], argl[2]);
if( res==TH_BREAK || res==TH_CONTINUE ) res = TH_OK;
}
rc = sqlite3_finalize(pStmt);
if( rc!=SQLITE_OK ){
Th_ErrorMessage(interp, "SQL error: ", sqlite3_errmsg(g.db), -1);
return TH_ERROR;
}
}
return res;
}
/*
** Make sure the interpreter has been initialized. Initialize it if
** it has not been already.
**
** The interpreter is stored in the g.interp global variable.
*/
|
| ︙ | |||
591 592 593 594 595 596 597 598 599 600 601 602 603 604 | 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 | + |
{"enable_output", enableOutputCmd, 0},
{"hascap", hascapCmd, 0},
{"hasfeature", hasfeatureCmd, 0},
{"html", putsCmd, (void*)&aFlags[0]},
{"htmlize", htmlizeCmd, 0},
{"linecount", linecntCmd, 0},
{"puts", putsCmd, (void*)&aFlags[1]},
{"query", queryCmd, 0},
{"randhex", randhexCmd, 0},
{"repository", repositoryCmd, 0},
{"stime", stimeCmd, 0},
{"utime", utimeCmd, 0},
{"wiki", wikiCmd, (void*)&aFlags[0]},
{0, 0, 0}
};
|
| ︙ | |||
799 800 801 802 803 804 805 806 807 808 809 810 811 812 | 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 | + + + |
i = 0;
zResult = (char*)Th_GetResult(g.interp, &n);
sendText((char*)zResult, n, encode);
}else if( z[i]=='<' && isBeginScriptTag(&z[i]) ){
sendText(z, i, 0);
z += i+5;
for(i=0; z[i] && (z[i]!='<' || !isEndScriptTag(&z[i])); i++){}
if( g.thTrace ){
Th_Trace("eval {<pre>%#h</pre>}<br>", i, z);
}
rc = Th_Eval(g.interp, 0, (const char*)z, i);
if( rc!=TH_OK ) break;
z += i;
if( z[0] ){ z += 6; }
i = 0;
}else{
i++;
|
| ︙ |
Changes to src/timeline.c.
| ︙ | |||
342 343 344 345 346 347 348 | 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | + + + + - + |
}
}else if( zType[0]=='e' && tagid ){
hyperlink_to_event_tagid(tagid<0?-tagid:tagid);
}else if( (tmFlags & TIMELINE_ARTID)!=0 ){
hyperlink_to_uuid(zUuid);
}
db_column_blob(pQuery, commentColumn, &comment);
if( zType[0]!='c' ){
/* Comments for anything other than a check-in are generated by
** "fossil rebuild" and expect to be rendered as text/x-fossil-wiki */
wiki_convert(&comment, 0, WIKI_INLINE);
|
| ︙ |
Changes to src/tkt.c.
| ︙ | |||
24 25 26 27 28 29 30 | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | + - - - + + + + + + + + + - + - + + + + + + + + + + + + + + - - + + - - + + + - + + - - + + + - + - + + + + - - - - - - - - - + + + + + + + + + + + + + + - - - - - - + + - + + - |
/*
** The list of database user-defined fields in the TICKET table.
** The real table also contains some addition fields for internal
** used. The internal-use fields begin with "tkt_".
*/
static int nField = 0;
static struct tktFieldInfo {
|
| ︙ | |||
112 113 114 115 116 117 118 | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | - - - + + - - |
const char *zName = db_column_name(&q, i);
char *zRevealed = 0;
if( zVal==0 ){
zVal = "";
}else if( strncmp(zName, "private_", 8)==0 ){
zVal = zRevealed = db_reveal(zVal);
}
|
| ︙ | |||
155 156 157 158 159 160 161 | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | - - - - - + + + + + + - + - - - + + - + - - - - + + - + - - + + + + - - - + + + + + - - + + + + + + + + - + - - + - - + + + + + + + + + + + + + - - - + + + + + + + + - + - + - + - + - + + - + + + + - + + |
for(i=0; (z = cgi_parameter_name(i))!=0; i++){
Th_Store(z, P(z));
}
}
/*
|
| ︙ | |||
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | + + + + + + + |
"%s/tktnew", g.zTop);
}
if( g.perm.ApndTkt && g.perm.Attach ){
style_submenu_element("Attach", "Add An Attachment",
"%s/attachadd?tkt=%T&from=%s/tktview/%t",
g.zTop, zUuid, g.zTop, zUuid);
}
if( P("plaintext") ){
style_submenu_element("Formatted", "Formatted", "%R/tktview/%S", zUuid);
}else{
style_submenu_element("Plaintext", "Plaintext",
"%R/tktview/%S?plaintext", zUuid);
}
style_header("View Ticket");
if( g.thTrace ) Th_Trace("BEGIN_TKTVIEW<br />\n", -1);
ticket_init();
initializeVariablesFromCGI();
initializeVariablesFromDb();
zScript = ticket_viewpage_code();
if( g.thTrace ) Th_Trace("BEGIN_TKTVIEW_SCRIPT<br />\n", -1);
Th_Render(zScript);
if( g.thTrace ) Th_Trace("END_TKTVIEW<br />\n", -1);
zFullName = db_text(0,
|
| ︙ | |||
364 365 366 367 368 369 370 | 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | - - + + - + |
return Th_WrongNumArgs(interp, "append_field FIELD STRING");
}
if( g.thTrace ){
Th_Trace("append_field %#h {%#h}<br />\n",
argl[1], argv[1], argl[2], argv[2]);
}
for(idx=0; idx<nField; idx++){
|
| ︙ | |||
438 439 440 441 442 443 444 | 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 | - - - + + + - - + + + - - + + + + - + - + |
}
zUuid = (const char *)pUuid;
blob_zero(&tktchng);
zDate = date_in_standard_format("now");
blob_appendf(&tktchng, "D %s\n", zDate);
free(zDate);
for(i=0; i<nField; i++){
|
| ︙ | |||
633 634 635 636 637 638 639 | 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 | + + + + - - - - + + + + - - - - + + + + + |
rc = sqlite3_exec(db, zSchema, 0, 0, &zErr);
if( rc!=SQLITE_OK ){
sqlite3_close(db);
return zErr;
}
rc = sqlite3_exec(db, "SELECT tkt_id, tkt_uuid, tkt_mtime FROM ticket",
0, 0, 0);
if( rc!=SQLITE_OK ){
zErr = mprintf("schema fails to define valid a TICKET "
"table containing all required fields");
}else{
|
| ︙ | |||
732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 | 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 | + + + + + + + + - + + + + + - + - + + - + - + + + + - + + + + + + + + + + - + - - - - - - - + + + + + + + |
** Show the complete change history for a single ticket
*/
void tkthistory_page(void){
Stmt q;
char *zTitle;
const char *zUuid;
int tagid;
int nChng = 0;
login_check_credentials();
if( !g.perm.Hyperlink || !g.perm.RdTkt ){ login_needed(); return; }
zUuid = PD("name","");
zTitle = mprintf("History Of Ticket %h", zUuid);
style_submenu_element("Status", "Status",
"%s/info/%s", g.zTop, zUuid);
style_submenu_element("Check-ins", "Check-ins",
"%s/tkttimeline?name=%s&y=ci", g.zTop, zUuid);
style_submenu_element("Timeline", "Timeline",
"%s/tkttimeline?name=%s", g.zTop, zUuid);
if( P("plaintext")!=0 ){
style_submenu_element("Formatted", "Formatted",
"%R/tkthistory/%S", zUuid);
}else{
style_submenu_element("Plaintext", "Plaintext",
"%R/tkthistory/%S?plaintext", zUuid);
}
style_header(zTitle);
free(zTitle);
tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid);
if( tagid==0 ){
@ No such ticket: %h(zUuid)
style_footer();
return;
}
db_prepare(&q,
"SELECT datetime(mtime,'localtime'), objid, uuid, NULL, NULL, NULL"
" FROM event, blob"
" WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)"
" AND blob.rid=event.objid"
" UNION "
"SELECT datetime(mtime,'localtime'), attachid, uuid, src, filename, user"
" FROM attachment, blob"
" WHERE target=(SELECT substr(tagname,5) FROM tag WHERE tagid=%d)"
" AND blob.rid=attachid"
|
| ︙ | |||
964 965 966 967 968 969 970 | 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 | - + |
if( !strncmp(g.argv[3],"fields",n) ){
/* simply show all field names */
int i;
/* read all available ticket fields */
getAllTicketFields();
for(i=0; i<nField; i++){
|
| ︙ | |||
1039 1040 1041 1042 1043 1044 1045 | 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 | - + + - + + - + - + - + - + + |
if( eCmd==history ){
Stmt q;
int tagid;
if ( i != g.argc ){
fossil_fatal("no other parameters expected to %s!",g.argv[2]);
}
|
| ︙ | |||
1112 1113 1114 1115 1116 1117 1118 | 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 | - + |
return;
}
/* read all given ticket field/value pairs from command line */
if( i==g.argc ){
fossil_fatal("empty %s command aborted!",g.argv[2]);
}
getAllTicketFields();
|
| ︙ | |||
1137 1138 1139 1140 1141 1142 1143 | 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 | - + - + - + - - + + - + - + - + - + |
zFName++;
}
j = fieldId(zFName);
if( j == -1 ){
fossil_fatal("unknown field name '%s'!",zFName);
}else{
if (append) {
|
Changes to src/tktsetup.c.
| ︙ | |||
65 66 67 68 69 70 71 | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | - + + + + + + + + + + + + | /* @-comment: ** */ static const char zDefaultTicketTable[] = @ CREATE TABLE ticket( @ -- Do not change any column that begins with tkt_ @ tkt_id INTEGER PRIMARY KEY, @ tkt_uuid TEXT UNIQUE, @ tkt_mtime DATE, |
| ︙ | |||
118 119 120 121 122 123 124 | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | - + |
z = db_get(zDbField, (char*)zDfltValue);
}
style_header("Edit %s", zTitle);
if( P("clear")!=0 ){
login_verify_csrf_secret();
db_unset(zDbField, 0);
if( xRebuild ) xRebuild();
|
| ︙ | |||
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | + + + + + + + + + + + + + + + - + - - + + - - + - + + - + + - - + + - - + + - - + + + - + - + - + + - - - - + + + - - - - + + + + + + + + + + + + + + + + + + + + + + - + + - - + + + + - + |
0,
30
);
}
static const char zDefaultNew[] =
@ <th1>
@ if {![info exists mutype]} {set mutype {[links only]}}
@ if {[info exists submit]} {
@ set status Open
@ set ctxt "<i>By [htmlize $login] on [date] UTC:</i><br />"
@ if {$mutype eq "HTML"} {
@ set x "<nowiki>\n[string trimright $comment]\n</nowiki>"
@ } elseif {$mutype eq "Plain Text"} {
@ set r [randhex]
@ set x "<verbatim-$r>\n[string trimright $comment]\n</verbatim-$r>"
@ } elseif {$mutype eq {[links only]}} {
@ set r [randhex]
@ set x [string trimright $comment]
@ set x "<verbatim-$r links>\n$x\n</verbatim-$r>"
@ } else {
@ set x $comment
@ }
@ set comment "$ctxt\n$x"
@ submit_ticket
@ }
@ </th1>
@ <h1 style="text-align: center;">Enter A New Ticket</h1>
@ <table cellpadding="5">
@ <tr>
|
| ︙ | |||
388 389 390 391 392 393 394 | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | - + | static const char zDefaultView[] = @ <table cellpadding="5"> @ <tr><td class="tktDspLabel">Ticket UUID:</td> @ <td class="tktDspValue" colspan="3">$<tkt_uuid></td></tr> @ <tr><td class="tktDspLabel">Title:</td> @ <td class="tktDspValue" colspan="3"> |
| ︙ | |||
422 423 424 425 426 427 428 | 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | - - + + + + + + + + + | @ <th1>enable_output 1</th1> @ </tr> @ <tr><td class="tktDspLabel">Version Found In:</td> @ <td colspan="3" valign="top" class="tktDspValue"> @ $<foundin> @ </td></tr> @ <tr><td>Description & Comments:</td></tr> |
| ︙ | |||
456 457 458 459 460 461 462 463 464 465 466 | 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 | + - + - - + + + + + + + + + + + + + + + + + + + + + + - + + + - + - - + + + + - + + + - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + - - + + + - - + + + + |
0,
40
);
}
static const char zDefaultEdit[] =
@ <th1>
@ if {![info exists mutype]} {set mutype {[links only]}}
@ if {![info exists username]} {set username $login}
@ if {[info exists submit]} {
@ if {[info exists cmappnd]} {
@ if {[string length $cmappnd]>0} {
|
| ︙ |
Changes to src/wikiformat.c.
| ︙ | |||
49 50 51 52 53 54 55 | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | + - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + | #define ATTR_COLSPAN 10 #define ATTR_COMPACT 11 #define ATTR_FACE 12 #define ATTR_HEIGHT 13 #define ATTR_HREF 14 #define ATTR_HSPACE 15 #define ATTR_ID 16 #define ATTR_LINKS 17 |
| ︙ | |||
111 112 113 114 115 116 117 118 119 120 121 122 123 124 | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | + |
{ "colspan", AMSK_COLSPAN, },
{ "compact", AMSK_COMPACT, },
{ "face", AMSK_FACE, },
{ "height", AMSK_HEIGHT, },
{ "href", AMSK_HREF, },
{ "hspace", AMSK_HSPACE, },
{ "id", AMSK_ID, },
{ "links", AMSK_LINKS, },
{ "name", AMSK_NAME, },
{ "rowspan", AMSK_ROWSPAN, },
{ "size", AMSK_SIZE, },
{ "src", AMSK_SRC, },
{ "start", AMSK_START, },
{ "style", AMSK_STYLE, },
{ "target", AMSK_TARGET, },
|
| ︙ | |||
436 437 438 439 440 441 442 | 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | - + |
*/
static int markupLength(const char *z){
int n = 1;
int inparen = 0;
int c;
if( z[n]=='/' ){ n++; }
if( !fossil_isalpha(z[n]) ) return 0;
|
| ︙ | |||
748 749 750 751 752 753 754 755 | 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 | + + + + + + + + + + + - + |
if( j<sizeof(zTag)-1 ) zTag[j++] = fossil_tolower(z[i]);
i++;
}
zTag[j] = 0;
p->iCode = findTag(zTag);
p->iType = aMarkup[p->iCode].iType;
p->nAttr = 0;
c = 0;
if( z[i]=='-' ){
p->aAttr[0].iACode = iACode = ATTR_ID;
i++;
p->aAttr[0].zValue = &z[i];
while( fossil_isalnum(z[i]) ){ i++; }
p->aAttr[0].cTerm = c = z[i];
z[i++] = 0;
p->nAttr = 1;
if( c=='>' ) return;
}
while( fossil_isspace(z[i]) ){ i++; }
|
| ︙ | |||
1159 1160 1161 1162 1163 1164 1165 | 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 | - + + + + + |
|| strncmp(zTarget, "https:", 6)==0
|| strncmp(zTarget, "ftp:", 4)==0
|| strncmp(zTarget, "mailto:", 7)==0
){
blob_appendf(p->pOut, "<a href=\"%s\">", zTarget);
}else if( zTarget[0]=='/' ){
blob_appendf(p->pOut, "<a href=\"%s%h\">", g.zTop, zTarget);
|
| ︙ | |||
1431 1432 1433 1434 1435 1436 1437 | 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 | - - + + - |
}
case TOKEN_MARKUP: {
const char *zId;
int iDiv;
parseMarkup(&markup, z);
/* Markup of the form </div id=ID> where there is a matching
|
| ︙ | |||
1525 1526 1527 1528 1529 1530 1531 | 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 | - + - - - - - - + + + - + + + |
p->zVerbatimId = 0;
p->inVerbatim = 1;
p->preVerbState = p->state;
p->state &= ~ALLOW_WIKI;
for(ii=0; ii<markup.nAttr; ii++){
if( markup.aAttr[ii].iACode == ATTR_ID ){
p->zVerbatimId = markup.aAttr[ii].zValue;
|
| ︙ |