Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch spider-defense Excluding Merge-Ins
This is equivalent to a diff from f9711803e2 to d9c8a7dd73
2012-04-28
| ||
08:05 | Move the enhanced spider-defense mechanism into the trunk. check-in: 433cde1ce8 user: drh tags: trunk | |
08:03 | Refinements to the new hyperlink logic and spider defense. Closed-Leaf check-in: d9c8a7dd73 user: drh tags: spider-defense | |
07:15 | Changes anchor tags (<a>) so that the href= attribute can be set by javascript rather than by HTML. This is to make it harder for spiders to follow the hyperlinks to every diff and annotation in the project history. It all seems to work, but it needs further testing and review before going live. check-in: 8ae52fc418 user: drh tags: spider-defense | |
03:32 | Enhance the "translate" utility so that formatting characters can occur in between the "%" and "C" of a printf-style conversion on @-lines. check-in: f9711803e2 user: drh tags: trunk | |
2012-04-27
| ||
15:56 | Always update the baseurl: entry in the config table if using a repository from a URL that has not previously been recorded. check-in: c7d6e334f8 user: drh tags: trunk | |
Changes to src/attach.c.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
for(i=0; zFilename[i]; i++){ if( zFilename[i]=='/' && zFilename[i+1]!=0 ){ zFilename = &zFilename[i+1]; i = -1; } } if( strlen(zTarget)==UUID_SIZE && validate16(zTarget,UUID_SIZE) ){ zUrlTail = mprintf("tkt=%s&file=%t", zTarget, zFilename); }else{ zUrlTail = mprintf("page=%t&file=%t", zTarget, zFilename); } @ @ <p><a href="/attachview?%s(zUrlTail)">%h(zFilename)</a> @ [<a href="/attachdownload/%t(zFilename)?%s(zUrlTail)">download</a>]<br /> if( zComment ) while( fossil_isspace(zComment[0]) ) zComment++; if( zComment && zComment[0] ){ @ %w(zComment)<br /> |
| | |
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
for(i=0; zFilename[i]; i++){ if( zFilename[i]=='/' && zFilename[i+1]!=0 ){ zFilename = &zFilename[i+1]; i = -1; } } if( strlen(zTarget)==UUID_SIZE && validate16(zTarget,UUID_SIZE) ){ zUrlTail = mprintf("tkt=%s&file=%t", zTarget, zFilename); }else{ zUrlTail = mprintf("page=%t&file=%t", zTarget, zFilename); } @ @ <p><a href="/attachview?%s(zUrlTail)">%h(zFilename)</a> @ [<a href="/attachdownload/%t(zFilename)?%s(zUrlTail)">download</a>]<br /> if( zComment ) while( fossil_isspace(zComment[0]) ) zComment++; if( zComment && zComment[0] ){ @ %w(zComment)<br /> |
Changes to src/branch.c.
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 ... 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 ... 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 |
style_submenu_element("Color-Test", "Color-Test", "brlist?colortest"); }else{ style_submenu_element("All", "All", "brlist?all"); } login_anonymous_available(); style_sidebox_begin("Nomenclature:", "33%"); @ <ol> @ <li> An <div class="sideboxDescribed"><a href="brlist"> @ open branch</a></div> is a branch that has one or @ more <a href="leaves">open leaves.</a> @ The presence of open leaves presumably means @ that the branch is still being extended with new check-ins.</li> @ <li> A <div class="sideboxDescribed"><a href="brlist?closed"> @ closed branch</a></div> is a branch with only @ <div class="sideboxDescribed"><a href="leaves?closed"> @ closed leaves</a></div>. @ Closed branches are fixed and do not change (unless they are first @ reopened)</li> @ </ol> style_sidebox_end(); branch_prepare_list_query(&q, showAll?1:(showClosed?-1:0)); ................................................................................ @ <ul> cnt++; } if( colorTest ){ const char *zColor = hash_color(zBr); @ <li><span style="background-color: %s(zColor)"> @ %h(zBr) → %s(zColor)</span></li> }else if( g.perm.History ){ @ <li><a href="%s(g.zTop)/timeline?r=%T(zBr)")>%h(zBr)</a></li> }else{ @ <li><b>%h(zBr)</b></li> } } if( cnt ){ @ </ul> } db_finalize(&q); @ <script type="text/JavaScript"> ................................................................................ /* ** This routine is called while for each check-in that is rendered by ** the timeline of a "brlist" page. Add some additional hyperlinks ** to the end of the line. */ static void brtimeline_extra(int rid){ Stmt q; if( !g.perm.History ) return; db_prepare(&q, "SELECT substr(tagname,5) FROM tagxref, tag" " WHERE tagxref.rid=%d" " AND tagxref.tagid=tag.tagid" " AND tagxref.tagtype>0" " AND tag.tagname GLOB 'sym-*'", rid ); while( db_step(&q)==SQLITE_ROW ){ const char *zTagName = db_column_text(&q, 0); @ <a href="%s(g.zTop)/timeline?r=%T(zTagName)">[timeline]</a> } db_finalize(&q); } /* ** WEBPAGE: brtimeline ** |
| | | | < < < > | | |
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 ... 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 ... 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 |
style_submenu_element("Color-Test", "Color-Test", "brlist?colortest"); }else{ style_submenu_element("All", "All", "brlist?all"); } login_anonymous_available(); style_sidebox_begin("Nomenclature:", "33%"); @ <ol> @ <li> An <div class="sideboxDescribed">%z(href("brlist")) @ open branch</a></div> is a branch that has one or @ more %z(href("leaves"))open leaves.</a> @ The presence of open leaves presumably means @ that the branch is still being extended with new check-ins.</li> @ <li> A <div class="sideboxDescribed">%z(href("brlist?closed")) @ closed branch</a></div> is a branch with only @ <div class="sideboxDescribed">%z(href("leaves?closed")) @ closed leaves</a></div>. @ Closed branches are fixed and do not change (unless they are first @ reopened)</li> @ </ol> style_sidebox_end(); branch_prepare_list_query(&q, showAll?1:(showClosed?-1:0)); ................................................................................ @ <ul> cnt++; } if( colorTest ){ const char *zColor = hash_color(zBr); @ <li><span style="background-color: %s(zColor)"> @ %h(zBr) → %s(zColor)</span></li> }else{ @ <li>%z(href("%R/timeline?r=%T",zBr))%h(zBr)</a></li> } } if( cnt ){ @ </ul> } db_finalize(&q); @ <script type="text/JavaScript"> ................................................................................ /* ** This routine is called while for each check-in that is rendered by ** the timeline of a "brlist" page. Add some additional hyperlinks ** to the end of the line. */ static void brtimeline_extra(int rid){ Stmt q; if( !g.perm.Hyperlink ) return; db_prepare(&q, "SELECT substr(tagname,5) FROM tagxref, tag" " WHERE tagxref.rid=%d" " AND tagxref.tagid=tag.tagid" " AND tagxref.tagtype>0" " AND tag.tagname GLOB 'sym-*'", rid ); while( db_step(&q)==SQLITE_ROW ){ const char *zTagName = db_column_text(&q, 0); @ %z(href("%R/timeline?r=%T",zTagName))[timeline]</a> } db_finalize(&q); } /* ** WEBPAGE: brtimeline ** |
Changes to src/browse.c.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 ... 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 ... 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 ... 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
*/ void hyperlinked_path(const char *zPath, Blob *pOut, const char *zCI){ int i, j; char *zSep = ""; for(i=0; zPath[i]; i=j){ for(j=i; zPath[j] && zPath[j]!='/'; j++){} if( zPath[j] && g.perm.History ){ if( zCI ){ blob_appendf(pOut, "%s<a href=\"%s/dir?ci=%S&name=%#T\">%#h</a>", zSep, g.zTop, zCI, j, zPath, j-i, &zPath[i]); }else{ blob_appendf(pOut, "%s<a href=\"%s/dir?name=%#T\">%#h</a>", zSep, g.zTop, j, zPath, j-i, &zPath[i]); } }else{ blob_appendf(pOut, "%s%#h", zSep, j-i, &zPath[i]); } zSep = "/"; while( zPath[j]=='/' ){ j++; } } ................................................................................ int rid = 0; char *zUuid = 0; Blob dirname; Manifest *pM = 0; const char *zSubdirLink; login_check_credentials(); if( !g.perm.History ){ login_needed(); return; } while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; } style_header("File List"); sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0, pathelementFunc, 0, 0); /* If the name= parameter is an empty string, make it a NULL pointer */ if( zD && strlen(zD)==0 ){ zD = 0; } ................................................................................ blob_append(&dirname, "in the top-level directory", -1); zPrefix = ""; } if( zCI ){ char zShort[20]; memcpy(zShort, zUuid, 10); zShort[10] = 0; @ <h2>Files of check-in [<a href="vinfo?name=%T(zUuid)">%s(zShort)</a>] @ %s(blob_str(&dirname))</h2> zSubdirLink = mprintf("%s/dir?ci=%S&name=%T", g.zTop, zUuid, zPrefix); if( zD ){ style_submenu_element("Top", "Top", "%s/dir?ci=%S", g.zTop, zUuid); style_submenu_element("All", "All", "%s/dir?name=%t", g.zTop, zD); }else{ style_submenu_element("All", "All", "%s/dir", g.zTop); } }else{ int hasTrunk; @ <h2>The union of all files from all check-ins @ %s(blob_str(&dirname))</h2> hasTrunk = db_exists( "SELECT 1 FROM tagxref WHERE tagid=%d AND value='trunk'", TAG_BRANCH); zSubdirLink = mprintf("%s/dir?name=%T", g.zTop, zPrefix); if( zD ){ style_submenu_element("Top", "Top", "%s/dir", g.zTop); style_submenu_element("Tip", "Tip", "%s/dir?name=%t&ci=tip", g.zTop, zD); if( hasTrunk ){ style_submenu_element("Trunk", "Trunk", "%s/dir?name=%t&ci=trunk", g.zTop,zD); } }else{ style_submenu_element("Tip", "Tip", "%s/dir?ci=tip", g.zTop); if( hasTrunk ){ style_submenu_element("Trunk", "Trunk", "%s/dir?ci=trunk", g.zTop); } } } /* Compute the temporary table "localfiles" containing the names ** of all files and subdirectories in the zD[] directory. ** ................................................................................ @ </ul></td><td class="browser"><ul class="browser"> i = 0; } i++; zFN = db_column_text(&q, 0); if( zFN[0]=='/' ){ zFN++; @ <li><a href="%s(zSubdirLink)%T(zFN)">%h(zFN)/</a></li> }else if( zCI ){ const char *zUuid = db_column_text(&q, 1); @ <li><a href="%s(g.zTop)/artifact/%s(zUuid)">%h(zFN)</a></li> }else{ @ <li><a href="%s(g.zTop)/finfo?name=%T(zPrefix)%T(zFN)">%h(zFN) @ </a></li> } } db_finalize(&q); manifest_destroy(pM); @ </ul></td></tr></table> style_footer(); } |
| > | | > | | | | | | | | | | | < | | | | | | | |
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 ... 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 ... 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 ... 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
*/ void hyperlinked_path(const char *zPath, Blob *pOut, const char *zCI){ int i, j; char *zSep = ""; for(i=0; zPath[i]; i=j){ for(j=i; zPath[j] && zPath[j]!='/'; j++){} if( zPath[j] && g.perm.Hyperlink ){ if( zCI ){ char *zLink = href("%R/dir?ci=%S&name=%#T", zCI, j, zPath); blob_appendf(pOut, "%s%z%#h</a>", zSep, zLink, j-i, &zPath[i]); }else{ char *zLink = href("%R/dir?name=%#T", j, zPath); blob_appendf(pOut, "%s%z%#h</a>", zSep, zLink, j-i, &zPath[i]); } }else{ blob_appendf(pOut, "%s%#h", zSep, j-i, &zPath[i]); } zSep = "/"; while( zPath[j]=='/' ){ j++; } } ................................................................................ int rid = 0; char *zUuid = 0; Blob dirname; Manifest *pM = 0; const char *zSubdirLink; login_check_credentials(); if( !g.perm.Hyperlink ){ login_needed(); return; } while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; } style_header("File List"); sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0, pathelementFunc, 0, 0); /* If the name= parameter is an empty string, make it a NULL pointer */ if( zD && strlen(zD)==0 ){ zD = 0; } ................................................................................ blob_append(&dirname, "in the top-level directory", -1); zPrefix = ""; } if( zCI ){ char zShort[20]; memcpy(zShort, zUuid, 10); zShort[10] = 0; @ <h2>Files of check-in [%z(href("vinfo?name=%T",zUuid))%s(zShort)</a>] @ %s(blob_str(&dirname))</h2> zSubdirLink = mprintf("%R/dir?ci=%S&name=%T", zUuid, zPrefix); if( zD ){ style_submenu_element("Top", "Top", "%R/dir?ci=%S", zUuid); style_submenu_element("All", "All", "%R/dir?name=%t", zD); }else{ style_submenu_element("All", "All", "%R/dir"); } }else{ int hasTrunk; @ <h2>The union of all files from all check-ins @ %s(blob_str(&dirname))</h2> hasTrunk = db_exists( "SELECT 1 FROM tagxref WHERE tagid=%d AND value='trunk'", TAG_BRANCH); zSubdirLink = mprintf("%R/dir?name=%T", zPrefix); if( zD ){ style_submenu_element("Top", "Top", "%R/dir"); style_submenu_element("Tip", "Tip", "%R/dir?name=%t&ci=tip", zD); if( hasTrunk ){ style_submenu_element("Trunk", "Trunk", "%R/dir?name=%t&ci=trunk", zD); } }else{ style_submenu_element("Tip", "Tip", "%R/dir?ci=tip"); if( hasTrunk ){ style_submenu_element("Trunk", "Trunk", "%R/dir?ci=trunk"); } } } /* Compute the temporary table "localfiles" containing the names ** of all files and subdirectories in the zD[] directory. ** ................................................................................ @ </ul></td><td class="browser"><ul class="browser"> i = 0; } i++; zFN = db_column_text(&q, 0); if( zFN[0]=='/' ){ zFN++; @ <li>%z(href("%s%T",zSubdirLink,zFN))%h(zFN)</a></li> }else if( zCI ){ const char *zUuid = db_column_text(&q, 1); @ <li>%z(href("%R/artifact/%s",zUuid))%h(zFN)</a></li> }else{ @ <li>%z(href("%R/finfo?name=%T%T",zPrefix,zFN))%h(zFN) @ </a></li> } } db_finalize(&q); manifest_destroy(pM); @ </ul></td></tr></table> style_footer(); } |
Changes to src/diff.c.
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
....
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
|
while( db_step(&q)==SQLITE_ROW ){ int pid = db_column_int(&q, 0); const char *zUuid = db_column_text(&q, 1); const char *zDate = db_column_text(&q, 2); const char *zUser = db_column_text(&q, 3); if( webLabel ){ zLabel = mprintf( "<a href='%s/info/%s' target='infowindow'>%.10s</a> %s %13.13s", g.zTop, zUuid, zUuid, zDate, zUser ); }else{ zLabel = mprintf("%.10s %s %13.13s", zUuid, zDate, zUser); } p->nVers++; p->azVers = fossil_realloc(p->azVers, p->nVers*sizeof(p->azVers[0]) ); p->azVers[p->nVers-1] = zLabel; ................................................................................ if( mid==0 || fnid==0 ){ fossil_redirect_home(); } iLimit = atoi(PD("limit","-1")); if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ fossil_redirect_home(); } style_header("File Annotation"); if( P("filevers") ) annFlags |= ANN_FILE_VERS; annotate_file(&ann, fnid, mid, g.perm.History, iLimit, annFlags); if( P("log") ){ int i; @ <h2>Versions analyzed:</h2> @ <ol> for(i=0; i<ann.nVers; i++){ @ <li><tt>%s(ann.azVers[i])</tt></li> } |
|
|
|
|
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
....
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
|
while( db_step(&q)==SQLITE_ROW ){ int pid = db_column_int(&q, 0); const char *zUuid = db_column_text(&q, 1); const char *zDate = db_column_text(&q, 2); const char *zUser = db_column_text(&q, 3); if( webLabel ){ zLabel = mprintf( "<a href='%R/info/%s' target='infowindow'>%.10s</a> %s %13.13s", zUuid, zUuid, zDate, zUser ); }else{ zLabel = mprintf("%.10s %s %13.13s", zUuid, zDate, zUser); } p->nVers++; p->azVers = fossil_realloc(p->azVers, p->nVers*sizeof(p->azVers[0]) ); p->azVers[p->nVers-1] = zLabel; ................................................................................ if( mid==0 || fnid==0 ){ fossil_redirect_home(); } iLimit = atoi(PD("limit","-1")); if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ fossil_redirect_home(); } style_header("File Annotation"); if( P("filevers") ) annFlags |= ANN_FILE_VERS; annotate_file(&ann, fnid, mid, g.perm.Hyperlink, iLimit, annFlags); if( P("log") ){ int i; @ <h2>Versions analyzed:</h2> @ <ol> for(i=0; i<ann.nVers; i++){ @ <li><tt>%s(ann.azVers[i])</tt></li> } |
Changes to src/diffcmd.c.
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 |
diff_all_two_versions(zFrom, zTo, zDiffCmd, diffFlags);
}
}
}
/*
** WEBPAGE: vpatch
** URL vpatch?from=UUID&to=UUID
*/
void vpatch_page(void){
const char *zFrom = P("from");
const char *zTo = P("to");
login_check_credentials();
if( !g.perm.Read ){ login_needed(); return; }
if( zFrom==0 || zTo==0 ) fossil_redirect_home();
cgi_set_content_type("text/plain");
diff_all_two_versions(zFrom, zTo, 0, DIFF_NEWFILE);
}
|
| |
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 |
diff_all_two_versions(zFrom, zTo, zDiffCmd, diffFlags); } } } /* ** WEBPAGE: vpatch ** URL vpatch?from=UUID&to=UUID */ void vpatch_page(void){ const char *zFrom = P("from"); const char *zTo = P("to"); login_check_credentials(); if( !g.perm.Read ){ login_needed(); return; } if( zFrom==0 || zTo==0 ) fossil_redirect_home(); cgi_set_content_type("text/plain"); diff_all_two_versions(zFrom, zTo, 0, DIFF_NEWFILE); } |
Changes to src/event.c.
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
...
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
#include "event.h" /* ** Output a hyperlink to an event given its tagid. */ void hyperlink_to_event_tagid(int tagid){ char *zEventId; char zShort[12]; zEventId = db_text(0, "SELECT substr(tagname, 7) FROM tag WHERE tagid=%d", tagid); sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zEventId); if( g.perm.History ){ @ [<a href="%s(g.zTop)/event?name=%s(zEventId)">%s(zShort)</a>] }else{ @ [%s(zShort)] } free(zEventId); } /* ** WEBPAGE: event ** URL: /event ** PARAMETERS: ................................................................................ if( g.perm.WrWiki && g.perm.Write && nextRid==0 ){ style_submenu_element("Edit", "Edit", "%s/eventedit?name=%s", g.zTop, zEventId); } zETime = db_text(0, "SELECT datetime(%.17g)", pEvent->rEventDate); style_submenu_element("Context", "Context", "%s/timeline?c=%T", g.zTop, zETime); if( g.perm.History ){ if( showDetail ){ style_submenu_element("Plain", "Plain", "%s/event?name=%s&aid=%s", g.zTop, zEventId, zUuid); if( nextRid ){ char *zNext; zNext = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nextRid); style_submenu_element("Next", "Next", "%s/event?name=%s&aid=%s&detail=1", g.zTop, zEventId, zNext); free(zNext); } if( prevRid ){ char *zPrev; zPrev = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", prevRid); style_submenu_element("Prev", "Prev", "%s/event?name=%s&aid=%s&detail=1", g.zTop, zEventId, zPrev); free(zPrev); } }else{ style_submenu_element("Detail", "Detail", "%s/event?name=%s&aid=%s&detail=1", g.zTop, zEventId, zUuid); } } if( showDetail && g.perm.History ){ int i; const char *zClr = 0; Blob comment; zATime = db_text(0, "SELECT datetime(%.17g)", pEvent->rDate); @ <p>Event [<a href="%s(g.zTop)/artifact/%s(zUuid)">%S(zUuid)</a>] at @ [<a href="%s(g.zTop)/timeline?c=%T(zETime)">%s(zETime)</a>] @ entered by user <b>%h(pEvent->zUser)</b> on @ [<a href="%s(g.zTop)/timeline?c=%T(zATime)">%s(zATime)</a>]:</p> @ <blockquote> for(i=0; i<pEvent->nTag; i++){ if( fossil_strcmp(pEvent->aTag[i].zName,"+bgcolor")==0 ){ zClr = pEvent->aTag[i].zValue; } } if( zClr && zClr[0]==0 ) zClr = 0; |
<
<
<
<
<
<
<
<
>
|
|
|
|
|
|
|
|
|
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
...
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
#include "event.h" /* ** Output a hyperlink to an event given its tagid. */ void hyperlink_to_event_tagid(int tagid){ char *zEventId; zEventId = db_text(0, "SELECT substr(tagname, 7) FROM tag WHERE tagid=%d", tagid); @ [%z(href("%R/event/%s",zEventId))%S(zEventId)</a>] free(zEventId); } /* ** WEBPAGE: event ** URL: /event ** PARAMETERS: ................................................................................ if( g.perm.WrWiki && g.perm.Write && nextRid==0 ){ style_submenu_element("Edit", "Edit", "%s/eventedit?name=%s", g.zTop, zEventId); } zETime = db_text(0, "SELECT datetime(%.17g)", pEvent->rEventDate); style_submenu_element("Context", "Context", "%s/timeline?c=%T", g.zTop, zETime); if( g.perm.Hyperlink ){ if( showDetail ){ style_submenu_element("Plain", "Plain", "%s/event?name=%s&aid=%s", g.zTop, zEventId, zUuid); if( nextRid ){ char *zNext; zNext = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nextRid); style_submenu_element("Next", "Next", "%s/event?name=%s&aid=%s&detail=1", g.zTop, zEventId, zNext); free(zNext); } if( prevRid ){ char *zPrev; zPrev = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", prevRid); style_submenu_element("Prev", "Prev", "%s/event?name=%s&aid=%s&detail=1", g.zTop, zEventId, zPrev); free(zPrev); } }else{ style_submenu_element("Detail", "Detail", "%s/event?name=%s&aid=%s&detail=1", g.zTop, zEventId, zUuid); } } if( showDetail && g.perm.Hyperlink ){ int i; const char *zClr = 0; Blob comment; zATime = db_text(0, "SELECT datetime(%.17g)", pEvent->rDate); @ <p>Event [%z(href("%R/artifact/%s",zUuid))%S(zUuid)</a>] at @ [%z(href("%R/timeline?c=%T",zETime))%s(zETime)</a>] @ entered by user <b>%h(pEvent->zUser)</b> on @ [%z(href("%R/timeline?c=%T",zATime))%s(zATime)</a>]:</p> @ <blockquote> for(i=0; i<pEvent->nTag; i++){ if( fossil_strcmp(pEvent->aTag[i].zName,"+bgcolor")==0 ){ zClr = pEvent->aTag[i].zValue; } } if( zClr && zClr[0]==0 ) zClr = 0; |
Changes to src/finfo.c.
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 |
@ <tr><td> @ <div class="divider">%s(zPrevDate)</div> @ </td></tr> } memcpy(zTime, &zDate[11], 5); zTime[5] = 0; @ <tr><td class="timelineTime"> @ <a href="%s(g.zTop)/timeline?c=%t(zDate)">%s(zTime)</a></td> @ <td class="timelineGraph"><div id="m%d(gidx)"></div></td> if( zBgClr && zBgClr[0] ){ @ <td class="timelineTableCell" style="background-color: %h(zBgClr);"> }else{ @ <td class="timelineTableCell"> } sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zUuid); sqlite3_snprintf(sizeof(zShortCkin), zShortCkin, "%.10s", zCkin); if( zUuid ){ if( g.perm.History ){ @ <a href="%s(g.zTop)/artifact/%s(zUuid)">[%S(zUuid)]</a> }else{ @ [%S(zUuid)] } @ part of check-in }else{ @ <b>Deleted</b> by check-in } hyperlink_to_uuid(zShortCkin); @ %h(zCom) (user: hyperlink_to_user(zUser, zDate, ""); @ branch: %h(zBr)) if( g.perm.History && zUuid ){ const char *z = zFilename; if( fpid ){ @ <a href="%s(g.zTop)/fdiff?v1=%s(zPUuid)&v2=%s(zUuid)">[diff]</a> } @ <a href="%s(g.zTop)/annotate?checkin=%S(zCkin)&filename=%h(z)"> @ [annotate]</a> } @ </td></tr> } db_finalize(&q); if( pGraph ){ graph_finish(pGraph, 0); |
| < < < < < | | | | |
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 |
@ <tr><td> @ <div class="divider">%s(zPrevDate)</div> @ </td></tr> } memcpy(zTime, &zDate[11], 5); zTime[5] = 0; @ <tr><td class="timelineTime"> @ %z(href("%R/timeline?c=%t",zDate))%s(zTime)</a></td> @ <td class="timelineGraph"><div id="m%d(gidx)"></div></td> if( zBgClr && zBgClr[0] ){ @ <td class="timelineTableCell" style="background-color: %h(zBgClr);"> }else{ @ <td class="timelineTableCell"> } sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zUuid); sqlite3_snprintf(sizeof(zShortCkin), zShortCkin, "%.10s", zCkin); if( zUuid ){ @ %z(href("%R/artifact/%s",zUuid))[%S(zUuid)]</a> part of check-in }else{ @ <b>Deleted</b> by check-in } hyperlink_to_uuid(zShortCkin); @ %h(zCom) (user: hyperlink_to_user(zUser, zDate, ""); @ branch: %h(zBr)) if( g.perm.Hyperlink && zUuid ){ const char *z = zFilename; if( fpid ){ @ %z(href("%R/fdiff?v1=%s&v2=%s",zPUuid,zUuid))[diff]</a> } @ %z(href("%R/annotate?checkin=%S&filename=%h",zCkin,z)) @ [annotate]</a> } @ </td></tr> } db_finalize(&q); if( pGraph ){ graph_finish(pGraph, 0); |
Changes to src/info.c.
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 ... 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 ... 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 ... 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 ... 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 ... 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 ... 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 ... 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 ... 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 .... 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 .... 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 .... 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 .... 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 .... 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 .... 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 .... 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 .... 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 .... 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 |
hyperlink_to_uuid(zOrigUuid); }else{ @ propagates to descendants } #if 0 if( zValue && fossil_strcmp(zTagname,"branch")==0 ){ @ @ <a href="%s(g.zTop)/timeline?r=%T(zValue)">branch timeline</a> } #endif } if( zSrcUuid && zSrcUuid[0] ){ if( tagtype==0 ){ @ by }else{ ................................................................................ const char *zName, /* Name of the file that has changed */ const char *zOld, /* blob.uuid before change. NULL for added files */ const char *zNew, /* blob.uuid after change. NULL for deletes */ const char *zOldName, /* Prior name. NULL if no name change. */ int diffFlags, /* Flags for text_diff(). Zero to omit diffs */ int mperm /* executable or symlink permission for zNew */ ){ if( !g.perm.History ){ if( zNew==0 ){ @ <p>Deleted %h(zName)</p> }else if( zOld==0 ){ @ <p>Added %h(zName)</p> }else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){ @ <p>Name change from %h(zOldName) to %h(zName) }else if( fossil_strcmp(zNew, zOld)==0 ){ ................................................................................ @ <pre style="white-space:pre;"> append_diff(zOld, zNew, diffFlags); @ </pre> } }else{ if( zOld && zNew ){ if( fossil_strcmp(zOld, zNew)!=0 ){ @ <p>Modified <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a> @ from <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a> @ to <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)].</a> }else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){ @ <p>Name change from @ from <a href="%s(g.zTop)/finfo?name=%T(zOldName)">%h(zOldName)</a> @ to <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>. }else{ @ <p>Execute permission %s(( mperm==PERM_EXE )?"set":"cleared") for @ <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a> } }else if( zOld ){ @ <p>Deleted <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a> @ version <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a> }else{ @ <p>Added <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a> @ version <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)]</a> } if( diffFlags ){ @ <pre style="white-space:pre;"> append_diff(zOld, zNew, diffFlags); @ </pre> }else if( zOld && zNew && fossil_strcmp(zOld,zNew)!=0 ){ @ @ <a href="%s(g.zTop)/fdiff?v1=%S(zOld)&v2=%S(zNew)">[diff]</a> } @ </p> } } /* ** Construct an appropriate diffFlag for text_diff() based on query ................................................................................ const char *zDate = db_column_text(&q, 2); if( zUser==0 || zUser[0]==0 ) zUser = "unknown"; @ <tr><th>Received From:</th> @ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate)</td></tr> } db_finalize(&q); } if( g.perm.History ){ const char *zProjName = db_get("project-name", "unnamed"); @ <tr><th>Timelines:</th><td> @ <a href="%s(g.zTop)/timeline?f=%S(zUuid)">family</a> if( zParent ){ @ | <a href="%s(g.zTop)/timeline?p=%S(zUuid)">ancestors</a> } if( !isLeaf ){ @ | <a href="%s(g.zTop)/timeline?d=%S(zUuid)">descendants</a> } if( zParent && !isLeaf ){ @ | <a href="%s(g.zTop)/timeline?dp=%S(zUuid)">both</a> } db_prepare(&q, "SELECT substr(tag.tagname,5) FROM tagxref, tag " " WHERE rid=%d AND tagtype>0 " " AND tag.tagid=tagxref.tagid " " AND +tag.tagname GLOB 'sym-*'", rid); while( db_step(&q)==SQLITE_ROW ){ const char *zTagName = db_column_text(&q, 0); @ | <a href="%s(g.zTop)/timeline?r=%T(zTagName)">%h(zTagName)</a> } db_finalize(&q); @ </td></tr> @ <tr><th>Other Links:</th> @ <td> @ <a href="%s(g.zTop)/dir?ci=%S(zUuid)">files</a> if( g.perm.Zip ){ char *zUrl = mprintf("%s/tarball/%s-%S.tar.gz?uuid=%s", g.zTop, zProjName, zUuid, zUuid); @ | <a href="%s(zUrl)">Tarball</a> @ | <a href="%s(g.zTop)/zip/%s(zProjName)-%S(zUuid).zip?uuid=%s(zUuid)"> @ ZIP archive</a> fossil_free(zUrl); } @ | <a href="%s(g.zTop)/artifact/%S(zUuid)">manifest</a> if( g.perm.Write ){ @ | <a href="%s(g.zTop)/ci_edit?r=%S(zUuid)">edit</a> } @ </td> @ </tr> } @ </table> }else{ style_header("Check-in Information"); ................................................................................ if( zParent ){ @ <div class="section">Changes</div> @ <div class="sectionmenu"> showDiff = g.zPath[0]!='c'; if( db_get_boolean("show-version-diffs", 0)==0 ){ showDiff = !showDiff; if( showDiff ){ @ <a class="button" href="%s(g.zTop)/vinfo/%T(zName)"> @ hide diffs</a> if( sideBySide ){ @ <a class="button" href="%s(g.zTop)/ci/%T(zName)?sbs=0"> @ unified diffs</a> }else{ @ <a class="button" href="%s(g.zTop)/ci/%T(zName)?sbs=1"> @ side-by-side diffs</a> } }else{ @ <a class="button" href="%s(g.zTop)/ci/%T(zName)?sbs=0"> @ show unified diffs</a> @ <a class="button" href="%s(g.zTop)/ci/%T(zName)?sbs=1"> @ show side-by-side diffs</a> } }else{ if( showDiff ){ @ <a class="button" href="%s(g.zTop)/ci/%T(zName)">hide diffs</a> if( sideBySide ){ @ <a class="button" href="%s(g.zTop)/info/%T(zName)?sbs=0"> @ unified diffs</a> }else{ @ <a class="button" href="%s(g.zTop)/info/%T(zName)?sbs=1"> @ side-by-side diffs</a> } }else{ @ <a class="button" href="%s(g.zTop)/vinfo/%T(zName)?sbs=0"> @ show unified diffs</a> @ <a class="button" href="%s(g.zTop)/vinfo/%T(zName)?sbs=1"> @ show side-by-side diffs</a> } } @ <a class="button" href="%s(g.zTop)/vpatch?from=%S(zParent)&to=%S(zUuid)"> @ patch</a></div> db_prepare(&q, "SELECT name," " mperm," " (SELECT uuid FROM blob WHERE rid=mlink.pid)," " (SELECT uuid FROM blob WHERE rid=mlink.fid)," " (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)" ................................................................................ @ <tr><th>Date:</th><td> hyperlink_to_date(zDate, "</td></tr>"); if( g.perm.Setup ){ @ <tr><th>Record ID:</th><td>%d(rid)</td></tr> } @ <tr><th>Original User:</th><td> hyperlink_to_user(zUser, zDate, "</td></tr>"); if( g.perm.History ){ @ <tr><th>Commands:</th> @ <td> @ <a href="%s(g.zTop)/whistory?name=%t(zName)">history</a> @ | <a href="%s(g.zTop)/artifact/%S(zUuid)">raw-text</a> @ </td> @ </tr> } @ </table></p> }else{ style_header("Wiki Information"); rid = 0; ................................................................................ } db_finalize(&q); } /* ** WEBPAGE: vdiff ** URL: /vdiff?from=UUID&to=UUID&detail=BOOLEAN;sbs=BOOLEAN ** ** Show all differences between two checkins. */ void vdiff_page(void){ int ridFrom, ridTo; int showDetail = 0; int sideBySide = 0; ................................................................................ if( mPerm==PERM_LNK ){ @ <li>Symbolic link }else if( mPerm==PERM_EXE ){ @ <li>Executable file }else{ @ <li>File } if( g.perm.History ){ @ <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a> }else{ @ %h(zName) } @ <ul> prevName = fossil_strdup(zName); } @ <li> hyperlink_to_date(zDate,""); @ - part of checkin hyperlink_to_uuid(zVers); if( zBr && zBr[0] ){ if( g.perm.History ){ @ on branch <a href="%s(g.zTop)/timeline?r=%T(zBr)">%h(zBr)</a> }else{ @ on branch %h(zBr) } } @ - %w(zCom) (user: hyperlink_to_user(zUser,zDate,""); @ ) if( g.perm.History ){ @ <a href="%s(g.zTop)/annotate?checkin=%S(zVers)&filename=%T(zName)"> @ [annotate]</a> } cnt++; if( pDownloadName && blob_size(pDownloadName)==0 ){ blob_append(pDownloadName, zName, -1); } } ................................................................................ const char *zDate = db_column_text(&q, 1); const char *zUser = db_column_text(&q, 2); if( cnt>0 ){ @ Also wiki page }else{ @ Wiki page } if( g.perm.History ){ @ [<a href="%s(g.zTop)/wiki?name=%t(zPagename)">%h(zPagename)</a>] }else{ @ [%h(zPagename)] } @ by hyperlink_to_user(zUser,zDate," on"); hyperlink_to_date(zDate,"."); nWiki++; cnt++; if( pDownloadName && blob_size(pDownloadName)==0 ){ blob_appendf(pDownloadName, "%s.wiki", zPagename); } ................................................................................ /* const char *zSrc = db_column_text(&q, 4); */ if( cnt>0 ){ @ Also attachment "%h(zFilename)" to }else{ @ Attachment "%h(zFilename)" to } if( strlen(zTarget)==UUID_SIZE && validate16(zTarget,UUID_SIZE) ){ if( g.perm.History && g.perm.RdTkt ){ @ ticket [<a href="%s(g.zTop)/tktview?name=%S(zTarget)">%S(zTarget)</a>] }else{ @ ticket [%S(zTarget)] } }else{ if( g.perm.History && g.perm.RdWiki ){ @ wiki page [<a href="%s(g.zTop)/wiki?name=%t(zTarget)">%h(zTarget)</a>] }else{ @ wiki page [%h(zTarget)] } } @ added by hyperlink_to_user(zUser,zDate," on"); hyperlink_to_date(zDate,"."); ................................................................................ } db_finalize(&q); if( cnt==0 ){ @ Control artifact. if( pDownloadName && blob_size(pDownloadName)==0 ){ blob_appendf(pDownloadName, "%.10s.txt", zUuid); } }else if( linkToView && g.perm.History ){ @ <a href="%s(g.zTop)/artifact/%S(zUuid)">[view]</a> } } /* ** WEBPAGE: fdiff ** URL: fdiff?v1=UUID&v2=UUID&patch&sbs=BOOLEAN ................................................................................ style_submenu_element("Unified Diff", "udiff", "%s/fdiff?v1=%T&v2=%T&sbs=0", g.zTop, P("v1"), P("v2")); } if( P("smhdr")!=0 ){ @ <h2>Differences From Artifact @ <a href="%s(g.zTop)/artifact/%S(zV1)">[%S(zV1)]</a> To @ <a href="%s(g.zTop)/artifact/%S(zV2)">[%S(zV2)]</a>.</h2> }else{ @ <h2>Differences From @ Artifact <a href="%s(g.zTop)/artifact/%S(zV1)">[%S(zV1)]</a>:</h2> object_description(v1, 0, 0); @ <h2>To Artifact @ <a href="%s(g.zTop)/artifact/%S(zV2)">[%S(zV2)]</a>:</h2> object_description(v2, 0, 0); } @ <hr /> @ <div class="%s(zStyle)"> @ %s(blob_str(&diff)) @ </div> blob_reset(&diff); ................................................................................ rid = name_to_rid_www("name"); login_check_credentials(); if( !g.perm.Read ){ login_needed(); return; } if( rid==0 ) fossil_redirect_home(); if( g.perm.Admin ){ const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid); if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){ style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&sub=1", g.zTop, zUuid); }else{ style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun", g.zTop, zUuid); } } style_header("Hex Artifact Content"); ................................................................................ login_check_credentials(); if( !g.perm.Read ){ login_needed(); return; } if( rid==0 ) fossil_redirect_home(); if( g.perm.Admin ){ const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid); if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){ style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&sub=1", g.zTop, zUuid); }else{ style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun", g.zTop, zUuid); } } style_header("Artifact Content"); ................................................................................ output_text_with_line_numbers(z, zLn); }else{ @ <pre> @ %h(z) @ </pre> } }else if( strncmp(zMime, "image/", 6)==0 ){ @ <img src="%s(g.zTop)/raw?name=%s(zUuid)&m=%s(zMime)"></img> }else{ @ <i>(file is %d(blob_size(&content)) bytes of binary data)</i> } @ </blockquote> } style_footer(); } ................................................................................ login_check_credentials(); if( !g.perm.RdTkt ){ login_needed(); return; } rid = name_to_rid_www("name"); if( rid==0 ){ fossil_redirect_home(); } zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid); if( g.perm.Admin ){ if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){ style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&sub=1", g.zTop, zUuid); }else{ style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun", g.zTop, zUuid); } } pTktChng = manifest_get(rid, CFTYPE_TICKET); ................................................................................ if( pTktChng==0 ){ fossil_redirect_home(); } style_header("Ticket Change Details"); zDate = db_text(0, "SELECT datetime(%.12f)", pTktChng->rDate); memcpy(zTktName, pTktChng->zTicketUuid, 10); zTktName[10] = 0; if( g.perm.History ){ @ <h2>Changes to ticket @ <a href="%s(pTktChng->zTicketUuid)">%s(zTktName)</a></h2> @ @ <p>By %h(pTktChng->zUser) on %s(zDate). See also: @ <a href="%s(g.zTop)/artifact/%T(zUuid)">artifact content</a>, and @ <a href="%s(g.zTop)/tkthistory/%s(pTktChng->zTicketUuid)">ticket @ history</a></p> }else{ @ <h2>Changes to ticket %s(zTktName)</h2> @ @ <p>By %h(pTktChng->zUser) on %s(zDate). @ </p> } @ ................................................................................ @ %s(blob_str(&suffix)) @ </td></tr></table> @ </blockquote> @ <hr /> blob_reset(&suffix); } @ <p>Make changes to attributes of check-in @ [<a href="ci?name=%s(zUuid)">%s(zUuid)</a>]:</p> @ <form action="%s(g.zTop)/ci_edit" method="post"><div> login_insert_csrf_secret(); @ <input type="hidden" name="r" value="%S(zUuid)" /> @ <table border="0" cellspacing="10"> @ <tr><td align="right" valign="top"><b>User:</b></td> @ <td valign="top"> |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < < < < | < < < < | | | < < < < < | | | | | | | | | | < | | | | | | | | < | |
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 ... 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 ... 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 ... 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 ... 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 ... 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 ... 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 ... 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 ... 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 .... 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 .... 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 .... 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 .... 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 .... 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 .... 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 .... 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 .... 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 .... 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 |
hyperlink_to_uuid(zOrigUuid); }else{ @ propagates to descendants } #if 0 if( zValue && fossil_strcmp(zTagname,"branch")==0 ){ @ @ %z(href("%R/timeline?r=%T",zValue))branch timeline</a> } #endif } if( zSrcUuid && zSrcUuid[0] ){ if( tagtype==0 ){ @ by }else{ ................................................................................ const char *zName, /* Name of the file that has changed */ const char *zOld, /* blob.uuid before change. NULL for added files */ const char *zNew, /* blob.uuid after change. NULL for deletes */ const char *zOldName, /* Prior name. NULL if no name change. */ int diffFlags, /* Flags for text_diff(). Zero to omit diffs */ int mperm /* executable or symlink permission for zNew */ ){ if( !g.perm.Hyperlink ){ if( zNew==0 ){ @ <p>Deleted %h(zName)</p> }else if( zOld==0 ){ @ <p>Added %h(zName)</p> }else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){ @ <p>Name change from %h(zOldName) to %h(zName) }else if( fossil_strcmp(zNew, zOld)==0 ){ ................................................................................ @ <pre style="white-space:pre;"> append_diff(zOld, zNew, diffFlags); @ </pre> } }else{ if( zOld && zNew ){ if( fossil_strcmp(zOld, zNew)!=0 ){ @ <p>Modified %z(href("%R/finfo?name=%T",zName))%h(zName)</a> @ from %z(href("%R/artifact/%s",zOld))[%S(zOld)]</a> @ to %z(href("%R/artifact/%s",zNew))[%S(zNew)].</a> }else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){ @ <p>Name change from @ from %z(href("%R/finfo?name=%T",zOldName))%h(zOldName)</a> @ to %z(href("%R/finfo?name=%T",zName))%h(zName)</a>. }else{ @ <p>Execute permission %s(( mperm==PERM_EXE )?"set":"cleared") for @ %z(href("%R/finfo?name=%T",zName))%h(zName)</a> } }else if( zOld ){ @ <p>Deleted %z(href("%s/finfo?name=%T",g.zTop,zName))%h(zName)</a> @ version %z(href("%R/artifact/%s",zOld))[%S(zOld)]</a> }else{ @ <p>Added %z(href("%R/finfo?name=%T",zName))%h(zName)</a> @ version %z(href("%R/artifact/%s",zNew))[%S(zNew)]</a> } if( diffFlags ){ @ <pre style="white-space:pre;"> append_diff(zOld, zNew, diffFlags); @ </pre> }else if( zOld && zNew && fossil_strcmp(zOld,zNew)!=0 ){ @ @ %z(href("%R/fdiff?v1=%S&v2=%S",zOld,zNew))[diff]</a> } @ </p> } } /* ** Construct an appropriate diffFlag for text_diff() based on query ................................................................................ const char *zDate = db_column_text(&q, 2); if( zUser==0 || zUser[0]==0 ) zUser = "unknown"; @ <tr><th>Received From:</th> @ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate)</td></tr> } db_finalize(&q); } if( g.perm.Hyperlink ){ const char *zProjName = db_get("project-name", "unnamed"); @ <tr><th>Timelines:</th><td> @ %z(href("%R/timeline?f=%S",zUuid))family</a> if( zParent ){ @ | %z(href("%R/timeline?p=%S",zUuid))ancestors</a> } if( !isLeaf ){ @ | %z(href("%R/timeline?d=%S",zUuid))descendants</a> } if( zParent && !isLeaf ){ @ | %z(href("%R/timeline?dp=%S",zUuid))both</a> } db_prepare(&q, "SELECT substr(tag.tagname,5) FROM tagxref, tag " " WHERE rid=%d AND tagtype>0 " " AND tag.tagid=tagxref.tagid " " AND +tag.tagname GLOB 'sym-*'", rid); while( db_step(&q)==SQLITE_ROW ){ const char *zTagName = db_column_text(&q, 0); @ | %z(href("%R/timeline?r=%T",zTagName))%h(zTagName)</a> } db_finalize(&q); @ </td></tr> @ <tr><th>Other Links:</th> @ <td> @ %z(href("%R/dir?ci=%S",zUuid))files</a> if( g.perm.Zip ){ char *zUrl = mprintf("%R/tarball/%s-%S.tar.gz?uuid=%s", zProjName, zUuid, zUuid); @ | %z(href("%s",zUrl))Tarball</a> @ | %z(href("%R/zip/%s-%S.zip?uuid=%s",zProjName,zUuid,zUuid)) @ ZIP archive</a> fossil_free(zUrl); } @ | %z(href("%R/artifact/%S",zUuid))manifest</a> if( g.perm.Write ){ @ | %z(href("%R/ci_edit?r=%S",zUuid))edit</a> } @ </td> @ </tr> } @ </table> }else{ style_header("Check-in Information"); ................................................................................ if( zParent ){ @ <div class="section">Changes</div> @ <div class="sectionmenu"> showDiff = g.zPath[0]!='c'; if( db_get_boolean("show-version-diffs", 0)==0 ){ showDiff = !showDiff; if( showDiff ){ @ %z(xhref("class='button'","%R/vinfo/%T",zName))) @ hide diffs</a> if( sideBySide ){ @ %z(xhref("class='button'","%R/ci/%T?sbs=0",zName)) @ unified diffs</a> }else{ @ %z(xhref("class='button'","%R/ci/%T?sbs=1",zName)) @ side-by-side diffs</a> } }else{ @ %z(xhref("class='button'","%R/ci/%T?sbs=0",zName)) @ show unified diffs</a> @ %z(xhref("class='button'","%R/ci/%T?sbs=1",zName)) @ show side-by-side diffs</a> } }else{ if( showDiff ){ @ %z(xhref("class='button'","%R/ci/%T",zName))hide diffs</a> if( sideBySide ){ @ %z(xhref("class='button'","%R/info/%T?sbs=0",zName)) @ unified diffs</a> }else{ @ %z(xhref("class='button'","%R/info/%T?sbs=1",zName)) @ side-by-side diffs</a> } }else{ @ %z(xhref("class='button'","%R/vinfo/%T?sbs=0",zName)) @ show unified diffs</a> @ %z(xhref("class='button'","%R/vinfo/%T?sbs=1",zName)) @ show side-by-side diffs</a> } } @ %z(xhref("class='button'","%R/vpatch?from=%S&to=%S",zParent,zUuid)) @ patch</a></div> db_prepare(&q, "SELECT name," " mperm," " (SELECT uuid FROM blob WHERE rid=mlink.pid)," " (SELECT uuid FROM blob WHERE rid=mlink.fid)," " (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)" ................................................................................ @ <tr><th>Date:</th><td> hyperlink_to_date(zDate, "</td></tr>"); if( g.perm.Setup ){ @ <tr><th>Record ID:</th><td>%d(rid)</td></tr> } @ <tr><th>Original User:</th><td> hyperlink_to_user(zUser, zDate, "</td></tr>"); if( g.perm.Hyperlink ){ @ <tr><th>Commands:</th> @ <td> @ &z(href("%R/whistory?name=%t",zName))history</a> @ | %z(href("%R/artifact/%S",zUuid))raw-text</a> @ </td> @ </tr> } @ </table></p> }else{ style_header("Wiki Information"); rid = 0; ................................................................................ } db_finalize(&q); } /* ** WEBPAGE: vdiff ** URL: /vdiff?from=UUID&to=UUID&detail=BOOLEAN;sbs=BOOLEAN ** ** Show all differences between two checkins. */ void vdiff_page(void){ int ridFrom, ridTo; int showDetail = 0; int sideBySide = 0; ................................................................................ if( mPerm==PERM_LNK ){ @ <li>Symbolic link }else if( mPerm==PERM_EXE ){ @ <li>Executable file }else{ @ <li>File } @ %z(href("%R/finfo?name=%T",zName))%h(zName)</a> @ <ul> prevName = fossil_strdup(zName); } @ <li> hyperlink_to_date(zDate,""); @ - part of checkin hyperlink_to_uuid(zVers); if( zBr && zBr[0] ){ @ on branch %z(href("%R/timeline?r=%T",zBr))%h(zBr)</a> } @ - %w(zCom) (user: hyperlink_to_user(zUser,zDate,""); @ ) if( g.perm.Hyperlink ){ @ %z(href("%R/annotate?checkin=%S&filename=%T",zVers,zName)) @ [annotate]</a> } cnt++; if( pDownloadName && blob_size(pDownloadName)==0 ){ blob_append(pDownloadName, zName, -1); } } ................................................................................ const char *zDate = db_column_text(&q, 1); const char *zUser = db_column_text(&q, 2); if( cnt>0 ){ @ Also wiki page }else{ @ Wiki page } @ [%z(href("%R/wiki?name=%t",zPagename))%h(zPagename)</a>] by hyperlink_to_user(zUser,zDate," on"); hyperlink_to_date(zDate,"."); nWiki++; cnt++; if( pDownloadName && blob_size(pDownloadName)==0 ){ blob_appendf(pDownloadName, "%s.wiki", zPagename); } ................................................................................ /* const char *zSrc = db_column_text(&q, 4); */ if( cnt>0 ){ @ Also attachment "%h(zFilename)" to }else{ @ Attachment "%h(zFilename)" to } if( strlen(zTarget)==UUID_SIZE && validate16(zTarget,UUID_SIZE) ){ if( g.perm.Hyperlink && g.perm.RdTkt ){ @ ticket [%z(href("%R/tktview?name=%S",zTarget))%S(zTarget)</a>] }else{ @ ticket [%S(zTarget)] } }else{ if( g.perm.Hyperlink && g.perm.RdWiki ){ @ wiki page [%z(href("%R/wiki?name=%t",zTarget)))%h(zTarget)</a>] }else{ @ wiki page [%h(zTarget)] } } @ added by hyperlink_to_user(zUser,zDate," on"); hyperlink_to_date(zDate,"."); ................................................................................ } db_finalize(&q); if( cnt==0 ){ @ Control artifact. if( pDownloadName && blob_size(pDownloadName)==0 ){ blob_appendf(pDownloadName, "%.10s.txt", zUuid); } }else if( linkToView && g.perm.Hyperlink ){ @ %z(href("%R/artifact/%S",zUuid))[view]</a> } } /* ** WEBPAGE: fdiff ** URL: fdiff?v1=UUID&v2=UUID&patch&sbs=BOOLEAN ................................................................................ style_submenu_element("Unified Diff", "udiff", "%s/fdiff?v1=%T&v2=%T&sbs=0", g.zTop, P("v1"), P("v2")); } if( P("smhdr")!=0 ){ @ <h2>Differences From Artifact @ %z(href("%R/artifact/%S",zV1))[%S(zV1)]</a> To @ %z(href("%R/artifact/%S",zV2))[%S(zV2)]</a>.</h2> }else{ @ <h2>Differences From @ Artifact %z(href("%R/artifact/%S",zV1))[%S(zV1)]</a>:</h2> object_description(v1, 0, 0); @ <h2>To Artifact %z(href("%R/artifact/%S",zV2))[%S(zV2)]</a>:</h2> object_description(v2, 0, 0); } @ <hr /> @ <div class="%s(zStyle)"> @ %s(blob_str(&diff)) @ </div> blob_reset(&diff); ................................................................................ rid = name_to_rid_www("name"); login_check_credentials(); if( !g.perm.Read ){ login_needed(); return; } if( rid==0 ) fossil_redirect_home(); if( g.perm.Admin ){ const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid); if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){ style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&sub=1", g.zTop, zUuid); }else{ style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun", g.zTop, zUuid); } } style_header("Hex Artifact Content"); ................................................................................ login_check_credentials(); if( !g.perm.Read ){ login_needed(); return; } if( rid==0 ) fossil_redirect_home(); if( g.perm.Admin ){ const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid); if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){ style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&sub=1", g.zTop, zUuid); }else{ style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun", g.zTop, zUuid); } } style_header("Artifact Content"); ................................................................................ output_text_with_line_numbers(z, zLn); }else{ @ <pre> @ %h(z) @ </pre> } }else if( strncmp(zMime, "image/", 6)==0 ){ @ <img src="%s(g.zTop)/raw?name=%s(zUuid)&m=%s(zMime)"></img> }else{ @ <i>(file is %d(blob_size(&content)) bytes of binary data)</i> } @ </blockquote> } style_footer(); } ................................................................................ login_check_credentials(); if( !g.perm.RdTkt ){ login_needed(); return; } rid = name_to_rid_www("name"); if( rid==0 ){ fossil_redirect_home(); } zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid); if( g.perm.Admin ){ if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){ style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&sub=1", g.zTop, zUuid); }else{ style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun", g.zTop, zUuid); } } pTktChng = manifest_get(rid, CFTYPE_TICKET); ................................................................................ if( pTktChng==0 ){ fossil_redirect_home(); } style_header("Ticket Change Details"); zDate = db_text(0, "SELECT datetime(%.12f)", pTktChng->rDate); memcpy(zTktName, pTktChng->zTicketUuid, 10); zTktName[10] = 0; if( g.perm.Hyperlink ){ @ <h2>Changes to ticket @ %z(href("%R/tktview/%s",pTktChng->zTicketUuid)))%s(zTktName)</a></h2> @ @ <p>By %h(pTktChng->zUser) on %s(zDate). See also: @ %z(href("%R/artifact/%T",zUuid))artifact content</a>, and @ %z(href("%R/tkthistory/%s",pTktChng->zTicketUuid))ticket history</a></p> }else{ @ <h2>Changes to ticket %s(zTktName)</h2> @ @ <p>By %h(pTktChng->zUser) on %s(zDate). @ </p> } @ ................................................................................ @ %s(blob_str(&suffix)) @ </td></tr></table> @ </blockquote> @ <hr /> blob_reset(&suffix); } @ <p>Make changes to attributes of check-in @ [%z(href("%R/ci/%s",zUuid))%s(zUuid)</a>]:</p> @ <form action="%s(g.zTop)/ci_edit" method="post"><div> login_insert_csrf_secret(); @ <input type="hidden" name="r" value="%S(zUuid)" /> @ <table border="0" cellspacing="10"> @ <tr><td align="right" valign="top"><b>User:</b></td> @ <td valign="top"> |
Changes to src/json_dir.c.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
char const * zDX = NULL;
int nD;
char * zUuid = NULL;
char const * zCI = NULL;
Manifest * pM = NULL;
Stmt q = empty_Stmt;
int rid = 0;
if( !g.perm.History ){
json_set_err(FSL_JSON_E_DENIED, "Requires 'h' permissions.");
return NULL;
}
zCI = json_find_option_cstr("checkin",NULL,"ci" );
/* If a specific check-in is requested, fetch and parse it. If the
** specific check-in does not exist, clear zCI. zCI==0 will cause all
|
| |
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
char const * zDX = NULL;
int nD;
char * zUuid = NULL;
char const * zCI = NULL;
Manifest * pM = NULL;
Stmt q = empty_Stmt;
int rid = 0;
if( !g.perm.Hyperlink ){
json_set_err(FSL_JSON_E_DENIED, "Requires 'h' permissions.");
return NULL;
}
zCI = json_find_option_cstr("checkin",NULL,"ci" );
/* If a specific check-in is requested, fetch and parse it. If the
** specific check-in does not exist, clear zCI. zCI==0 will cause all
|
Changes to src/json_timeline.c.
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
...
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
|
*/ cson_value * json_page_timeline(){ #if 0 /* The original timeline code does not require 'h' access, but it arguably should. For JSON mode i think one could argue that History permissions are required. */ if(! g.perm.History && !g.perm.Read ){ json_set_err(FSL_JSON_E_DENIED, "Timeline requires 'h' or 'o' access."); return NULL; } #endif return json_page_dispatch_helper(&JsonPageDefs_Timeline[0]); } ................................................................................ cson_value * listV = NULL; cson_array * list = NULL; int check = 0; char showFiles = -1/*magic number*/; Stmt q = empty_Stmt; char warnRowToJsonFailed = 0; Blob sql = empty_blob; if( !g.perm.History ){ /* Reminder to self: HTML impl requires 'o' (Read) rights. */ json_set_err( FSL_JSON_E_DENIED, "Checkin timeline requires 'h' access." ); return NULL; } showFiles = json_find_option_bool("files",NULL,"f",0); |
|
|
|
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
...
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
|
*/ cson_value * json_page_timeline(){ #if 0 /* The original timeline code does not require 'h' access, but it arguably should. For JSON mode i think one could argue that History permissions are required. */ if(! g.perm.Hyperlink && !g.perm.Read ){ json_set_err(FSL_JSON_E_DENIED, "Timeline requires 'h' or 'o' access."); return NULL; } #endif return json_page_dispatch_helper(&JsonPageDefs_Timeline[0]); } ................................................................................ cson_value * listV = NULL; cson_array * list = NULL; int check = 0; char showFiles = -1/*magic number*/; Stmt q = empty_Stmt; char warnRowToJsonFailed = 0; Blob sql = empty_blob; if( !g.perm.Hyperlink ){ /* Reminder to self: HTML impl requires 'o' (Read) rights. */ json_set_err( FSL_JSON_E_DENIED, "Checkin timeline requires 'h' access." ); return NULL; } showFiles = json_find_option_bool("files",NULL,"f",0); |
Changes to src/json_wiki.c.
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 |
int argPos = g.json.dispatchDepth;
int r1 = 0, r2 = 0;
Manifest * pW1 = NULL, *pW2 = NULL;
Blob w1 = empty_blob, w2 = empty_blob, d = empty_blob;
char const * zErrTag = NULL;
int diffFlags;
char * zUuid = NULL;
if( !g.perm.History ){
json_set_err(FSL_JSON_E_DENIED,
"Requires 'h' permissions.");
return NULL;
}
zV1 = json_find_option_cstr2( "v1",NULL, NULL, ++argPos );
|
| |
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 |
int argPos = g.json.dispatchDepth;
int r1 = 0, r2 = 0;
Manifest * pW1 = NULL, *pW2 = NULL;
Blob w1 = empty_blob, w2 = empty_blob, d = empty_blob;
char const * zErrTag = NULL;
int diffFlags;
char * zUuid = NULL;
if( !g.perm.Hyperlink ){
json_set_err(FSL_JSON_E_DENIED,
"Requires 'h' permissions.");
return NULL;
}
zV1 = json_find_option_cstr2( "v1",NULL, NULL, ++argPos );
|
Changes to src/login.c.
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 ... 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 ... 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 .... 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 .... 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 |
*/ login_set_user_cookie(zUsername, uid, NULL); redirect_to_g(); } } style_header("Login/Logout"); @ %s(zErrMsg) if( zGoto ){ @ <p>A login is required for <a href="%h(zGoto)">%h(zGoto)</a>.</p> } @ <form action="login" method="post"> if( zGoto ){ @ <input type="hidden" name="g" value="%h(zGoto)" /> } @ <table class="login_out"> ................................................................................ if( fossil_strcmp(g.zLogin,"nobody")==0 ){ g.zLogin = 0; } /* Set the capabilities */ login_replace_capabilities(zCap, 0); login_set_anon_nobody_capabilities(); if( zCap[0] && !g.perm.History && db_get_boolean("auto-enable-hyperlinks",1) && isHuman(P("HTTP_USER_AGENT")) ){ g.perm.History = 1; } /* If the public-pages glob pattern is defined and REQUEST_URI matches ** one of the globs in public-pages, then also add in all default-perms ** permissions. */ zPublicPages = db_get("public-pages",0); ................................................................................ if(NULL==zCap){ return; } for(i=0; zCap[i]; i++){ switch( zCap[i] ){ case 's': g.perm.Setup = 1; /* Fall thru into Admin */ case 'a': g.perm.Admin = g.perm.RdTkt = g.perm.WrTkt = g.perm.Zip = g.perm.RdWiki = g.perm.WrWiki = g.perm.NewWiki = g.perm.ApndWiki = g.perm.History = g.perm.Clone = g.perm.NewTkt = g.perm.Password = g.perm.RdAddr = g.perm.TktFmt = g.perm.Attach = g.perm.ApndTkt = 1; /* Fall thru into Read/Write */ case 'i': g.perm.Read = g.perm.Write = 1; break; case 'o': g.perm.Read = 1; break; case 'z': g.perm.Zip = 1; break; case 'd': g.perm.Delete = 1; break; case 'h': g.perm.History = 1; break; case 'g': g.perm.Clone = 1; break; case 'p': g.perm.Password = 1; break; case 'j': g.perm.RdWiki = 1; break; case 'k': g.perm.WrWiki = g.perm.RdWiki = g.perm.ApndWiki =1; break; case 'm': g.perm.ApndWiki = 1; break; case 'f': g.perm.NewWiki = 1; break; ................................................................................ case 'a': rc = g.perm.Admin; break; case 'b': rc = g.perm.Attach; break; case 'c': rc = g.perm.ApndTkt; break; case 'd': rc = g.perm.Delete; break; case 'e': rc = g.perm.RdAddr; break; case 'f': rc = g.perm.NewWiki; break; case 'g': rc = g.perm.Clone; break; case 'h': rc = g.perm.History; break; case 'i': rc = g.perm.Write; break; case 'j': rc = g.perm.RdWiki; break; case 'k': rc = g.perm.WrWiki; break; /* case 'l': */ case 'm': rc = g.perm.ApndWiki; break; case 'n': rc = g.perm.NewTkt; break; case 'o': rc = g.perm.Read; break; case 'p': rc = g.perm.Password; break; /* case 'q': */ case 'r': rc = g.perm.RdTkt; break; case 's': rc = g.perm.Setup; break; ................................................................................ cgi_redirect(mprintf("login?g=%T", zUrl)); /* NOTREACHED */ assert(0); } } /* ** Call this routine if the user lacks okHistory permission. If ** the anonymous user has okHistory permission, then paint a mesage ** to inform the user that much more information is available by ** logging in as anonymous. */ void login_anonymous_available(void){ if( !g.perm.History && db_exists("SELECT 1 FROM user" " WHERE login='anonymous'" " AND cap LIKE '%%h%%'") ){ const char *zUrl = PD("REQUEST_URI", "index"); @ <p>Many <span class="disabled">hyperlinks are disabled.</span><br /> @ Use <a href="%s(g.zTop)/login?anon=1&g=%T(zUrl)">anonymous login</a> @ to enable hyperlinks.</p> } } /* ** While rendering a form, call this routine to add the Anti-CSRF token ** as a hidden element of the form. |
| > | | > | | | | | | | < | | | | |
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 ... 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 ... 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 .... 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 .... 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 |
*/ login_set_user_cookie(zUsername, uid, NULL); redirect_to_g(); } } style_header("Login/Logout"); @ %s(zErrMsg) if( zGoto && P("anon")==0 ){ @ <p>A login is required for <a href="%h(zGoto)">%h(zGoto)</a>.</p> } @ <form action="login" method="post"> if( zGoto ){ @ <input type="hidden" name="g" value="%h(zGoto)" /> } @ <table class="login_out"> ................................................................................ if( fossil_strcmp(g.zLogin,"nobody")==0 ){ g.zLogin = 0; } /* Set the capabilities */ login_replace_capabilities(zCap, 0); login_set_anon_nobody_capabilities(); if( zCap[0] && !g.perm.Hyperlink && db_get_boolean("auto-enable-hyperlinks",1) && isHuman(P("HTTP_USER_AGENT")) ){ g.perm.Hyperlink = 1; g.javascriptHyperlink = 1; } /* If the public-pages glob pattern is defined and REQUEST_URI matches ** one of the globs in public-pages, then also add in all default-perms ** permissions. */ zPublicPages = db_get("public-pages",0); ................................................................................ if(NULL==zCap){ return; } for(i=0; zCap[i]; i++){ switch( zCap[i] ){ case 's': g.perm.Setup = 1; /* Fall thru into Admin */ case 'a': g.perm.Admin = g.perm.RdTkt = g.perm.WrTkt = g.perm.Zip = g.perm.RdWiki = g.perm.WrWiki = g.perm.NewWiki = g.perm.ApndWiki = g.perm.Hyperlink = g.perm.Clone = g.perm.NewTkt = g.perm.Password = g.perm.RdAddr = g.perm.TktFmt = g.perm.Attach = g.perm.ApndTkt = 1; /* Fall thru into Read/Write */ case 'i': g.perm.Read = g.perm.Write = 1; break; case 'o': g.perm.Read = 1; break; case 'z': g.perm.Zip = 1; break; case 'd': g.perm.Delete = 1; break; case 'h': g.perm.Hyperlink = 1; break; case 'g': g.perm.Clone = 1; break; case 'p': g.perm.Password = 1; break; case 'j': g.perm.RdWiki = 1; break; case 'k': g.perm.WrWiki = g.perm.RdWiki = g.perm.ApndWiki =1; break; case 'm': g.perm.ApndWiki = 1; break; case 'f': g.perm.NewWiki = 1; break; ................................................................................ case 'a': rc = g.perm.Admin; break; case 'b': rc = g.perm.Attach; break; case 'c': rc = g.perm.ApndTkt; break; case 'd': rc = g.perm.Delete; break; case 'e': rc = g.perm.RdAddr; break; case 'f': rc = g.perm.NewWiki; break; case 'g': rc = g.perm.Clone; break; case 'h': rc = g.perm.Hyperlink; break; case 'i': rc = g.perm.Write; break; case 'j': rc = g.perm.RdWiki; break; case 'k': rc = g.perm.WrWiki; break; case 'm': rc = g.perm.ApndWiki; break; case 'n': rc = g.perm.NewTkt; break; case 'o': rc = g.perm.Read; break; case 'p': rc = g.perm.Password; break; /* case 'q': */ case 'r': rc = g.perm.RdTkt; break; case 's': rc = g.perm.Setup; break; ................................................................................ cgi_redirect(mprintf("login?g=%T", zUrl)); /* NOTREACHED */ assert(0); } } /* ** Call this routine if the user lacks g.perm.Hyperlink permission. If ** the anonymous user has Hyperlink permission, then paint a mesage ** to inform the user that much more information is available by ** logging in as anonymous. */ void login_anonymous_available(void){ if( !g.perm.Hyperlink && db_exists("SELECT 1 FROM user" " WHERE login='anonymous'" " AND cap LIKE '%%h%%'") ){ const char *zUrl = PD("REQUEST_URI", "index"); @ <p>Many <span class="disabled">hyperlinks are disabled.</span><br /> @ Use <a href="%s(g.zTop)/login?anon=1&g=%T(zUrl)">anonymous login</a> @ to enable hyperlinks.</p> } } /* ** While rendering a form, call this routine to add the Anti-CSRF token ** as a hidden element of the form. |
Changes to src/main.c.
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
...
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
char Setup; /* s: use Setup screens on web interface */ char Admin; /* a: administrative permission */ char Delete; /* d: delete wiki or tickets */ char Password; /* p: change password */ char Query; /* q: create new reports */ char Write; /* i: xfer inbound. checkin */ char Read; /* o: xfer outbound. checkout */ char History; /* h: access historical information. */ char Clone; /* g: clone */ char RdWiki; /* j: view wiki via web */ char NewWiki; /* f: create new wiki via web */ char ApndWiki; /* m: append to wiki via web */ char WrWiki; /* k: edit wiki via web */ char RdTkt; /* r: view tickets via web */ char NewTkt; /* n: create new tickets */ ................................................................................ FILE *httpIn; /* Accept HTTP input from here */ FILE *httpOut; /* Send HTTP output here */ int xlinkClusterOnly; /* Set when cloning. Only process clusters */ int fTimeFormat; /* 1 for UTC. 2 for localtime. 0 not yet selected */ int *aCommitFile; /* Array of files to be committed */ int markPrivate; /* All new artifacts are private if true */ int clockSkewSeen; /* True if clocks on client and server out of sync */ int isHTTP; /* True if running in server/CGI modes, else assume CLI. */ int urlIsFile; /* True if a "file:" url */ int urlIsHttps; /* True if a "https:" url */ int urlIsSsh; /* True if an "ssh:" url */ char *urlName; /* Hostname for http: or filename for file: */ char *urlHostname; /* The HOST: parameter on http headers */ char *urlProtocol; /* "http" or "https" */ |
|
|
>
|
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
...
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
char Setup; /* s: use Setup screens on web interface */ char Admin; /* a: administrative permission */ char Delete; /* d: delete wiki or tickets */ char Password; /* p: change password */ char Query; /* q: create new reports */ char Write; /* i: xfer inbound. checkin */ char Read; /* o: xfer outbound. checkout */ char Hyperlink; /* h: enable the display of hyperlinks */ char Clone; /* g: clone */ char RdWiki; /* j: view wiki via web */ char NewWiki; /* f: create new wiki via web */ char ApndWiki; /* m: append to wiki via web */ char WrWiki; /* k: edit wiki via web */ char RdTkt; /* r: view tickets via web */ char NewTkt; /* n: create new tickets */ ................................................................................ FILE *httpIn; /* Accept HTTP input from here */ FILE *httpOut; /* Send HTTP output here */ int xlinkClusterOnly; /* Set when cloning. Only process clusters */ int fTimeFormat; /* 1 for UTC. 2 for localtime. 0 not yet selected */ int *aCommitFile; /* Array of files to be committed */ int markPrivate; /* All new artifacts are private if true */ int clockSkewSeen; /* True if clocks on client and server out of sync */ char isHTTP; /* True if erver/CGI modes, else assume CLI. */ char javascriptHyperlink; /* If true, set href= using script, not HTML */ int urlIsFile; /* True if a "file:" url */ int urlIsHttps; /* True if a "https:" url */ int urlIsSsh; /* True if an "ssh:" url */ char *urlName; /* Hostname for http: or filename for file: */ char *urlHostname; /* The HOST: parameter on http headers */ char *urlProtocol; /* "http" or "https" */ |
Changes to src/printf.c.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 .. 91 92 93 94 95 96 97 98 99 100 101 102 103 104 ... 568 569 570 571 572 573 574 575 576 577 578 579 580 581 |
#define etHTTPIZE 17 /* Make text safe for HTTP. "/" encoded as %2f */ #define etURLIZE 18 /* Make text safe for HTTP. "/" not encoded */ #define etFOSSILIZE 19 /* The fossil header encoding format. */ #define etPATH 20 /* Path type */ #define etWIKISTR 21 /* Wiki text rendered from a char*: %w */ #define etWIKIBLOB 22 /* Wiki text rendered from a Blob*: %W */ #define etSTRINGID 23 /* String with length limit for a UUID prefix: %S */ /* ** An "etByte" is an 8-bit unsigned value. */ typedef unsigned char etByte; ................................................................................ { 'q', 0, 4, etSQLESCAPE, 0, 0 }, { 'Q', 0, 4, etSQLESCAPE2, 0, 0 }, { 'b', 0, 2, etBLOB, 0, 0 }, { 'B', 0, 2, etBLOBSQL, 0, 0 }, { 'w', 0, 2, etWIKISTR, 0, 0 }, { 'W', 0, 2, etWIKIBLOB, 0, 0 }, { 'h', 0, 4, etHTMLIZE, 0, 0 }, { 't', 0, 4, etHTTPIZE, 0, 0 }, /* "/" -> "%2F" */ { 'T', 0, 4, etURLIZE, 0, 0 }, /* "/" unchanged */ { 'F', 0, 4, etFOSSILIZE, 0, 0 }, { 'S', 0, 4, etSTRINGID, 0, 0 }, { 'c', 0, 0, etCHARX, 0, 0 }, { 'o', 8, 0, etRADIX, 0, 2 }, { 'u', 10, 0, etRADIX, 0, 0 }, ................................................................................ bufpt[i]='/'; }else{ bufpt[i]=e[i]; } } bufpt[length]='\0'; break; } case etSTRINGID: { precision = 16; /* Fall through */ } case etSTRING: case etDYNSTRING: { |
> > > > > > > |
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 .. 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 ... 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 |
#define etHTTPIZE 17 /* Make text safe for HTTP. "/" encoded as %2f */ #define etURLIZE 18 /* Make text safe for HTTP. "/" not encoded */ #define etFOSSILIZE 19 /* The fossil header encoding format. */ #define etPATH 20 /* Path type */ #define etWIKISTR 21 /* Wiki text rendered from a char*: %w */ #define etWIKIBLOB 22 /* Wiki text rendered from a Blob*: %W */ #define etSTRINGID 23 /* String with length limit for a UUID prefix: %S */ #define etROOT 24 /* String value of g.zTop: % */ /* ** An "etByte" is an 8-bit unsigned value. */ typedef unsigned char etByte; ................................................................................ { 'q', 0, 4, etSQLESCAPE, 0, 0 }, { 'Q', 0, 4, etSQLESCAPE2, 0, 0 }, { 'b', 0, 2, etBLOB, 0, 0 }, { 'B', 0, 2, etBLOBSQL, 0, 0 }, { 'w', 0, 2, etWIKISTR, 0, 0 }, { 'W', 0, 2, etWIKIBLOB, 0, 0 }, { 'h', 0, 4, etHTMLIZE, 0, 0 }, { 'R', 0, 0, etROOT, 0, 0 }, { 't', 0, 4, etHTTPIZE, 0, 0 }, /* "/" -> "%2F" */ { 'T', 0, 4, etURLIZE, 0, 0 }, /* "/" unchanged */ { 'F', 0, 4, etFOSSILIZE, 0, 0 }, { 'S', 0, 4, etSTRINGID, 0, 0 }, { 'c', 0, 0, etCHARX, 0, 0 }, { 'o', 8, 0, etRADIX, 0, 2 }, { 'u', 10, 0, etRADIX, 0, 0 }, ................................................................................ bufpt[i]='/'; }else{ bufpt[i]=e[i]; } } bufpt[length]='\0'; break; } case etROOT: { bufpt = g.zTop; length = (int)strlen(bufpt); break; } case etSTRINGID: { precision = 16; /* Fall through */ } case etSTRING: case etDYNSTRING: { |
Changes to src/report.c.
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 ... 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 ... 718 719 720 721 722 723 724 725 726 727 728 729 730 731 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 ... 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 |
} rn = db_column_int(&q, 0); cnt++; blob_appendf(&ril, "<li>"); if( zTitle[0] == '_' ){ blob_appendf(&ril, "%s", zTitle); } else { blob_appendf(&ril, "<a href=\"rptview?rn=%d\" rel=\"nofollow\">%h</a>", rn, zTitle); } blob_appendf(&ril, " "); if( g.perm.Write && zOwner && zOwner[0] ){ blob_appendf(&ril, "(by <i>%h</i></i>) ", zOwner); } if( g.perm.TktFmt ){ blob_appendf(&ril, "[<a href=\"rptedit?rn=%d&copy=1\" rel=\"nofollow\">copy</a>] ", rn); } if( g.perm.Admin || (g.perm.WrTkt && zOwner && fossil_strcmp(g.zLogin,zOwner)==0) ){ blob_appendf(&ril, "[<a href=\"rptedit?rn=%d\" rel=\"nofollow\">edit</a>] ", rn); } if( g.perm.TktFmt ){ blob_appendf(&ril, "[<a href=\"rptsql?rn=%d\" rel=\"nofollow\">sql</a>] ", rn); } blob_appendf(&ril, "</li>\n"); } Th_Store("report_items", blob_str(&ril)); Th_Render(zScript); ................................................................................ zTitle = mprintf("Copy Of %s", zTitle); zOwner = g.zLogin; } } if( zOwner==0 ) zOwner = g.zLogin; style_submenu_element("Cancel", "Cancel", "reportlist"); if( rn>0 ){ style_submenu_element("Delete", "Delete", "rptedit?rn=%d&del1=1", rn); } style_header(rn>0 ? "Edit Report Format":"Create New Report Format"); if( zErr ){ @ <blockquote class="reportError">%h(zErr)</blockquote> } @ <form action="rptedit" method="post"><div> @ <input type="hidden" name="rn" value="%d(rn)" /> ................................................................................ for(i=0; i<nArg; i++){ char *zData; if( i==pState->iBg ) continue; zData = azArg[i]; if( zData==0 ) zData = ""; if( pState->iNewRow>=0 && i>=pState->iNewRow ){ if( zTid && g.perm.Write ){ @ <td valign="top"><a href="tktedit/%h(zTid)">edit</a></td> zTid = 0; } if( zData[0] ){ Blob content; @ </tr><tr style="background-color:%h(zBg)"><td colspan=%d(pState->nCol)> blob_init(&content, zData, -1); wiki_convert(&content, 0, 0); blob_reset(&content); } }else if( azName[i][0]=='#' ){ zTid = zData; if( g.perm.History ){ @ <td valign="top"><a href="tktview?name=%h(zData)">%h(zData)</a></td> }else{ @ <td valign="top">%h(zData)</td> } }else if( zData[0]==0 ){ @ <td valign="top"> </td> }else{ @ <td valign="top"> @ %h(zData) @ </td> } } if( zTid && g.perm.Write ){ @ <td valign="top"><a href="tktedit/%h(zTid)">edit</a></td> } @ </tr> return 0; } /* ** Output the text given in the argument. Convert tabs and newlines into ................................................................................ count = 0; if( !tabs ){ struct GenerateHTML sState; db_multi_exec("PRAGMA empty_result_callbacks=ON"); style_submenu_element("Raw", "Raw", "rptview?tablist=1&%h", PD("QUERY_STRING","")); if( g.perm.Admin || (g.perm.TktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){ style_submenu_element("Edit", "Edit", "rptedit?rn=%d", rn); } if( g.perm.TktFmt ){ style_submenu_element("SQL", "SQL", "rptsql?rn=%d",rn); } |
| | > | > | > | | < < < | < | | |
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 ... 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 ... 721 722 723 724 725 726 727 728 729 730 731 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 ... 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 |
} rn = db_column_int(&q, 0); cnt++; blob_appendf(&ril, "<li>"); if( zTitle[0] == '_' ){ blob_appendf(&ril, "%s", zTitle); } else { blob_appendf(&ril, "%z%h</a>", href("%R/rptview?rn=%d", rn), zTitle); } blob_appendf(&ril, " "); if( g.perm.Write && zOwner && zOwner[0] ){ blob_appendf(&ril, "(by <i>%h</i></i>) ", zOwner); } if( g.perm.TktFmt ){ blob_appendf(&ril, "[%zcopy</a>] ", href("%R/rptedit?rn=%d©=1", rn)); } if( g.perm.Admin || (g.perm.WrTkt && zOwner && fossil_strcmp(g.zLogin,zOwner)==0) ){ blob_appendf(&ril, "[%zedit</a>]", href("%R/rptedit?rn=%d", rn)); } if( g.perm.TktFmt ){ blob_appendf(&ril, "[%zsql</a>]", href("%R/rptsql?rn=%d", rn)); } blob_appendf(&ril, "</li>\n"); } Th_Store("report_items", blob_str(&ril)); Th_Render(zScript); ................................................................................ zTitle = mprintf("Copy Of %s", zTitle); zOwner = g.zLogin; } } if( zOwner==0 ) zOwner = g.zLogin; style_submenu_element("Cancel", "Cancel", "reportlist"); if( rn>0 ){ style_submenu_element("Delete", "Delete", "rptedit?rn=%d&del1=1", rn); } style_header(rn>0 ? "Edit Report Format":"Create New Report Format"); if( zErr ){ @ <blockquote class="reportError">%h(zErr)</blockquote> } @ <form action="rptedit" method="post"><div> @ <input type="hidden" name="rn" value="%d(rn)" /> ................................................................................ for(i=0; i<nArg; i++){ char *zData; if( i==pState->iBg ) continue; zData = azArg[i]; if( zData==0 ) zData = ""; 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><tr style="background-color:%h(zBg)"><td colspan=%d(pState->nCol)> blob_init(&content, zData, -1); wiki_convert(&content, 0, 0); blob_reset(&content); } }else if( azName[i][0]=='#' ){ zTid = zData; @ <td valign="top">%z(href("%R/tktview?name=%h",zData))%h(zData)</a></td> }else if( zData[0]==0 ){ @ <td valign="top"> </td> }else{ @ <td valign="top"> @ %h(zData) @ </td> } } if( zTid && g.perm.Write ){ @ <td valign="top">%z(href("%R/tktedit/%h",zTid))edit</a></td> } @ </tr> return 0; } /* ** Output the text given in the argument. Convert tabs and newlines into ................................................................................ count = 0; if( !tabs ){ struct GenerateHTML sState; db_multi_exec("PRAGMA empty_result_callbacks=ON"); style_submenu_element("Raw", "Raw", "rptview?tablist=1&%h", PD("QUERY_STRING","")); if( g.perm.Admin || (g.perm.TktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){ style_submenu_element("Edit", "Edit", "rptedit?rn=%d", rn); } if( g.perm.TktFmt ){ style_submenu_element("SQL", "SQL", "rptsql?rn=%d",rn); } |
Changes to src/setup.c.
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 ... 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 ... 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 ... 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 |
} @ <input type="checkbox" name="aa"%s(oaa) />%s(B('a'))Admin<br /> @ <input type="checkbox" name="ad"%s(oad) />%s(B('d'))Delete<br /> @ <input type="checkbox" name="ae"%s(oae) />%s(B('e'))Email<br /> @ <input type="checkbox" name="ap"%s(oap) />%s(B('p'))Password<br /> @ <input type="checkbox" name="ai"%s(oai) />%s(B('i'))Check-In<br /> @ <input type="checkbox" name="ao"%s(oao) />%s(B('o'))Check-Out<br /> @ <input type="checkbox" name="ah"%s(oah) />%s(B('h'))History<br /> @ <input type="checkbox" name="au"%s(oau) />%s(B('u'))Reader<br /> @ <input type="checkbox" name="av"%s(oav) />%s(B('v'))Developer<br /> @ <input type="checkbox" name="ag"%s(oag) />%s(B('g'))Clone<br /> @ <input type="checkbox" name="aj"%s(oaj) />%s(B('j'))Read Wiki<br /> @ <input type="checkbox" name="af"%s(oaf) />%s(B('f'))New Wiki<br /> @ <input type="checkbox" name="am"%s(oam) />%s(B('m'))Append Wiki<br /> @ <input type="checkbox" name="ak"%s(oak) />%s(B('k'))Write Wiki<br /> ................................................................................ @ by anonymous users. This capability is intended for deletion of spam. @ The delete capability is only in effect for 24 hours after the item @ is first posted. The <span class="usertype">Setup</span> user can @ delete anything at any time. @ </p></li> @ @ <li><p> @ The <span class="capability">History</span> privilege allows a user @ to see most hyperlinks. This is recommended ON for most logged-in users @ but OFF for user "nobody" to avoid problems with spiders trying to walk @ every historical version of every baseline and file. @ </p></li> @ @ <li><p> @ The <span class="capability">Zip</span> privilege allows a user to @ see the "download as ZIP" @ hyperlink and permits access to the <tt>/zip</tt> page. This allows @ users to download ZIP archives without granting other rights like @ <span class="capability">Read</span> or @ <span class="capability">History</span>. This privilege is recommended for @ user <span class="usertype">nobody</span> so that automatic package @ downloaders can obtain the sources without going through the login @ procedure. @ </p></li> @ @ <li><p> @ The <span class="capability">Check-in</span> privilege allows remote @ users to "push". The <span class="capability">Check-out</span> privilege ................................................................................ @ capabilities of the <span class="usertype">nobody</span> user are @ inherited by all users, regardless of whether or not they are logged in. @ To disable universal access to the repository, make sure no user named @ <span class="usertype">nobody</span> exists or that the @ <span class="usertype">nobody</span> user has no capabilities @ enabled. The password for <span class="usertype">nobody</span> is ignore. @ To avoid problems with spiders overloading the server, it is recommended @ that the <span class="capability">h</span> (History) capability be turned @ off for the <span class="usertype">nobody</span> user. @ </p></li> @ @ <li><p> @ Login is required for user <span class="usertype">anonymous</span> but the @ password is displayed on the login screen beside the password entry box @ so anybody who can read should be able to login as anonymous. @ On the other hand, spiders and web-crawlers will typically not ................................................................................ @ <p>Fossil tries to limit out-bound sync, clone, and pull packets @ to this many bytes, uncompressed. If the client requires more data @ than this, then the client will issue multiple HTTP requests. @ Values below 1 million are not recommended. 5 million is a @ reasonable number.</p> @ <hr /> onoff_attribute("Enable hyperlinks for \"nobody\" based on User-Agent", "auto-enable-hyperlinks", "autohyperlink", 1); @ <p>Enable hyperlinks (the equivalent of the "h" permission) for all users @ including user "nobody", as long as the User-Agent string in the HTTP header @ indicates that the request is coming from an actual human being and not a @ a robot or script. Note: Bots can specify whatever User-Agent string they @ that want. So a bot that wants to impersonate a human can easily do so. @ Hence, this technique does not necessarily exclude malicious bots. @ </p> @ <hr /> entry_attribute("Public pages", 30, "public-pages", "pubpage", ""); @ <p>A comma-separated list of glob patterns for pages that are accessible @ without needing a login and using the privileges given by the @ "Default privileges" setting below. Example use case: Set this field |
| | | | | | | > | | | | > > | < < < > > > > > > > > |
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 ... 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 ... 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 ... 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 |
} @ <input type="checkbox" name="aa"%s(oaa) />%s(B('a'))Admin<br /> @ <input type="checkbox" name="ad"%s(oad) />%s(B('d'))Delete<br /> @ <input type="checkbox" name="ae"%s(oae) />%s(B('e'))Email<br /> @ <input type="checkbox" name="ap"%s(oap) />%s(B('p'))Password<br /> @ <input type="checkbox" name="ai"%s(oai) />%s(B('i'))Check-In<br /> @ <input type="checkbox" name="ao"%s(oao) />%s(B('o'))Check-Out<br /> @ <input type="checkbox" name="ah"%s(oah) />%s(B('h'))Hyperlinks<br /> @ <input type="checkbox" name="au"%s(oau) />%s(B('u'))Reader<br /> @ <input type="checkbox" name="av"%s(oav) />%s(B('v'))Developer<br /> @ <input type="checkbox" name="ag"%s(oag) />%s(B('g'))Clone<br /> @ <input type="checkbox" name="aj"%s(oaj) />%s(B('j'))Read Wiki<br /> @ <input type="checkbox" name="af"%s(oaf) />%s(B('f'))New Wiki<br /> @ <input type="checkbox" name="am"%s(oam) />%s(B('m'))Append Wiki<br /> @ <input type="checkbox" name="ak"%s(oak) />%s(B('k'))Write Wiki<br /> ................................................................................ @ by anonymous users. This capability is intended for deletion of spam. @ The delete capability is only in effect for 24 hours after the item @ is first posted. The <span class="usertype">Setup</span> user can @ delete anything at any time. @ </p></li> @ @ <li><p> @ The <span class="capability">Hyperlinks</span> privilege allows a user @ to see most hyperlinks. This is recommended ON for most logged-in users @ but OFF for user "nobody" to avoid problems with spiders trying to walk @ every diff and annotation of every historical check-in and file. @ </p></li> @ @ <li><p> @ The <span class="capability">Zip</span> privilege allows a user to @ see the "download as ZIP" @ hyperlink and permits access to the <tt>/zip</tt> page. This allows @ users to download ZIP archives without granting other rights like @ <span class="capability">Read</span> or @ <span class="capability">Hyperlink</span>. The "z" privilege is recommended @ for user <span class="usertype">nobody</span> so that automatic package @ downloaders can obtain the sources without going through the login @ procedure. @ </p></li> @ @ <li><p> @ The <span class="capability">Check-in</span> privilege allows remote @ users to "push". The <span class="capability">Check-out</span> privilege ................................................................................ @ capabilities of the <span class="usertype">nobody</span> user are @ inherited by all users, regardless of whether or not they are logged in. @ To disable universal access to the repository, make sure no user named @ <span class="usertype">nobody</span> exists or that the @ <span class="usertype">nobody</span> user has no capabilities @ enabled. The password for <span class="usertype">nobody</span> is ignore. @ To avoid problems with spiders overloading the server, it is recommended @ that the <span class="capability">h</span> (Hyperlinks) capability be @ turned off for the <span class="usertype">nobody</span> user. @ </p></li> @ @ <li><p> @ Login is required for user <span class="usertype">anonymous</span> but the @ password is displayed on the login screen beside the password entry box @ so anybody who can read should be able to login as anonymous. @ On the other hand, spiders and web-crawlers will typically not ................................................................................ @ <p>Fossil tries to limit out-bound sync, clone, and pull packets @ to this many bytes, uncompressed. If the client requires more data @ than this, then the client will issue multiple HTTP requests. @ Values below 1 million are not recommended. 5 million is a @ reasonable number.</p> @ <hr /> onoff_attribute( "Enable hyperlinks for \"nobody\" based on User-Agent and Javascript", "auto-enable-hyperlinks", "autohyperlink", 1); @ <p>Enable hyperlinks (the equivalent of the "h" permission) for all users @ including user "nobody", as long as (1) the User-Agent string in the @ HTTP header indicates that the request is coming from an actual human @ being and not a a robot or spider and (2) the user agent is able to @ run Javascript in order to set the href= attribute of hyperlinks. Bots @ and spiders can specify whatever User-Agent string they that want and @ they can run javascript just like browsers. But most bots don't go to @ that much trouble so this is normally an effective defense.</p> @ @ <p>You do not normally want a bot to walk your entire repository because @ if it does, your server will end up computing diffs and annotations for @ every historical version of every file and creating ZIPs and tarballs of @ every historical check-in, which can use a lot of CPU and bandwidth @ even for relatively small projects.</p> @ <hr /> entry_attribute("Public pages", 30, "public-pages", "pubpage", ""); @ <p>A comma-separated list of glob patterns for pages that are accessible @ without needing a login and using the privileges given by the @ "Default privileges" setting below. Example use case: Set this field |
Changes to src/style.c.
43
44
45
46
47
48
49
50
51
52
53
54
55
56
...
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
static int headerHasBeenGenerated = 0;
/*
** remember, if a sidebox was used
*/
static int sideboxUsed = 0;
/*
** Add a new element to the submenu
*/
void style_submenu_element(
const char *zLabel,
const char *zTitle,
const char *zLink,
................................................................................
/* Render trace log if TH1 tracing is enabled. */
if( g.thTrace ){
cgi_append_content("<span class=\"thTrace\"><hr />\n", -1);
cgi_append_content(blob_str(&g.thLog), blob_size(&g.thLog));
cgi_append_content("</span>\n", -1);
}
}
/*
** Begin a side-box on the right-hand side of a page. The title and
** the width of the box are given as arguments. The width is usually
** a percentage of total screen width.
*/
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
...
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
|
static int headerHasBeenGenerated = 0; /* ** remember, if a sidebox was used */ static int sideboxUsed = 0; /* ** List of hyperlinks that need to be resolved by javascript in ** the footer. */ char **aHref = 0; int nHref = 0; int nHrefAlloc = 0; /* ** Generate and return a anchor tag like this: ** ** <a href="URL"> ** or <a id="ID"> ** ** The form of the anchor tag is determined by the g.javascriptHyperlink ** variable. The href="URL" form is used if g.javascriptHyperlink is false. ** If g.javascriptHyperlink is true then the ** id="ID" form is used and javascript is generated in the footer to cause ** href values to be inserted after the page has loaded. If ** g.perm.History is false, then the <a id="ID"> form is still ** generated but the javascript is not generated so the links never ** activate. ** ** Filling in the href="URL" using javascript is a defense against bots. ** ** The name of this routine is deliberately kept short so that can be ** easily used within @-lines. Example: ** ** @ %z(href("%R/artifact/%s",zUuid))%h(zFN)</a> ** ** Note %z format. The string returned by this function is always ** obtained from fossil_malloc() so rendering it with %z will reclaim ** that memory space. ** ** There are two versions of this routine: href() does a plain hyperlink ** and xhref() adds extra attribute text. */ char *xhref(const char *zExtra, const char *zFormat, ...){ char *zUrl; va_list ap; va_start(ap, zFormat); zUrl = vmprintf(zFormat, ap); va_end(ap); if( g.perm.Hyperlink && !g.javascriptHyperlink ){ return mprintf("<a %s href=\"%z\">", zExtra, zUrl); } if( nHref>=nHrefAlloc ){ nHrefAlloc = nHrefAlloc*2 + 10; aHref = fossil_realloc(aHref, nHrefAlloc*sizeof(aHref[0])); } aHref[nHref++] = zUrl; return mprintf("<a %s id=%d>", zExtra, nHref); } char *href(const char *zFormat, ...){ char *zUrl; va_list ap; va_start(ap, zFormat); zUrl = vmprintf(zFormat, ap); va_end(ap); if( g.perm.Hyperlink && !g.javascriptHyperlink ){ return mprintf("<a href=\"%z\">", zUrl); } if( nHref>=nHrefAlloc ){ nHrefAlloc = nHrefAlloc*2 + 10; aHref = fossil_realloc(aHref, nHrefAlloc*sizeof(aHref[0])); } aHref[nHref++] = zUrl; return mprintf("<a id=%d>", nHref); } /* ** Generate javascript that will set the href= attribute on all anchors. */ void style_resolve_href(void){ int i; if( !g.perm.Hyperlink || !g.javascriptHyperlink || nHref==0 ) return; @ <script> for(i=0; i<nHref; i++){ @ document.getElementById(%d(i+1)).href="%s(aHref[i])"; } @ </script> } /* ** Add a new element to the submenu */ void style_submenu_element( const char *zLabel, const char *zTitle, const char *zLink, ................................................................................ /* Render trace log if TH1 tracing is enabled. */ if( g.thTrace ){ cgi_append_content("<span class=\"thTrace\"><hr />\n", -1); cgi_append_content(blob_str(&g.thLog), blob_size(&g.thLog)); cgi_append_content("</span>\n", -1); } /* Set the href= field on hyperlinks */ style_resolve_href(); } /* ** Begin a side-box on the right-hand side of a page. The title and ** the width of the box are given as arguments. The width is usually ** a percentage of total screen width. */ |
Changes to src/tag.c.
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 |
" AND tagtype=1)" " AND tagname GLOB 'sym-*'" " ORDER BY tagname" ); @ <ul> while( db_step(&q)==SQLITE_ROW ){ const char *zName = db_column_text(&q, 0); if( g.perm.History ){ @ <li><a class="tagLink" href="%s(g.zTop)/timeline?t=%T(zName)"> @ %h(zName)</a></li> }else{ @ <li><span class="tagDsp">%h(zName)</span></li> } } @ </ul> db_finalize(&q); |
| | |
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 |
" AND tagtype=1)" " AND tagname GLOB 'sym-*'" " ORDER BY tagname" ); @ <ul> while( db_step(&q)==SQLITE_ROW ){ const char *zName = db_column_text(&q, 0); if( g.perm.Hyperlink ){ @ <li>%z(xhref("class='taglink'","%R/timeline?t=%T",zName)) @ %h(zName)</a></li> }else{ @ <li><span class="tagDsp">%h(zName)</span></li> } } @ </ul> db_finalize(&q); |
Changes to src/timeline.c.
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 ... 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 ... 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 ... 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 ... 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 .... 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 .... 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 .... 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 .... 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 |
/* ** Generate a hyperlink to a version. */ void hyperlink_to_uuid(const char *zUuid){ char z[UUID_SIZE+1]; shorten_uuid(z, zUuid); if( g.perm.History ){ @ <a class="timelineHistLink" href="%s(g.zTop)/info/%s(z)">[%s(z)]</a> }else{ @ <span class="timelineHistDsp">[%s(z)]</span> } } /* ** Generate a hyperlink to a diff between two versions. */ void hyperlink_to_diff(const char *zV1, const char *zV2){ if( g.perm.History ){ if( zV2==0 ){ @ <a href="%s(g.zTop)/diff?v2=%s(zV1)">[diff]</a> }else{ @ <a href="%s(g.zTop)/diff?v1=%s(zV1)&v2=%s(zV2)">[diff]</a> } } } /* ** Generate a hyperlink to a date & time. */ void hyperlink_to_date(const char *zDate, const char *zSuffix){ if( zSuffix==0 ) zSuffix = ""; if( g.perm.History ){ @ <a href="%s(g.zTop)/timeline?c=%T(zDate)">%s(zDate)</a>%s(zSuffix) }else{ @ %s(zDate)%s(zSuffix) } } /* ** Generate a hyperlink to a user. This will link to a timeline showing ** events by that user. If the date+time is specified, then the timeline ** is centered on that date+time. */ void hyperlink_to_user(const char *zU, const char *zD, const char *zSuf){ if( zSuf==0 ) zSuf = ""; if( g.perm.History ){ if( zD && zD[0] ){ @ <a href="%s(g.zTop)/timeline?c=%T(zD)&u=%T(zU)">%h(zU)</a>%s(zSuf) }else{ @ <a href="%s(g.zTop)/timeline?u=%T(zU)">%h(zU)</a>%s(zSuf) } }else{ @ %s(zU) } } /* ................................................................................ } blob_reset(&comment); /* Generate the "user: USERNAME" at the end of the comment, together ** with a hyperlink to another timeline for that user. */ if( zTagList && zTagList[0]==0 ) zTagList = 0; if( g.perm.History && fossil_strcmp(zUser, zThisUser)!=0 ){ char *zLink = mprintf("%s/timeline?u=%h&c=%t&nd", g.zTop, zUser, zDate); @ (user: <a href="%s(zLink)">%h(zUser)</a>%s(zTagList?",":"\051") fossil_free(zLink); }else{ @ (user: %h(zUser)%s(zTagList?",":"\051") } /* Generate a "detail" link for tags. */ if( zType[0]=='g' && g.perm.History ){ @ [<a href="%s(g.zTop)/info/%S(zUuid)">details</a>] } /* Generate the "tags: TAGLIST" at the end of the comment, together ** with hyperlinks to the tag list. */ if( zTagList ){ if( g.perm.History ){ int i; const char *z = zTagList; Blob links; blob_zero(&links); while( z && z[0] ){ for(i=0; z[i] && (z[i]!=',' || z[i+1]!=' '); i++){} if( zThisTag==0 || memcmp(z, zThisTag, i)!=0 || zThisTag[i]!=0 ){ blob_appendf(&links, "<a href=\"%s/timeline?r=%#t&nd&c=%s\">%#h</a>%.2s", g.zTop, i, z, zDate, i, z, &z[i] ); }else{ blob_appendf(&links, "%#h", i+2, z); } if( z[i]==0 ) break; z += i+2; } ................................................................................ /* Generate extra hyperlinks at the end of the comment */ if( xExtra ){ xExtra(rid); } /* Generate the file-change list if requested */ if( (tmFlags & TIMELINE_FCHANGES)!=0 && zType[0]=='c' && g.perm.History ){ int inUl = 0; if( !fchngQueryInit ){ db_prepare(&fchngQuery, "SELECT (pid==0) AS isnew," " (fid==0) AS isdel," " (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name," " (SELECT uuid FROM blob WHERE rid=fid)," ................................................................................ const char *zNew = db_column_text(&fchngQuery, 3); if( !inUl ){ @ <ul class="filelist"> inUl = 1; } if( isNew ){ @ <li> %h(zFilename) (new file) @ <a href="%s(g.zTop)/artifact/%S(zNew)" @ target="diffwindow">[view]</a></li> }else if( isDel ){ @ <li> %h(zFilename) (deleted)</li> }else if( fossil_strcmp(zOld,zNew)==0 && zOldName!=0 ){ @ <li> %h(zOldName) → %h(zFilename) @ <a href="%s(g.zTop)/artifact/%S(zNew)" @ target="diffwindow">[view]</a></li> }else{ if( zOldName!=0 ){ @ <li> %h(zOldName) → %h(zFilename) }else{ @ <li> %h(zFilename) } @ <a href="%s(g.zTop)/fdiff?v1=%S(zOld)&v2=%S(zNew)" @ target="diffwindow">[diff]</a></li> } } db_reset(&fchngQuery); if( inUl ){ @ </ul> } } ................................................................................ while( p ){ blob_appendf(&sql, ",%d", p->rid); p = p->u.pTo; } blob_append(&sql, ")", -1); path_reset(); blob_append(&desc, "All nodes on the path from ", -1); if( g.perm.History ){ blob_appendf(&desc, "<a href='%s/info/%h'>[%h]</a>", g.zTop,zFrom,zFrom); }else{ blob_appendf(&desc, "[%h]", zFrom); } blob_append(&desc, " and ", -1); if( g.perm.History ){ blob_appendf(&desc, "<a href='%s/info/%h'>[%h]</a>.", g.zTop, zTo, zTo); }else{ blob_appendf(&desc, "[%h].", zTo); } tmFlags |= TIMELINE_DISJOINT; db_multi_exec("%s", blob_str(&sql)); }else if( (p_rid || d_rid) && g.perm.Read ){ /* If p= or d= is present, ignore all other parameters other than n= */ char *zUuid; int np, nd; ................................................................................ if( np>0 ){ if( nd>0 ) blob_appendf(&desc, " and "); blob_appendf(&desc, "%d ancestors", np); db_multi_exec("%s", blob_str(&sql)); } if( d_rid==0 && useDividers ) timeline_add_dividers(0, p_rid); } if( g.perm.History ){ blob_appendf(&desc, " of <a href='%s/info/%s'>[%.10s]</a>", g.zTop, zUuid, zUuid); }else{ blob_appendf(&desc, " of check-in [%.10s]", zUuid); } }else if( f_rid && g.perm.Read ){ /* If f= is present, ignore all other parameters other than n= */ char *zUuid; db_multi_exec( "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);" "INSERT INTO ok VALUES(%d);" "INSERT OR IGNORE INTO ok SELECT pid FROM plink WHERE cid=%d;" ................................................................................ f_rid, f_rid, f_rid ); blob_appendf(&sql, " AND event.objid IN ok"); db_multi_exec("%s", blob_str(&sql)); if( useDividers ) timeline_add_dividers(0, f_rid); blob_appendf(&desc, "Parents and children of check-in "); zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid); if( g.perm.History ){ blob_appendf(&desc, "<a href='%s/info/%s'>[%.10s]</a>", g.zTop, zUuid, zUuid); }else{ blob_appendf(&desc, "[%.10s]", zUuid); } }else{ /* Otherwise, a timeline based on a span of time */ int n; const char *zEType = "timeline item"; char *zDate; char *zNEntry = mprintf("%d", nEntry); url_add_parameter(&url, "n", zNEntry); ................................................................................ blob_appendf(&desc, " occurring on or before %h.<br />", zBefore); }else if( zCirca ){ blob_appendf(&desc, " occurring around %h.<br />", zCirca); } if( zSearch ){ blob_appendf(&desc, " matching \"%h\"", zSearch); } if( g.perm.History ){ if( zAfter || n==nEntry ){ zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/"); timeline_submenu(&url, "Older", "b", zDate, "a"); free(zDate); } if( zBefore || (zAfter && n==nEntry) ){ zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/"); ................................................................................ /* ** WEBPAGE: test_timewarps */ void test_timewarp_page(void){ Stmt q; login_check_credentials(); if( !g.perm.Read || !g.perm.History ){ login_needed(); return; } style_header("Instances of timewarp"); @ <ul> db_prepare(&q, "SELECT blob.uuid " " FROM plink p, plink c, blob" " WHERE p.cid=c.pid AND p.mtime>c.mtime" " AND blob.rid=c.cid" ); while( db_step(&q)==SQLITE_ROW ){ const char *zUuid = db_column_text(&q, 0); @ <li> @ <a href="%s(g.zTop)/timeline?p=%S(zUuid)&d=%S(zUuid)">%S(zUuid)</a> } db_finalize(&q); style_footer(); } |
| | | | | | | | | | | | < | < | | | | | | | | | | | | < < < | < < < < | < < < < < | < > < < < < | < | | | |
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 ... 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 ... 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 ... 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 ... 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 .... 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 .... 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 .... 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 .... 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 |
/* ** Generate a hyperlink to a version. */ void hyperlink_to_uuid(const char *zUuid){ char z[UUID_SIZE+1]; shorten_uuid(z, zUuid); if( g.perm.Hyperlink ){ @ %z(xhref("class='timelineHistLink'","%R/info/%s",z))[%s(z)]</a> }else{ @ <span class="timelineHistDsp">[%s(z)]</span> } } /* ** Generate a hyperlink to a diff between two versions. */ void hyperlink_to_diff(const char *zV1, const char *zV2){ if( g.perm.Hyperlink ){ if( zV2==0 ){ @ %z(href("%R/diff?v2=%s",zV1))[diff]</a> }else{ @ %z(href("%R/diff?v1=%s&v2=%s",zV1,zV2))[diff]</a> } } } /* ** Generate a hyperlink to a date & time. */ void hyperlink_to_date(const char *zDate, const char *zSuffix){ if( zSuffix==0 ) zSuffix = ""; if( g.perm.Hyperlink ){ @ %z(href("%R/timeline?c=%T",zDate))%s(zDate)</a>%s(zSuffix) }else{ @ %s(zDate)%s(zSuffix) } } /* ** Generate a hyperlink to a user. This will link to a timeline showing ** events by that user. If the date+time is specified, then the timeline ** is centered on that date+time. */ void hyperlink_to_user(const char *zU, const char *zD, const char *zSuf){ if( zSuf==0 ) zSuf = ""; if( g.perm.Hyperlink ){ if( zD && zD[0] ){ @ %z(href("%R/timeline?c=%T&u=%T",zD,zU))%h(zU)</a>%s(zSuf) }else{ @ %z(href("%R/timeline?u=%T",zU))%h(zU)</a>%s(zSuf) } }else{ @ %s(zU) } } /* ................................................................................ } blob_reset(&comment); /* Generate the "user: USERNAME" at the end of the comment, together ** with a hyperlink to another timeline for that user. */ if( zTagList && zTagList[0]==0 ) zTagList = 0; if( g.perm.Hyperlink && fossil_strcmp(zUser, zThisUser)!=0 ){ char *zLink = mprintf("%R/timeline?u=%h&c=%t&nd", zUser, zDate); @ (user: %z(href("%z",zLink))%h(zUser)</a>%s(zTagList?",":"\051") }else{ @ (user: %h(zUser)%s(zTagList?",":"\051") } /* Generate a "detail" link for tags. */ if( zType[0]=='g' && g.perm.Hyperlink ){ @ [%z(href("%R/info/%S",zUuid))details</a>] } /* Generate the "tags: TAGLIST" at the end of the comment, together ** with hyperlinks to the tag list. */ if( zTagList ){ if( g.perm.Hyperlink ){ int i; const char *z = zTagList; Blob links; blob_zero(&links); while( z && z[0] ){ for(i=0; z[i] && (z[i]!=',' || z[i+1]!=' '); i++){} if( zThisTag==0 || memcmp(z, zThisTag, i)!=0 || zThisTag[i]!=0 ){ blob_appendf(&links, "%z%#h</a>%.2s", href("%R/timeline?r=%#t&nd&c=%s",i,z,zDate), i,z, &z[i] ); }else{ blob_appendf(&links, "%#h", i+2, z); } if( z[i]==0 ) break; z += i+2; } ................................................................................ /* Generate extra hyperlinks at the end of the comment */ if( xExtra ){ xExtra(rid); } /* Generate the file-change list if requested */ if( (tmFlags & TIMELINE_FCHANGES)!=0 && zType[0]=='c' && g.perm.Hyperlink ){ int inUl = 0; if( !fchngQueryInit ){ db_prepare(&fchngQuery, "SELECT (pid==0) AS isnew," " (fid==0) AS isdel," " (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name," " (SELECT uuid FROM blob WHERE rid=fid)," ................................................................................ const char *zNew = db_column_text(&fchngQuery, 3); if( !inUl ){ @ <ul class="filelist"> inUl = 1; } if( isNew ){ @ <li> %h(zFilename) (new file) @ %z(xhref("target='diffwindow'","%R/artifact/%S",zNew)) @ [view]</a></li> }else if( isDel ){ @ <li> %h(zFilename) (deleted)</li> }else if( fossil_strcmp(zOld,zNew)==0 && zOldName!=0 ){ @ <li> %h(zOldName) → %h(zFilename) @ %z(xhref("target='diffwindow'","%R/artifact/%S",zNew)) @ [view]</a></li> }else{ if( zOldName!=0 ){ @ <li> %h(zOldName) → %h(zFilename) }else{ @ <li> %h(zFilename) } @ %z(xhref("target='diffwindow'","%R/fdiff?v1=%S&v2=%S",zOld,zNew)) @ [diff]</a></li> } } db_reset(&fchngQuery); if( inUl ){ @ </ul> } } ................................................................................ while( p ){ blob_appendf(&sql, ",%d", p->rid); p = p->u.pTo; } blob_append(&sql, ")", -1); path_reset(); blob_append(&desc, "All nodes on the path from ", -1); blob_appendf(&desc, "%z%h</a>", href("%R/info/%h", zFrom), zFrom); blob_append(&desc, " and ", -1); blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h",zTo), zTo); tmFlags |= TIMELINE_DISJOINT; db_multi_exec("%s", blob_str(&sql)); }else if( (p_rid || d_rid) && g.perm.Read ){ /* If p= or d= is present, ignore all other parameters other than n= */ char *zUuid; int np, nd; ................................................................................ if( np>0 ){ if( nd>0 ) blob_appendf(&desc, " and "); blob_appendf(&desc, "%d ancestors", np); db_multi_exec("%s", blob_str(&sql)); } if( d_rid==0 && useDividers ) timeline_add_dividers(0, p_rid); } blob_appendf(&desc, " of %z[%.10s]</a>", href("%R/info/%s", zUuid), zUuid); }else if( f_rid && g.perm.Read ){ /* If f= is present, ignore all other parameters other than n= */ char *zUuid; db_multi_exec( "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);" "INSERT INTO ok VALUES(%d);" "INSERT OR IGNORE INTO ok SELECT pid FROM plink WHERE cid=%d;" ................................................................................ f_rid, f_rid, f_rid ); blob_appendf(&sql, " AND event.objid IN ok"); db_multi_exec("%s", blob_str(&sql)); if( useDividers ) timeline_add_dividers(0, f_rid); blob_appendf(&desc, "Parents and children of check-in "); zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid); blob_appendf(&desc, "%z[%.10s]</a>", href("%R/info/%s", zUuid), zUuid); }else{ /* Otherwise, a timeline based on a span of time */ int n; const char *zEType = "timeline item"; char *zDate; char *zNEntry = mprintf("%d", nEntry); url_add_parameter(&url, "n", zNEntry); ................................................................................ blob_appendf(&desc, " occurring on or before %h.<br />", zBefore); }else if( zCirca ){ blob_appendf(&desc, " occurring around %h.<br />", zCirca); } if( zSearch ){ blob_appendf(&desc, " matching \"%h\"", zSearch); } if( g.perm.Hyperlink ){ if( zAfter || n==nEntry ){ zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/"); timeline_submenu(&url, "Older", "b", zDate, "a"); free(zDate); } if( zBefore || (zAfter && n==nEntry) ){ zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/"); ................................................................................ /* ** WEBPAGE: test_timewarps */ void test_timewarp_page(void){ Stmt q; login_check_credentials(); if( !g.perm.Read || !g.perm.Hyperlink ){ login_needed(); return; } style_header("Instances of timewarp"); @ <ul> db_prepare(&q, "SELECT blob.uuid " " FROM plink p, plink c, blob" " WHERE p.cid=c.pid AND p.mtime>c.mtime" " AND blob.rid=c.cid" ); while( db_step(&q)==SQLITE_ROW ){ const char *zUuid = db_column_text(&q, 0); @ <li> @ <a href="%s(g.zTop)/timeline?p=%S(zUuid)&d=%S(zUuid)">%S(zUuid)</a> } db_finalize(&q); style_footer(); } |
Changes to src/tkt.c.
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 ... 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 ... 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 ... 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 ... 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 |
login_check_credentials(); if( !g.perm.RdTkt ){ login_needed(); return; } if( g.perm.WrTkt || g.perm.ApndTkt ){ style_submenu_element("Edit", "Edit The Ticket", "%s/tktedit?name=%T", g.zTop, PD("name","")); } if( g.perm.History ){ style_submenu_element("History", "History Of This Ticket", "%s/tkthistory/%T", g.zTop, zUuid); style_submenu_element("Timeline", "Timeline Of This Ticket", "%s/tkttimeline/%T", g.zTop, zUuid); style_submenu_element("Check-ins", "Check-ins Of This Ticket", "%s/tkttimeline/%T?y=ci", g.zTop, zUuid); } if( g.perm.NewTkt ){ style_submenu_element("New Ticket", "Create a new ticket", "%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); } style_header("View Ticket"); if( g.thTrace ) Th_Trace("BEGIN_TKTVIEW<br />\n", -1); ticket_init(); initializeVariablesFromDb(); zScript = ticket_viewpage_code(); ................................................................................ const char *zUser = db_column_text(&q, 2); if( cnt==0 ){ @ <hr /><h2>Attachments:</h2> @ <ul> } cnt++; @ <li> if( g.perm.Read && g.perm.History ){ @ <a href="%s(g.zTop)/attachview?tkt=%s(zFullName)&file=%t(zFile)"> @ %h(zFile)</a> }else{ @ %h(zFile) } @ added by %h(zUser) on hyperlink_to_date(zDate, "."); if( g.perm.WrTkt && g.perm.Attach ){ @ [<a href="%s(g.zTop)/attachdelete?tkt=%s(zFullName)&file=%t(zFile)&from=%s(g.zTop)/tktview%%3fname=%s(zFullName)">delete</a>] } @ </li> } if( cnt ){ @ </ul> } db_finalize(&q); ................................................................................ } } return 0; } /* ** WEBPAGE: tkttimeline ** URL: /tkttimeline?name=TICKETUUID&y=TYPE ** ** Show the change history for a single ticket in timeline format. */ void tkttimeline_page(void){ Stmt q; char *zTitle; char *zSQL; ................................................................................ const char *zUuid; char *zFullUuid; int tagid; char zGlobPattern[50]; const char *zType; login_check_credentials(); if( !g.perm.History || !g.perm.RdTkt ){ login_needed(); return; } zUuid = PD("name",""); zType = PD("y","a"); if( zType[0]!='c' ){ style_submenu_element("Check-ins", "Check-ins", "%s/tkttimeline?name=%T&y=ci", g.zTop, zUuid); }else{ style_submenu_element("Timeline", "Timeline", "%s/tkttimeline?name=%T", g.zTop, zUuid); } style_submenu_element("History", "History", "%s/tkthistory/%s", g.zTop, zUuid); style_submenu_element("Status", "Status", ................................................................................ void tkthistory_page(void){ Stmt q; char *zTitle; const char *zUuid; int tagid; login_check_credentials(); if( !g.perm.History || !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); style_header(zTitle); free(zTitle); tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid); if( tagid==0 ){ ................................................................................ if( zSrc==0 || zSrc[0]==0 ){ @ @ <p>Delete attachment "%h(zFile)" }else{ @ @ <p>Add attachment "%h(zFile)" } @ [<a href="%s(g.zTop)/artifact/%T(zChngUuid)">%s(zShort)</a>] @ (rid %d(rid)) by hyperlink_to_user(zUser,zDate," on"); hyperlink_to_date(zDate, ".</p>"); }else{ pTicket = manifest_get(rid, CFTYPE_TICKET); if( pTicket ){ @ @ <p>Ticket change @ [<a href="%s(g.zTop)/artifact/%T(zChngUuid)">%s(zShort)</a>] @ (rid %d(rid)) by hyperlink_to_user(pTicket->zUser,zDate," on"); hyperlink_to_date(zDate, ":"); @ </p> ticket_output_change_artifact(pTicket); } manifest_destroy(pTicket); |
| | | | | | | | | | | | |
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 ... 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 ... 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 ... 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 ... 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 |
login_check_credentials(); if( !g.perm.RdTkt ){ login_needed(); return; } if( g.perm.WrTkt || g.perm.ApndTkt ){ style_submenu_element("Edit", "Edit The Ticket", "%s/tktedit?name=%T", g.zTop, PD("name","")); } if( g.perm.Hyperlink ){ style_submenu_element("History", "History Of This Ticket", "%s/tkthistory/%T", g.zTop, zUuid); style_submenu_element("Timeline", "Timeline Of This Ticket", "%s/tkttimeline/%T", g.zTop, zUuid); style_submenu_element("Check-ins", "Check-ins Of This Ticket", "%s/tkttimeline/%T?y=ci", g.zTop, zUuid); } if( g.perm.NewTkt ){ style_submenu_element("New Ticket", "Create a new ticket", "%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); } style_header("View Ticket"); if( g.thTrace ) Th_Trace("BEGIN_TKTVIEW<br />\n", -1); ticket_init(); initializeVariablesFromDb(); zScript = ticket_viewpage_code(); ................................................................................ const char *zUser = db_column_text(&q, 2); if( cnt==0 ){ @ <hr /><h2>Attachments:</h2> @ <ul> } cnt++; @ <li> if( g.perm.Read && g.perm.Hyperlink ){ @ %z(href("%R/attachview?tkt=%s&file=%t",zFullName,zFile)) @ %h(zFile)</a> }else{ @ %h(zFile) } @ added by %h(zUser) on hyperlink_to_date(zDate, "."); if( g.perm.WrTkt && g.perm.Attach ){ @ [%z(href("%R/attachdelete?tkt=%s&file=%t&from=%R/tktview%%3fname=%s",zFullName,zFile,zFullName))delete</a>] } @ </li> } if( cnt ){ @ </ul> } db_finalize(&q); ................................................................................ } } return 0; } /* ** WEBPAGE: tkttimeline ** URL: /tkttimeline?name=TICKETUUID&y=TYPE ** ** Show the change history for a single ticket in timeline format. */ void tkttimeline_page(void){ Stmt q; char *zTitle; char *zSQL; ................................................................................ const char *zUuid; char *zFullUuid; int tagid; char zGlobPattern[50]; const char *zType; login_check_credentials(); if( !g.perm.Hyperlink || !g.perm.RdTkt ){ login_needed(); return; } zUuid = PD("name",""); zType = PD("y","a"); if( zType[0]!='c' ){ style_submenu_element("Check-ins", "Check-ins", "%s/tkttimeline?name=%T&y=ci", g.zTop, zUuid); }else{ style_submenu_element("Timeline", "Timeline", "%s/tkttimeline?name=%T", g.zTop, zUuid); } style_submenu_element("History", "History", "%s/tkthistory/%s", g.zTop, zUuid); style_submenu_element("Status", "Status", ................................................................................ void tkthistory_page(void){ Stmt q; char *zTitle; const char *zUuid; int tagid; 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); style_header(zTitle); free(zTitle); tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid); if( tagid==0 ){ ................................................................................ if( zSrc==0 || zSrc[0]==0 ){ @ @ <p>Delete attachment "%h(zFile)" }else{ @ @ <p>Add attachment "%h(zFile)" } @ [%z(href("%R/artifact/%T",zChngUuid))%s(zShort)</a>] @ (rid %d(rid)) by hyperlink_to_user(zUser,zDate," on"); hyperlink_to_date(zDate, ".</p>"); }else{ pTicket = manifest_get(rid, CFTYPE_TICKET); if( pTicket ){ @ @ <p>Ticket change @ [%z(href("%R/artifact/%T",zChngUuid))%s(zShort)</a>] @ (rid %d(rid)) by hyperlink_to_user(pTicket->zUser,zDate," on"); hyperlink_to_date(zDate, ":"); @ </p> ticket_output_change_artifact(pTicket); } manifest_destroy(pTicket); |
Changes to src/wiki.c.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 ... 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 ... 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 ... 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 ... 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 ... 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 ... 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 ... 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 ... 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 |
g.isHome = 1; wiki_page(); return; } style_header("Home"); @ <p>This is a stub home-page for the project. @ To fill in this page, first go to @ <a href="%s(g.zTop)/setup_config">setup/config</a> @ and establish a "Project Name". Then create a @ wiki page with that name. The content of that wiki page @ will be displayed in place of this message.</p> style_footer(); } /* ................................................................................ if( !g.perm.RdWiki ){ login_needed(); return; } zPageName = P("name"); if( zPageName==0 ){ style_header("Wiki"); @ <ul> { char *zHomePageName = db_get("project-name",0); if( zHomePageName ){ @ <li> <a href="%s(g.zTop)/wiki?name=%t(zHomePageName)"> @ %h(zHomePageName)</a> wiki home page.</li> } } @ <li> <a href="%s(g.zTop)/timeline?y=w">Recent changes</a> to wiki @ pages. </li> @ <li> <a href="%s(g.zTop)/wiki_rules">Formatting rules</a> for @ wiki.</li> @ <li> Use the <a href="%s(g.zTop)/wiki?name=Sandbox">Sandbox</a> @ to experiment.</li> if( g.perm.NewWiki ){ @ <li> Create a <a href="%s(g.zTop)/wikinew">new wiki page</a>.</li> if( g.perm.Write ){ @ <li> Create a <a href="%s(g.zTop)/eventedit">new event</a>.</li> } } @ <li> <a href="%s(g.zTop)/wcontent">List of All Wiki Pages</a> @ available on this server.</li> @ <li> <form method="get" action="%s(g.zTop)/wfind"><div> @ Search wiki titles: <input type="text" name="title"/> @ <input type="submit" /></div></form> @ </li> @ </ul> style_footer(); ................................................................................ if( !g.isHome ){ if( (rid && g.perm.WrWiki) || (!rid && g.perm.NewWiki) ){ style_submenu_element("Edit", "Edit Wiki Page", "%s/wikiedit?name=%T", g.zTop, zPageName); } if( rid && g.perm.ApndWiki && g.perm.Attach ){ style_submenu_element("Attach", "Add An Attachment", "%s/attachadd?page=%T&from=%s/wiki%%3fname=%T", g.zTop, zPageName, g.zTop, zPageName); } if( rid && g.perm.ApndWiki ){ style_submenu_element("Append", "Add A Comment", "%s/wikiappend?name=%T", g.zTop, zPageName); } if( g.perm.History ){ style_submenu_element("History", "History", "%s/whistory?name=%T", g.zTop, zPageName); } } style_header(zPageName); blob_init(&wiki, zBody, -1); wiki_convert(&wiki, 0, 0); ................................................................................ const char *zUser = db_column_text(&q, 2); if( cnt==0 ){ @ <hr /><h2>Attachments:</h2> @ <ul> } cnt++; @ <li> if( g.perm.History && g.perm.Read ){ @ <a href="%s(g.zTop)/attachview?page=%s(zPageName)&file=%t(zFile)"> @ %h(zFile)</a> }else{ @ %h(zFile) } @ added by %h(zUser) on hyperlink_to_date(zDate, "."); if( g.perm.WrWiki && g.perm.Attach ){ @ [<a href="%s(g.zTop)/attachdelete?page=%s(zPageName)&file=%t(zFile)&from=%s(g.zTop)/wiki%%3fname=%s(zPageName)">delete</a>] } @ </li> } if( cnt ){ @ </ul> } db_finalize(&q); ................................................................................ /* ** Function called to output extra text at the end of each line in ** a wiki history listing. */ static void wiki_history_extra(int rid){ if( db_exists("SELECT 1 FROM tagxref WHERE rid=%d", rid) ){ @ <a href="%s(g.zTop)/wdiff?name=%t(zWikiPageName)&a=%d(rid)">[diff]</a> } } /* ** WEBPAGE: whistory ** URL: /whistory?name=PAGENAME ** ................................................................................ */ void whistory_page(void){ Stmt q; char *zTitle; char *zSQL; const char *zPageName; login_check_credentials(); if( !g.perm.History ){ login_needed(); return; } zPageName = PD("name",""); zTitle = mprintf("History Of %s", zPageName); style_header(zTitle); free(zTitle); zSQL = mprintf("%s AND event.objid IN " " (SELECT rid FROM tagxref WHERE tagid=" ................................................................................ const char *zPageName; Manifest *pW1, *pW2 = 0; Blob w1, w2, d; int diffFlags; login_check_credentials(); rid1 = atoi(PD("a","0")); if( !g.perm.History ){ login_needed(); return; } if( rid1==0 ) fossil_redirect_home(); rid2 = atoi(PD("b","0")); zPageName = PD("name",""); zTitle = mprintf("Changes To %s", zPageName); style_header(zTitle); free(zTitle); ................................................................................ } @ <ul> wiki_prepare_page_list(&q); while( db_step(&q)==SQLITE_ROW ){ const char *zName = db_column_text(&q, 0); int size = db_column_int(&q, 1); if( size>0 ){ @ <li><a href="%s(g.zTop)/wiki?name=%T(zName)">%h(zName)</a></li> }else if( showAll ){ @ <li><a href="%s(g.zTop)/wiki?name=%T(zName)"><s>%h(zName)</s></a></li> } } db_finalize(&q); @ </ul> style_footer(); } ................................................................................ @ <ul> db_prepare(&q, "SELECT substr(tagname, 6, 1000) FROM tag WHERE tagname like 'wiki-%%%q%%'" " ORDER BY lower(tagname) /*sort*/" , zTitle); while( db_step(&q)==SQLITE_ROW ){ const char *zName = db_column_text(&q, 0); @ <li><a href="%s(g.zTop)/wiki?name=%T(zName)">%h(zName)</a></li> } db_finalize(&q); @ </ul> style_footer(); } /* |
| | | < | < < > < > < > | | | | | | | | | | | | |
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 ... 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 ... 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 ... 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 ... 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 ... 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 ... 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 ... 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 ... 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 |
g.isHome = 1; wiki_page(); return; } style_header("Home"); @ <p>This is a stub home-page for the project. @ To fill in this page, first go to @ %z(href("%R/setup_config"))setup/config</a> @ and establish a "Project Name". Then create a @ wiki page with that name. The content of that wiki page @ will be displayed in place of this message.</p> style_footer(); } /* ................................................................................ if( !g.perm.RdWiki ){ login_needed(); return; } zPageName = P("name"); if( zPageName==0 ){ style_header("Wiki"); @ <ul> { char *zHomePageName = db_get("project-name",0); if( zHomePageName ){ @ <li> %z(href("%R/wiki?name=%t",zHomePageName)) @ %h(zHomePageName)</a> wiki home page.</li> } } @ <li> %z(href("%R/timeline?y=w"))Recent changes</a> to wiki pages.</li> @ <li> %z(href("%R/wiki_rules"))Formatting rules</a> for wiki.</li> @ <li> Use the %z(href("%R/wiki?name=Sandbox"))Sandbox</a> @ to experiment.</li> if( g.perm.NewWiki ){ @ <li> Create a %z(href("%R/wikinew"))new wiki page</a>.</li> if( g.perm.Write ){ @ <li> Create a %z(href("%R/eventedit"))new event</a>.</li> } } @ <li> %z(href("%R/wcontent"))List of All Wiki Pages</a> @ available on this server.</li> @ <li> <form method="get" action="%s(g.zTop)/wfind"><div> @ Search wiki titles: <input type="text" name="title"/> @ <input type="submit" /></div></form> @ </li> @ </ul> style_footer(); ................................................................................ if( !g.isHome ){ if( (rid && g.perm.WrWiki) || (!rid && g.perm.NewWiki) ){ style_submenu_element("Edit", "Edit Wiki Page", "%s/wikiedit?name=%T", g.zTop, zPageName); } if( rid && g.perm.ApndWiki && g.perm.Attach ){ style_submenu_element("Attach", "Add An Attachment", "%s/attachadd?page=%T&from=%s/wiki%%3fname=%T", g.zTop, zPageName, g.zTop, zPageName); } if( rid && g.perm.ApndWiki ){ style_submenu_element("Append", "Add A Comment", "%s/wikiappend?name=%T", g.zTop, zPageName); } if( g.perm.Hyperlink ){ style_submenu_element("History", "History", "%s/whistory?name=%T", g.zTop, zPageName); } } style_header(zPageName); blob_init(&wiki, zBody, -1); wiki_convert(&wiki, 0, 0); ................................................................................ const char *zUser = db_column_text(&q, 2); if( cnt==0 ){ @ <hr /><h2>Attachments:</h2> @ <ul> } cnt++; @ <li> if( g.perm.Hyperlink && g.perm.Read ){ @ %z(href("%R/attachview?page=%T&file=%t",zPageName,zFile)) @ %h(zFile)</a> }else{ @ %h(zFile) } @ added by %h(zUser) on hyperlink_to_date(zDate, "."); if( g.perm.WrWiki && g.perm.Attach ){ @ [%z(href("%R/attachdelete?page=%t&file=%t&from=%R/wiki%%3fname=%f",zPageName,zFile,zPageName))delete</a>] } @ </li> } if( cnt ){ @ </ul> } db_finalize(&q); ................................................................................ /* ** Function called to output extra text at the end of each line in ** a wiki history listing. */ static void wiki_history_extra(int rid){ if( db_exists("SELECT 1 FROM tagxref WHERE rid=%d", rid) ){ @ %z(href("%R/wdiff?name=%t&a=%d",zWikiPageName,rid))[diff]</a> } } /* ** WEBPAGE: whistory ** URL: /whistory?name=PAGENAME ** ................................................................................ */ void whistory_page(void){ Stmt q; char *zTitle; char *zSQL; const char *zPageName; login_check_credentials(); if( !g.perm.Hyperlink ){ login_needed(); return; } zPageName = PD("name",""); zTitle = mprintf("History Of %s", zPageName); style_header(zTitle); free(zTitle); zSQL = mprintf("%s AND event.objid IN " " (SELECT rid FROM tagxref WHERE tagid=" ................................................................................ const char *zPageName; Manifest *pW1, *pW2 = 0; Blob w1, w2, d; int diffFlags; login_check_credentials(); rid1 = atoi(PD("a","0")); if( !g.perm.Hyperlink ){ login_needed(); return; } if( rid1==0 ) fossil_redirect_home(); rid2 = atoi(PD("b","0")); zPageName = PD("name",""); zTitle = mprintf("Changes To %s", zPageName); style_header(zTitle); free(zTitle); ................................................................................ } @ <ul> wiki_prepare_page_list(&q); while( db_step(&q)==SQLITE_ROW ){ const char *zName = db_column_text(&q, 0); int size = db_column_int(&q, 1); if( size>0 ){ @ <li>%z(href("%R/wiki?name=%T",zName))%h(zName)</a></li> }else if( showAll ){ @ <li>%z(href("%R/wiki?name=%T",zName))<s>%h(zName)</s></a></li> } } db_finalize(&q); @ </ul> style_footer(); } ................................................................................ @ <ul> db_prepare(&q, "SELECT substr(tagname, 6, 1000) FROM tag WHERE tagname like 'wiki-%%%q%%'" " ORDER BY lower(tagname) /*sort*/" , zTitle); while( db_step(&q)==SQLITE_ROW ){ const char *zName = db_column_text(&q, 0); @ <li>%z(href("%R/wiki?name=%T",zName))%h(zName)</a></li> } db_finalize(&q); @ </ul> style_footer(); } /* |
Changes to src/wikiformat.c.
1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 |
|| strncmp(zTarget, "https:", 6)==0 || strncmp(zTarget, "ftp:", 4)==0 || strncmp(zTarget, "mailto:", 7)==0 ){ blob_appendf(p->pOut, "<a href=\"%s\">", zTarget); /* zTerm = "⟾</a>"; // doesn't work on windows */ }else if( zTarget[0]=='/' ){ if( 1 /* g.perm.History */ ){ blob_appendf(p->pOut, "<a href=\"%s%h\">", g.zTop, zTarget); }else{ zTerm = ""; } }else if( zTarget[0]=='.' || zTarget[0]=='#' ){ if( 1 /* g.perm.History */ ){ blob_appendf(p->pOut, "<a href=\"%h\">", zTarget); }else{ zTerm = ""; } }else if( is_valid_uuid(zTarget) ){ int isClosed = 0; if( is_ticket(zTarget, &isClosed) ){ /* Special display processing for tickets. Display the hyperlink ** as crossed out if the ticket is closed. */ if( isClosed ){ if( g.perm.History ){ blob_appendf(p->pOut, "<a href=\"%s/info/%s\"><span class=\"wikiTagCancelled\">[", g.zTop, zTarget ); zTerm = "]</span></a>"; }else{ blob_appendf(p->pOut,"<span class=\"wikiTagCancelled\">["); zTerm = "]</span>"; } }else{ if( g.perm.History ){ blob_appendf(p->pOut,"<a href=\"%s/info/%s\">[", g.zTop, zTarget ); zTerm = "]</a>"; }else{ blob_appendf(p->pOut, "["); zTerm = "]"; } } }else if( !in_this_repo(zTarget) ){ blob_appendf(p->pOut, "<span class=\"brokenlink\">[", zTarget); zTerm = "]</span>"; }else if( g.perm.History ){ blob_appendf(p->pOut, "<a href=\"%s/info/%s\">[", g.zTop, zTarget); zTerm = "]</a>"; } }else if( strlen(zTarget)>=10 && fossil_isdigit(zTarget[0]) && zTarget[4]=='-' && db_int(0, "SELECT datetime(%Q) NOT NULL", zTarget) ){ blob_appendf(p->pOut, "<a href=\"%s/timeline?c=%T\">", g.zTop, zTarget); }else if( strncmp(zTarget, "wiki:", 5)==0 && wiki_name_is_wellformed((const unsigned char*)zTarget) ){ |
< | < < < < > | | | | | < < | | |
1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 |
|| strncmp(zTarget, "https:", 6)==0 || strncmp(zTarget, "ftp:", 4)==0 || strncmp(zTarget, "mailto:", 7)==0 ){ blob_appendf(p->pOut, "<a href=\"%s\">", zTarget); /* zTerm = "⟾</a>"; // doesn't work on windows */ }else if( zTarget[0]=='/' ){ blob_appendf(p->pOut, "<a href=\"%s%h\">", g.zTop, zTarget); }else if( zTarget[0]=='.' || zTarget[0]=='#' ){ if( 1 ){ blob_appendf(p->pOut, "<a href=\"%h\">", zTarget); }else{ zTerm = ""; } }else if( is_valid_uuid(zTarget) ){ int isClosed = 0; if( is_ticket(zTarget, &isClosed) ){ /* Special display processing for tickets. Display the hyperlink ** as crossed out if the ticket is closed. */ if( isClosed ){ if( g.perm.Hyperlink ){ blob_appendf(p->pOut, "%z<span class=\"wikiTagCancelled\">[", href("%R/info/%s",zTarget) ); zTerm = "]</span></a>"; }else{ blob_appendf(p->pOut,"<span class=\"wikiTagCancelled\">["); zTerm = "]</span>"; } }else{ if( g.perm.Hyperlink ){ blob_appendf(p->pOut,"%z[", href("%R/info/%s", zTarget)); zTerm = "]</a>"; }else{ blob_appendf(p->pOut, "["); zTerm = "]"; } } }else if( !in_this_repo(zTarget) ){ blob_appendf(p->pOut, "<span class=\"brokenlink\">[", zTarget); zTerm = "]</span>"; }else if( g.perm.Hyperlink ){ blob_appendf(p->pOut, "%z[",href("%R/info/%s", zTarget)); zTerm = "]</a>"; } }else if( strlen(zTarget)>=10 && fossil_isdigit(zTarget[0]) && zTarget[4]=='-' && db_int(0, "SELECT datetime(%Q) NOT NULL", zTarget) ){ blob_appendf(p->pOut, "<a href=\"%s/timeline?c=%T\">", g.zTop, zTarget); }else if( strncmp(zTarget, "wiki:", 5)==0 && wiki_name_is_wellformed((const unsigned char*)zTarget) ){ |