Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | When the user is "nobody", make the g.anon permission vector for "anonymous" available in addition to g.perm. Hyperlinks to pages that would be available to anonymous are shown rather than suppressed. When permission is denied and control jumps to login_needed() a new flag shows whether or not logging in as "anonymous" would help. Work in progress. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | login-enhancements |
| Files: | files | file ages | folders |
| SHA1: |
2f50d427a9482d4ccac4a1e423859051 |
| User & Date: | drh 2015-02-14 12:24:12.801 |
Context
|
2015-02-14
| ||
| 14:05 | Change default headers to show menu-bar items that would be available to user "anonymous" even if the current user is not logged in. check-in: 72cddddbcc user: drh tags: login-enhancements | |
| 12:24 | When the user is "nobody", make the g.anon permission vector for "anonymous" available in addition to g.perm. Hyperlinks to pages that would be available to anonymous are shown rather than suppressed. When permission is denied and control jumps to login_needed() a new flag shows whether or not logging in as "anonymous" would help. Work in progress. check-in: 2f50d427a9 user: drh tags: login-enhancements | |
|
2015-02-13
| ||
| 09:03 | A few more places where displayed UUID length should be configurable. check-in: c62e94f8a3 user: jan.nijtmans tags: trunk | |
Changes
Changes to src/attach.c.
| ︙ | ︙ | |||
46 47 48 49 50 51 52 |
"SELECT datetime(mtime%s), src, target, filename,"
" comment, user,"
" (SELECT uuid FROM blob WHERE rid=attachid), attachid"
" FROM attachment",
timeline_utc()
);
if( zPage ){
| | | | > > > | 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 |
"SELECT datetime(mtime%s), src, target, filename,"
" comment, user,"
" (SELECT uuid FROM blob WHERE rid=attachid), attachid"
" FROM attachment",
timeline_utc()
);
if( zPage ){
if( g.perm.RdWiki==0 ){ login_needed(g.anon.RdWiki); return; }
style_header("Attachments To %h", zPage);
blob_append_sql(&sql, " WHERE target=%Q", zPage);
}else if( zTkt ){
if( g.perm.RdTkt==0 ){ login_needed(g.anon.RdTkt); return; }
style_header("Attachments To Ticket %S", zTkt);
blob_append_sql(&sql, " WHERE target GLOB '%q*'", zTkt);
}else{
if( g.perm.RdTkt==0 && g.perm.RdWiki==0 ){
login_needed(g.anon.RdTkt || g.anon.RdWiki);
return;
}
style_header("All Attachments");
}
blob_append_sql(&sql, " ORDER BY mtime DESC");
db_prepare(&q, "%s", blob_sql_text(&sql));
@ <ol>
while( db_step(&q)==SQLITE_ROW ){
const char *zDate = db_column_text(&q, 0);
|
| ︙ | ︙ | |||
148 149 150 151 152 153 154 |
int attachid = atoi(PD("attachid","0"));
char *zUUID;
if( zPage && zTkt ) zTkt = 0;
if( zFile==0 ) fossil_redirect_home();
login_check_credentials();
if( zPage ){
| | | | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
int attachid = atoi(PD("attachid","0"));
char *zUUID;
if( zPage && zTkt ) zTkt = 0;
if( zFile==0 ) fossil_redirect_home();
login_check_credentials();
if( zPage ){
if( g.perm.RdWiki==0 ){ login_needed(g.anon.RdWiki); return; }
zTarget = zPage;
}else if( zTkt ){
if( g.perm.RdTkt==0 ){ login_needed(g.anon.RdTkt); return; }
zTarget = zTkt;
}else{
fossil_redirect_home();
}
if( attachid>0 ){
zUUID = db_text(0,
"SELECT coalesce(src,'x') FROM attachment"
|
| ︙ | ︙ | |||
241 242 243 244 245 246 247 |
int goodCaptcha = 1;
if( P("cancel") ) cgi_redirect(zFrom);
if( zPage && zTkt ) fossil_redirect_home();
if( zPage==0 && zTkt==0 ) fossil_redirect_home();
login_check_credentials();
if( zPage ){
| | > > > | > > > | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
int goodCaptcha = 1;
if( P("cancel") ) cgi_redirect(zFrom);
if( zPage && zTkt ) fossil_redirect_home();
if( zPage==0 && zTkt==0 ) fossil_redirect_home();
login_check_credentials();
if( zPage ){
if( g.perm.ApndWiki==0 || g.perm.Attach==0 ){
login_needed(g.anon.ApndWiki && g.anon.Attach);
return;
}
if( !db_exists("SELECT 1 FROM tag WHERE tagname='wiki-%q'", zPage) ){
fossil_redirect_home();
}
zTarget = zPage;
zTargetType = mprintf("Wiki Page <a href=\"%R/wiki?name=%h\">%h</a>",
zPage, zPage);
}else{
if( g.perm.ApndTkt==0 || g.perm.Attach==0 ){
login_needed(g.anon.ApndTkt && g.anon.Attach);
return;
}
if( !db_exists("SELECT 1 FROM tag WHERE tagname='tkt-%q'", zTkt) ){
zTkt = db_text(0, "SELECT substr(tagname,5) FROM tag"
" WHERE tagname GLOB 'tkt-%q*'", zTkt);
if( zTkt==0 ) fossil_redirect_home();
}
zTarget = zTkt;
zTargetType = mprintf("Ticket <a href=\"%R/tktview/%s\">%S</a>",
|
| ︙ | ︙ | |||
367 368 369 370 371 372 373 |
int isModerator; /* TRUE if user is the moderator */
const char *zMime; /* MIME Type */
Blob attach; /* Content of the attachment */
int fShowContent = 0;
const char *zLn = P("ln");
login_check_credentials();
| | > > > | 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
int isModerator; /* TRUE if user is the moderator */
const char *zMime; /* MIME Type */
Blob attach; /* Content of the attachment */
int fShowContent = 0;
const char *zLn = P("ln");
login_check_credentials();
if( !g.perm.RdTkt && !g.perm.RdWiki ){
login_needed(g.anon.RdTkt || g.anon.RdWiki);
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 0
/* Shunning here needs to get both the attachment control artifact and
** the object that is attached. */
if( g.perm.Admin ){
|
| ︙ | ︙ | |||
397 398 399 400 401 402 403 |
zDesc = pAttach->zComment;
zMime = mimetype_from_name(zName);
fShowContent = zMime ? strncmp(zMime,"text/", 5)==0 : 0;
if( validate16(zTarget, strlen(zTarget))
&& db_exists("SELECT 1 FROM ticket WHERE tkt_uuid='%q'", zTarget)
){
zTktUuid = zTarget;
| | | | 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
zDesc = pAttach->zComment;
zMime = mimetype_from_name(zName);
fShowContent = zMime ? strncmp(zMime,"text/", 5)==0 : 0;
if( validate16(zTarget, strlen(zTarget))
&& db_exists("SELECT 1 FROM ticket WHERE tkt_uuid='%q'", zTarget)
){
zTktUuid = zTarget;
if( !g.perm.RdTkt ){ login_needed(g.anon.RdTkt); return; }
if( g.perm.WrTkt ){
style_submenu_element("Delete","Delete","%R/ainfo/%s?del", zUuid);
}
}else if( db_exists("SELECT 1 FROM tag WHERE tagname='wiki-%q'",zTarget) ){
zWikiName = zTarget;
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
if( g.perm.WrWiki ){
style_submenu_element("Delete","Delete","%R/ainfo/%s?del", zUuid);
}
}
zDate = db_text(0, "SELECT datetime(%.12f)", pAttach->rDate);
if( P("confirm")
|
| ︙ | ︙ |
Changes to src/branch.c.
| ︙ | ︙ | |||
337 338 339 340 341 342 343 |
** Control jumps to this routine from brlist_page() (the /brlist handler)
** if there are no query parameters.
*/
static void new_brlist_page(void){
Stmt q;
double rNow;
login_check_credentials();
| | | 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 |
** Control jumps to this routine from brlist_page() (the /brlist handler)
** if there are no query parameters.
*/
static void new_brlist_page(void){
Stmt q;
double rNow;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
style_header("Branches");
style_adunit_config(ADUNIT_RIGHT_OK);
login_anonymous_available();
db_prepare(&q, brlistQuery/*works-like:""*/);
rNow = db_double(0.0, "SELECT julianday('now')");
@ <div class="brlist"><table id="branchlisttable">
|
| ︙ | ︙ | |||
406 407 408 409 410 411 412 |
int brFlags = BRL_OPEN_ONLY;
if( showClosed==0 && showAll==0 && showOpen==0 && colorTest==0 ){
new_brlist_page();
return;
}
login_check_credentials();
| | | 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
int brFlags = BRL_OPEN_ONLY;
if( showClosed==0 && showAll==0 && showOpen==0 && colorTest==0 ){
new_brlist_page();
return;
}
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
if( colorTest ){
showClosed = 0;
showAll = 1;
}
if( showAll ) brFlags = BRL_BOTH;
if( showClosed ) brFlags = BRL_CLOSED_ONLY;
|
| ︙ | ︙ | |||
513 514 515 516 517 518 519 |
**
** Show a timeline of all branches
*/
void brtimeline_page(void){
Stmt q;
login_check_credentials();
| | | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
**
** Show a timeline of all branches
*/
void brtimeline_page(void){
Stmt q;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
style_header("Branches");
style_submenu_element("List", "List", "brlist");
login_anonymous_available();
@ <h2>The initial check-in for each branch:</h2>
db_prepare(&q,
"%s AND blob.rid IN (SELECT rid FROM tagxref"
|
| ︙ | ︙ |
Changes to src/browse.c.
| ︙ | ︙ | |||
128 129 130 131 132 133 134 |
const char *zSubdirLink;
int linkTrunk = 1;
int linkTip = 1;
HQuery sURI;
if( strcmp(PD("type","flat"),"tree")==0 ){ page_tree(); return; }
login_check_credentials();
| | | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
const char *zSubdirLink;
int linkTrunk = 1;
int linkTip = 1;
HQuery sURI;
if( strcmp(PD("type","flat"),"tree")==0 ){ page_tree(); return; }
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
style_header("File List");
style_adunit_config(ADUNIT_RIGHT_OK);
sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
pathelementFunc, 0, 0);
url_initialize(&sURI, "dir");
cgi_query_parameters_to_url(&sURI);
|
| ︙ | ︙ | |||
540 541 542 543 544 545 546 |
int showDirOnly; /* Show directories only. Omit files */
int nDir = 0; /* Number of directories. Used for ID attributes */
char *zProjectName = db_get("project-name", 0);
if( strcmp(PD("type","flat"),"flat")==0 ){ page_dir(); return; }
memset(&sTree, 0, sizeof(sTree));
login_check_credentials();
| | | 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 |
int showDirOnly; /* Show directories only. Omit files */
int nDir = 0; /* Number of directories. Used for ID attributes */
char *zProjectName = db_get("project-name", 0);
if( strcmp(PD("type","flat"),"flat")==0 ){ page_dir(); return; }
memset(&sTree, 0, sizeof(sTree));
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
pathelementFunc, 0, 0);
url_initialize(&sURI, "tree");
cgi_query_parameters_to_url(&sURI);
if( PB("nofiles") ){
showDirOnly = 1;
|
| ︙ | ︙ | |||
1000 1001 1002 1003 1004 1005 1006 |
const char *zGlob;
const char *zUuid;
const char *zNow; /* Time of checkin */
int showId = PB("showid");
Stmt q1, q2;
double baseTime;
login_check_credentials();
| | | 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 |
const char *zGlob;
const char *zUuid;
const char *zNow; /* Time of checkin */
int showId = PB("showid");
Stmt q1, q2;
double baseTime;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
zName = P("name");
if( zName==0 ) zName = "tip";
rid = symbolic_name_to_rid(zName, "ci");
if( rid==0 ){
fossil_fatal("not a valid check-in: %s", zName);
}
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
|
| ︙ | ︙ |
Changes to src/cache.c.
| ︙ | ︙ | |||
328 329 330 331 332 333 334 |
*/
void cache_page(void){
sqlite3 *db;
sqlite3_stmt *pStmt;
char zBuf[100];
login_check_credentials();
| | | 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 |
*/
void cache_page(void){
sqlite3 *db;
sqlite3_stmt *pStmt;
char zBuf[100];
login_check_credentials();
if( !g.perm.Setup ){ login_needed(0); return; }
style_header("Web Cache Status");
db = cacheOpen(0);
if( db==0 ){
@ The web-page cache is disabled for this repository
}else{
char *zDbName = cacheName();
cache_register_sizename(db);
|
| ︙ | ︙ | |||
376 377 378 379 380 381 382 |
** This page is normally a hyperlink from the /cachestat page.
*/
void cache_getpage(void){
const char *zKey;
Blob content;
login_check_credentials();
| | | 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
** This page is normally a hyperlink from the /cachestat page.
*/
void cache_getpage(void){
const char *zKey;
Blob content;
login_check_credentials();
if( !g.perm.Setup ){ login_needed(0); return; }
zKey = PD("key","");
blob_zero(&content);
if( cache_read(&content, zKey)==0 ){
style_header("Cache Download Error");
@ The cache does not contain any entry with this key: "%h(zKey)"
style_footer();
return;
}
cgi_set_content(&content);
cgi_set_content_type("application/x-compressed");
}
|
Changes to src/descendants.c.
| ︙ | ︙ | |||
437 438 439 440 441 442 443 |
void leaves_page(void){
Blob sql;
Stmt q;
int showAll = P("all")!=0;
int showClosed = P("closed")!=0;
login_check_credentials();
| | | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
void leaves_page(void){
Blob sql;
Stmt q;
int showAll = P("all")!=0;
int showClosed = P("closed")!=0;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
if( !showAll ){
style_submenu_element("All", "All", "leaves?all");
}
if( !showClosed ){
style_submenu_element("Closed", "Closed", "leaves?closed");
}
|
| ︙ | ︙ |
Changes to src/diff.c.
| ︙ | ︙ | |||
2232 2233 2234 2235 2236 2237 2238 |
struct AnnVers *p;
unsigned clr1, clr2, clr;
int bBlame = g.zPath[0]!='a';/* True for BLAME output. False for ANNOTATE. */
/* Gather query parameters */
showLog = atoi(PD("log","1"));
login_check_credentials();
| | | 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 |
struct AnnVers *p;
unsigned clr1, clr2, clr;
int bBlame = g.zPath[0]!='a';/* True for BLAME output. False for ANNOTATE. */
/* Gather query parameters */
showLog = atoi(PD("log","1"));
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
if( exclude_spiders("annotate") ) return;
load_control();
mid = name_to_typed_rid(PD("checkin","0"),"ci");
zFilename = P("filename");
fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename);
if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
iLimit = atoi(PD("limit","20"));
|
| ︙ | ︙ |
Changes to src/diffcmd.c.
| ︙ | ︙ | |||
839 840 841 842 843 844 845 |
** 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();
| | | 839 840 841 842 843 844 845 846 847 848 849 850 851 |
** 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(g.anon.Read); return; }
if( zFrom==0 || zTo==0 ) fossil_redirect_home();
cgi_set_content_type("text/plain");
diff_all_two_versions(zFrom, zTo, 0, 0, 0, DIFF_VERBOSE);
}
|
Changes to src/doc.c.
| ︙ | ︙ | |||
541 542 543 544 545 546 547 |
Blob title; /* Document title */
int nMiss = (-1); /* Failed attempts to find the document */
static const char *const azSuffix[] = {
"index.html", "index.wiki", "index.md"
};
login_check_credentials();
| | | 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 |
Blob title; /* Document title */
int nMiss = (-1); /* Failed attempts to find the document */
static const char *const azSuffix[] = {
"index.html", "index.wiki", "index.md"
};
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
blob_init(&title, 0, 0);
db_begin_transaction();
while( rid==0 && (++nMiss)<=ArraySize(azSuffix) ){
zName = PD("name", "tip/index.wiki");
for(i=0; zName[i] && zName[i]!='/'; i++){}
zCheckin = mprintf("%.*s", i, zName);
if( fossil_strcmp(zCheckin,"ckout")==0 && db_open_local(0)==0 ){
|
| ︙ | ︙ |
Changes to src/event.c.
| ︙ | ︙ | |||
67 68 69 70 71 72 73 |
int verboseFlag; /* True to show details */
/* wiki-read privilege is needed in order to read events.
*/
login_check_credentials();
if( !g.perm.RdWiki ){
| | | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
int verboseFlag; /* True to show details */
/* wiki-read privilege is needed in order to read events.
*/
login_check_credentials();
if( !g.perm.RdWiki ){
login_needed(g.anon.RdWiki);
return;
}
zEventId = P("name");
if( zEventId==0 ){ fossil_redirect_home(); return; }
zUuid = (char*)P("aid");
specRid = zUuid ? uuid_to_rid(zUuid, 0) : 0;
|
| ︙ | ︙ | |||
231 232 233 234 235 236 237 |
);
free(zTag);
/* Need both check-in and wiki-write or wiki-create privileges in order
** to edit/create an event.
*/
if( !g.perm.Write || (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){
| | | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
);
free(zTag);
/* Need both check-in and wiki-write or wiki-create privileges in order
** to edit/create an event.
*/
if( !g.perm.Write || (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){
login_needed(g.anon.Write && (rid ? g.anon.WrWiki : g.anon.NewWiki));
return;
}
/* Figure out the color */
if( rid ){
zClr = db_text("", "SELECT bgcolor FROM event WHERE objid=%d", rid);
}else{
|
| ︙ | ︙ |
Changes to src/finfo.c.
| ︙ | ︙ | |||
303 304 305 306 307 308 309 |
GraphContext *pGraph;
int brBg = P("brbg")!=0;
int uBg = P("ubg")!=0;
int fDebug = atoi(PD("debug","0"));
int fShowId = P("showid")!=0;
login_check_credentials();
| | | 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
GraphContext *pGraph;
int brBg = P("brbg")!=0;
int uBg = P("ubg")!=0;
int fDebug = atoi(PD("debug","0"));
int fShowId = P("showid")!=0;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
style_header("File History");
login_anonymous_available();
url_initialize(&url, "finfo");
if( brBg ) url_add_parameter(&url, "brbg", 0);
if( uBg ) url_add_parameter(&url, "ubg", 0);
baseCheckin = name_to_rid_www("ci");
zPrevDate[0] = 0;
|
| ︙ | ︙ |
Changes to src/info.c.
| ︙ | ︙ | |||
525 526 527 528 529 530 531 | const char *zRe; /* regex parameter */ ReCompiled *pRe = 0; /* regex */ const char *zW; /* URL param for ignoring whitespace */ const char *zPage = "vinfo"; /* Page that shows diffs */ const char *zPageHide = "ci"; /* Page that hides diffs */ login_check_credentials(); | | | 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 |
const char *zRe; /* regex parameter */
ReCompiled *pRe = 0; /* regex */
const char *zW; /* URL param for ignoring whitespace */
const char *zPage = "vinfo"; /* Page that shows diffs */
const char *zPageHide = "ci"; /* Page that hides diffs */
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
zName = P("name");
rid = name_to_rid_www("name");
if( rid==0 ){
style_header("Check-in Information Error");
@ No such object: %h(g.argv[2])
style_footer();
return;
|
| ︙ | ︙ | |||
655 656 657 658 659 660 661 |
const char *zTagName = db_column_text(&q2, 0);
@ | %z(href("%R/timeline?r=%T&unhide",zTagName))%h(zTagName)</a>
}
db_finalize(&q2);
/* The Download: line */
| | | | 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 |
const char *zTagName = db_column_text(&q2, 0);
@ | %z(href("%R/timeline?r=%T&unhide",zTagName))%h(zTagName)</a>
}
db_finalize(&q2);
/* The Download: line */
if( g.perm.Zip || g.anon.Zip ){
char *zUrl = mprintf("%R/tarball/%t-%S.tar.gz?uuid=%s",
zPJ, zUuid, zUuid);
@ </td></tr>
@ <tr><th>Downloads:</th><td>
@ %z(href("%s",zUrl))Tarball</a>
@ | %z(href("%R/zip/%t-%S.zip?uuid=%!S",zPJ,zUuid,zUuid))
@ ZIP archive</a>
fossil_free(zUrl);
}
@ </td></tr>
@ <tr><th>Other Links:</th>
@ <td>
@ %z(href("%R/tree?ci=%!S",zUuid))files</a>
@ | %z(href("%R/fileage?name=%!S",zUuid))file ages</a>
@ | %z(href("%R/tree?nofiles&type=tree&ci=%!S",zUuid))folders</a>
@ | %z(href("%R/artifact/%!S",zUuid))manifest</a>
if( g.perm.Write || g.anon.Write ){
@ | %z(href("%R/ci_edit?r=%!S",zUuid))edit</a>
}
@ </td>
@ </tr>
blob_reset(&projName);
}
@ </table>
|
| ︙ | ︙ | |||
771 772 773 774 775 776 777 | char *zUuid; char *zDate; Blob wiki; int modPending; const char *zModAction; login_check_credentials(); | | | 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 |
char *zUuid;
char *zDate;
Blob wiki;
int modPending;
const char *zModAction;
login_check_credentials();
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
rid = name_to_rid_www("name");
if( rid==0 || (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))==0 ){
style_header("Wiki Page Information Error");
@ No such object: %h(P("name"))
style_footer();
return;
}
|
| ︙ | ︙ | |||
989 990 991 992 993 994 995 | const char *zTo; const char *zRe; const char *zW; const char *zVerbose; const char *zGlob; ReCompiled *pRe = 0; login_check_credentials(); | | | 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 |
const char *zTo;
const char *zRe;
const char *zW;
const char *zVerbose;
const char *zGlob;
ReCompiled *pRe = 0;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
login_anonymous_available();
zRe = P("regex");
if( zRe ) re_compile(&pRe, zRe, 0);
zBranch = P("branch");
if( zBranch && zBranch[0] ){
cgi_replace_parameter("from", mprintf("root:%s", zBranch));
cgi_replace_parameter("to", zBranch);
|
| ︙ | ︙ | |||
1361 1362 1363 1364 1365 1366 1367 |
if( cnt>0 ){
@ Also attachment "%h(zFilename)" to
}else{
@ Attachment "%h(zFilename)" to
}
objType |= OBJTYPE_ATTACHMENT;
if( strlen(zTarget)==UUID_SIZE && validate16(zTarget,UUID_SIZE) ){
| | | | 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 |
if( cnt>0 ){
@ Also attachment "%h(zFilename)" to
}else{
@ Attachment "%h(zFilename)" to
}
objType |= OBJTYPE_ATTACHMENT;
if( strlen(zTarget)==UUID_SIZE && validate16(zTarget,UUID_SIZE) ){
if( g.perm.Hyperlink && (g.perm.RdTkt || g.anon.RdTkt) ){
@ ticket [%z(href("%R/tktview?name=%!S",zTarget))%S(zTarget)</a>]
}else{
@ ticket [%S(zTarget)]
}
}else{
if( g.perm.Hyperlink && (g.perm.RdWiki || g.anon.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");
|
| ︙ | ︙ | |||
1419 1420 1421 1422 1423 1424 1425 | const char *zRe; const char *zW; /* URL param for ignoring whitespace */ ReCompiled *pRe = 0; u64 diffFlags; u32 objdescFlags = 0; login_check_credentials(); | | | 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 |
const char *zRe;
const char *zW; /* URL param for ignoring whitespace */
ReCompiled *pRe = 0;
u64 diffFlags;
u32 objdescFlags = 0;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
v1 = name_to_rid_www("v1");
v2 = name_to_rid_www("v2");
if( v1==0 || v2==0 ) fossil_redirect_home();
zRe = P("regex");
if( zRe ) re_compile(&pRe, zRe, 0);
if( P("verbose")!=0 ) objdescFlags |= OBJDESC_DETAIL;
isPatch = P("patch")!=0;
|
| ︙ | ︙ | |||
1504 1505 1506 1507 1508 1509 1510 |
int rid;
char *zUuid;
const char *zMime;
Blob content;
rid = name_to_rid_www("name");
login_check_credentials();
| | | 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 |
int rid;
char *zUuid;
const char *zMime;
Blob content;
rid = name_to_rid_www("name");
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
if( rid==0 ) fossil_redirect_home();
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
if( fossil_strcmp(P("name"), zUuid)==0 && login_is_nobody() ){
g.isConst = 1;
}
free(zUuid);
zMime = P("m");
|
| ︙ | ︙ | |||
1601 1602 1603 1604 1605 1606 1607 |
Blob content;
Blob downloadName;
char *zUuid;
u32 objdescFlags = 0;
rid = name_to_rid_www("name");
login_check_credentials();
| | | 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 |
Blob content;
Blob downloadName;
char *zUuid;
u32 objdescFlags = 0;
rid = name_to_rid_www("name");
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); 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=%Q", zUuid) ){
style_submenu_element("Unshun","Unshun", "%s/shun?accept=%s&sub=1#delshun",
g.zTop, zUuid);
}else{
|
| ︙ | ︙ | |||
1787 1788 1789 1790 1791 1792 1793 |
rid = artifact_from_ci_and_filename_www();
}
if( rid==0 ){
rid = name_to_rid_www("name");
}
login_check_credentials();
| | | 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 |
rid = artifact_from_ci_and_filename_www();
}
if( rid==0 ){
rid = name_to_rid_www("name");
}
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); 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=%Q", zUuid) ){
style_submenu_element("Unshun","Unshun", "%s/shun?accept=%s&sub=1#accshun",
g.zTop, zUuid);
}else{
|
| ︙ | ︙ | |||
1902 1903 1904 1905 1906 1907 1908 | const char *zUuid; char zTktName[UUID_SIZE+1]; Manifest *pTktChng; int modPending; const char *zModAction; char *zTktTitle; login_check_credentials(); | | | 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 |
const char *zUuid;
char zTktName[UUID_SIZE+1];
Manifest *pTktChng;
int modPending;
const char *zModAction;
char *zTktTitle;
login_check_credentials();
if( !g.perm.RdTkt ){ login_needed(g.anon.RdTkt); 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=%Q", zUuid) ){
style_submenu_element("Unshun","Unshun", "%s/shun?accept=%s&sub=1#accshun",
g.zTop, zUuid);
|
| ︙ | ︙ | |||
2274 2275 2276 2277 2278 2279 2280 | const char *zChngTime = 0; /* Value of chngtime= query param, if any */ char *zUuid; Blob comment; char *zBranchName = 0; Stmt q; login_check_credentials(); | | | 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 |
const char *zChngTime = 0; /* Value of chngtime= query param, if any */
char *zUuid;
Blob comment;
char *zBranchName = 0;
Stmt q;
login_check_credentials();
if( !g.perm.Write ){ login_needed(g.anon.Write); return; }
rid = name_to_typed_rid(P("r"), "ci");
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
" FROM event WHERE objid=%d", rid);
if( zComment==0 ) fossil_redirect_home();
if( P("cancel") ){
cgi_redirectf("ci?name=%s", zUuid);
|
| ︙ | ︙ |
Changes to src/login.c.
| ︙ | ︙ | |||
350 351 352 353 354 355 356 |
/* To logout, change the cookie value to an empty string */
cgi_set_cookie(cookie, "",
login_cookie_path(), -86400);
db_multi_exec("UPDATE user SET cookie=NULL, ipaddr=NULL, "
" cexpire=0 WHERE uid=%d"
" AND login NOT IN ('anonymous','nobody',"
" 'developer','reader')", g.userUid);
| | | < < < < | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
/* To logout, change the cookie value to an empty string */
cgi_set_cookie(cookie, "",
login_cookie_path(), -86400);
db_multi_exec("UPDATE user SET cookie=NULL, ipaddr=NULL, "
" cexpire=0 WHERE uid=%d"
" AND login NOT IN ('anonymous','nobody',"
" 'developer','reader')", g.userUid);
cgi_replace_parameter(cookie, NULL);
cgi_replace_parameter("anon", NULL);
}
}
/*
** Return true if the prefix of zStr matches zPattern. Return false if
** they are different.
**
|
| ︙ | ︙ | |||
465 466 467 468 469 470 471 |
** removed. Use this page as a placeholder in older installations.
*/
void login_page(void){
const char *zUsername, *zPasswd;
const char *zNew1, *zNew2;
const char *zAnonPw = 0;
const char *zGoto = P("g");
| | | 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
** removed. Use this page as a placeholder in older installations.
*/
void login_page(void){
const char *zUsername, *zPasswd;
const char *zNew1, *zNew2;
const char *zAnonPw = 0;
const char *zGoto = P("g");
int anonFlag = PB("anon");
char *zErrMsg = "";
int uid; /* User id logged in user */
char *zSha1Pw;
const char *zIpAddr; /* IP address of requestor */
const char *zReferer;
login_check_credentials();
|
| ︙ | ︙ | |||
487 488 489 490 491 492 493 |
cgi_redirectf("%s%s%s", g.zHttpsURL, P("PATH_INFO"), zQS);
return;
}
sqlite3_create_function(g.db, "constant_time_cmp", 2, SQLITE_UTF8, 0,
constant_time_cmp_function, 0, 0);
zUsername = P("u");
zPasswd = P("p");
| < | > | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 |
cgi_redirectf("%s%s%s", g.zHttpsURL, P("PATH_INFO"), zQS);
return;
}
sqlite3_create_function(g.db, "constant_time_cmp", 2, SQLITE_UTF8, 0,
constant_time_cmp_function, 0, 0);
zUsername = P("u");
zPasswd = P("p");
if( P("out") ){
login_clear_login_data();
redirect_to_g();
return;
}
if( g.perm.Password && zPasswd
&& (zNew1 = P("n1"))!=0 && (zNew2 = P("n2"))!=0
){
/* The user requests a password change */
zSha1Pw = sha1_shared_secret(zPasswd, g.zLogin, 0);
if( db_int(1, "SELECT 0 FROM user"
|
| ︙ | ︙ | |||
575 576 577 578 579 580 581 |
login_set_user_cookie(zUsername, uid, NULL);
redirect_to_g();
}
}
style_header("Login/Logout");
style_adunit_config(ADUNIT_OFF);
@ %s(zErrMsg)
| | | > > > > > > > > > > > > | 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 |
login_set_user_cookie(zUsername, uid, NULL);
redirect_to_g();
}
}
style_header("Login/Logout");
style_adunit_config(ADUNIT_OFF);
@ %s(zErrMsg)
if( zGoto ){
char *zAbbrev = fossil_strdup(zGoto);
int i;
for(i=0; zAbbrev[i] && zAbbrev[i]!='?'; i++){}
zAbbrev[i] = 0;
if( g.zLogin ){
@ <p>Use a different login with greater privilege that <b>%h(g.zLogin)</b>
@ to access <b>%h(zAbbrev)</b>.
}else if( anonFlag ){
@ <p>Login as <b>anonymous</b> or any named user
@ to access page <b>%h(zAbbrev)</b>.
}else{
@ <p>Login as a named user to access page <b>%h(zAbbrev)</b>.
}
}
form_begin(0, "%R/login");
if( zGoto ){
@ <input type="hidden" name="g" value="%h(zGoto)" />
}else if( zReferer && strncmp(g.zBaseURL, zReferer, strlen(g.zBaseURL))==0 ){
@ <input type="hidden" name="g" value="%h(zReferer)" />
}
|
| ︙ | ︙ | |||
622 623 624 625 626 627 628 |
char *zSSL = mprintf("https:%s", &g.zBaseURL[5]);
@ if( form.u.value!="anonymous" ){
@ form.action = "%h(zSSL)/login";
@ }
}
@ }
@ </script>
| | < < < < < < > | | 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 |
char *zSSL = mprintf("https:%s", &g.zBaseURL[5]);
@ if( form.u.value!="anonymous" ){
@ form.action = "%h(zSSL)/login";
@ }
}
@ }
@ </script>
if( g.zLogin ){
@ <p>You are currently logged in as <b>%h(g.zLogin)</b></p>
}
@ <p>By pressing the Login button, you grant permission to store an
@ access token for this site in a cookie.</p>
if( db_get_boolean("self-register", 0) ){
@ <p>If you do not have an account, you can
@ <a href="%R/register?g=%T(P("G"))">create one</a>.
}
if( zAnonPw ){
unsigned int uSeed = captcha_seed();
const char *zDecoded = captcha_decode(uSeed);
|
| ︙ | ︙ | |||
809 810 811 812 813 814 815 816 817 818 819 820 821 822 |
** This routine examines the login cookie to see if it exists and
** is valid. If the login cookie checks out, it then sets global
** variables appropriately.
**
** g.userUid Database USER.UID value. Might be -1 for "nobody"
** g.zLogin Database USER.LOGIN value. NULL for user "nobody"
** g.perm Permissions granted to this user
** g.isHuman True if the user is human, not a spider or robot
**
*/
void login_check_credentials(void){
int uid = 0; /* User id */
const char *zCookie; /* Text of the login cookie */
const char *zIpAddr; /* Raw IP address of the requestor */
| > | 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 |
** This routine examines the login cookie to see if it exists and
** is valid. If the login cookie checks out, it then sets global
** variables appropriately.
**
** g.userUid Database USER.UID value. Might be -1 for "nobody"
** g.zLogin Database USER.LOGIN value. NULL for user "nobody"
** g.perm Permissions granted to this user
** g.anon Permissions that would be available to anonymous
** g.isHuman True if the user is human, not a spider or robot
**
*/
void login_check_credentials(void){
int uid = 0; /* User id */
const char *zCookie; /* Text of the login cookie */
const char *zIpAddr; /* Raw IP address of the requestor */
|
| ︙ | ︙ | |||
1004 1005 1006 1007 1008 1009 1010 |
static int login_anon_once = 1;
/*
** Add the default privileges of users "nobody" and "anonymous" as appropriate
** for the user g.zLogin.
*/
void login_set_anon_nobody_capabilities(void){
| | | > | > > | | > | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 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 |
static int login_anon_once = 1;
/*
** Add the default privileges of users "nobody" and "anonymous" as appropriate
** for the user g.zLogin.
*/
void login_set_anon_nobody_capabilities(void){
if( login_anon_once ){
const char *zCap;
/* All users get privileges from "nobody" */
zCap = db_text("", "SELECT cap FROM user WHERE login = 'nobody'");
login_set_capabilities(zCap, 0);
zCap = db_text("", "SELECT cap FROM user WHERE login = 'anonymous'");
if( g.zLogin && fossil_strcmp(g.zLogin, "nobody")!=0 ){
/* All logged-in users inherit privileges from "anonymous" */
login_set_capabilities(zCap, 0);
}else{
/* Record the privileges of anonymous in g.anon */
login_set_capabilities(zCap, LOGIN_ANON);
}
login_anon_once = 0;
}
}
/*
** Flags passed into the 2nd argument of login_set/replace_capabilities().
*/
#if INTERFACE
#define LOGIN_IGNORE_UV 0x01 /* Ignore "u" and "v" */
#define LOGIN_ANON 0x02 /* Use g.anon instead of g.perm */
#endif
/*
** Adds all capability flags in zCap to g.perm or g.anon.
*/
void login_set_capabilities(const char *zCap, unsigned flags){
int i;
FossilUserPerms *p = (flags & LOGIN_ANON) ? &g.anon : &g.perm;
if(NULL==zCap){
return;
}
for(i=0; zCap[i]; i++){
switch( zCap[i] ){
case 's': p->Setup = 1; /* Fall thru into Admin */
case 'a': p->Admin = p->RdTkt = p->WrTkt = p->Zip =
p->RdWiki = p->WrWiki = p->NewWiki =
p->ApndWiki = p->Hyperlink = p->Clone =
p->NewTkt = p->Password = p->RdAddr =
p->TktFmt = p->Attach = p->ApndTkt =
p->ModWiki = p->ModTkt = 1;
/* Fall thru into Read/Write */
case 'i': p->Read = p->Write = 1; break;
case 'o': p->Read = 1; break;
case 'z': p->Zip = 1; break;
case 'd': p->Delete = 1; break;
case 'h': p->Hyperlink = 1; break;
case 'g': p->Clone = 1; break;
case 'p': p->Password = 1; break;
case 'j': p->RdWiki = 1; break;
case 'k': p->WrWiki = p->RdWiki = p->ApndWiki =1; break;
case 'm': p->ApndWiki = 1; break;
case 'f': p->NewWiki = 1; break;
case 'l': p->ModWiki = 1; break;
case 'e': p->RdAddr = 1; break;
case 'r': p->RdTkt = 1; break;
case 'n': p->NewTkt = 1; break;
case 'w': p->WrTkt = p->RdTkt = p->NewTkt =
p->ApndTkt = 1; break;
case 'c': p->ApndTkt = 1; break;
case 'q': p->ModTkt = 1; break;
case 't': p->TktFmt = 1; break;
case 'b': p->Attach = 1; break;
case 'x': p->Private = 1; break;
/* The "u" privileges is a little different. It recursively
** inherits all privileges of the user named "reader" */
case 'u': {
if( (flags & LOGIN_IGNORE_UV)==0 ){
const char *zUser;
zUser = db_text("", "SELECT cap FROM user WHERE login='reader'");
|
| ︙ | ︙ | |||
1108 1109 1110 1111 1112 1113 1114 | } /* ** If the current login lacks any of the capabilities listed in ** the input, then return 0. If all capabilities are present, then ** return 1. */ | | > | | | | | | | | | | | | | | | | | | | | | | | | 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 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 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 |
}
/*
** If the current login lacks any of the capabilities listed in
** the input, then return 0. If all capabilities are present, then
** return 1.
*/
int login_has_capability(const char *zCap, int nCap, u32 flgs){
int i;
int rc = 1;
FossilUserPerms *p = (flgs & LOGIN_ANON) ? &g.anon : &g.perm;
if( nCap<0 ) nCap = strlen(zCap);
for(i=0; i<nCap && rc && zCap[i]; i++){
switch( zCap[i] ){
case 'a': rc = p->Admin; break;
case 'b': rc = p->Attach; break;
case 'c': rc = p->ApndTkt; break;
case 'd': rc = p->Delete; break;
case 'e': rc = p->RdAddr; break;
case 'f': rc = p->NewWiki; break;
case 'g': rc = p->Clone; break;
case 'h': rc = p->Hyperlink; break;
case 'i': rc = p->Write; break;
case 'j': rc = p->RdWiki; break;
case 'k': rc = p->WrWiki; break;
case 'l': rc = p->ModWiki; break;
case 'm': rc = p->ApndWiki; break;
case 'n': rc = p->NewTkt; break;
case 'o': rc = p->Read; break;
case 'p': rc = p->Password; break;
case 'q': rc = p->ModTkt; break;
case 'r': rc = p->RdTkt; break;
case 's': rc = p->Setup; break;
case 't': rc = p->TktFmt; break;
/* case 'u': READER */
/* case 'v': DEVELOPER */
case 'w': rc = p->WrTkt; break;
case 'x': rc = p->Private; break;
/* case 'y': */
case 'z': rc = p->Zip; break;
default: rc = 0; break;
}
}
return rc;
}
/*
|
| ︙ | ︙ | |||
1193 1194 1195 1196 1197 1198 1199 | return (g.zLogin && g.zLogin[0]) ? g.zLogin : "nobody"; } /* ** Call this routine when the credential check fails. It causes ** a redirect to the "login" page. */ | | > > > > > > | > > > > > > | < < < | 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 |
return (g.zLogin && g.zLogin[0]) ? g.zLogin : "nobody";
}
/*
** Call this routine when the credential check fails. It causes
** a redirect to the "login" page.
*/
void login_needed(int anonOk){
#ifdef FOSSIL_ENABLE_JSON
if(g.json.isJsonMode){
json_err( FSL_JSON_E_DENIED, NULL, 1 );
fossil_exit(0);
/* NOTREACHED */
assert(0);
}else
#endif /* FOSSIL_ENABLE_JSON */
{
const char *zUrl = PD("REQUEST_URI", "index");
const char *zQS = P("QUERY_STRING");
Blob redir;
blob_init(&redir, 0, 0);
if( login_wants_https_redirect() ){
blob_appendf(&redir, "%s/login?g=%T", g.zHttpsURL, zUrl);
}else{
blob_appendf(&redir, "%R/login?g=%T", zUrl);
}
if( anonOk ) blob_append(&redir, "&anon", 5);
if( zQS ){
blob_appendf(&redir, "&%s", zQS);
}
cgi_redirect(blob_str(&redir));
/* 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 && g.anon.Hyperlink ){
const char *zUrl = PD("REQUEST_URI", "index");
@ <p>Many <span class="disabled">hyperlinks are disabled.</span><br />
@ Use <a href="%R/login?anon=1&g=%T(zUrl)">anonymous login</a>
@ to enable hyperlinks.</p>
}
}
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
191 192 193 194 195 196 197 | int comFmtFlags; /* Zero or more "COMMENT_PRINT_*" bit flags */ /* Information used to populate the RCVFROM table */ int rcvid; /* The rcvid. 0 if not yet defined. */ char *zIpAddr; /* The remote IP address */ char *zNonce; /* The nonce used for login */ | | > > > | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | int comFmtFlags; /* Zero or more "COMMENT_PRINT_*" bit flags */ /* Information used to populate the RCVFROM table */ int rcvid; /* The rcvid. 0 if not yet defined. */ char *zIpAddr; /* The remote IP address */ char *zNonce; /* The nonce used for login */ /* permissions available to current user */ struct FossilUserPerms perm; /* permissions available to user "anonymous" */ struct FossilUserPerms anon; #ifdef FOSSIL_ENABLE_TCL /* all Tcl related context necessary for integration */ struct TclContext tcl; #endif /* For defense against Cross-site Request Forgery attacks */ |
| ︙ | ︙ |
Changes to src/moderate.c.
| ︙ | ︙ | |||
142 143 144 145 146 147 148 |
** Show all pending moderation request
*/
void modreq_page(void){
Blob sql;
Stmt q;
login_check_credentials();
| | > > > | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
** Show all pending moderation request
*/
void modreq_page(void){
Blob sql;
Stmt q;
login_check_credentials();
if( !g.perm.RdWiki && !g.perm.RdTkt ){
login_needed(g.anon.RdWiki && g.anon.RdTkt);
return;
}
style_header("Pending Moderation Requests");
@ <h2>All Pending Moderation Requests</h2>
if( moderation_table_exists() ){
blob_init(&sql, timeline_query_for_www(), -1);
blob_append_sql(&sql,
" AND event.objid IN (SELECT objid FROM modreq)"
" ORDER BY event.mtime DESC"
|
| ︙ | ︙ |
Changes to src/name.c.
| ︙ | ︙ | |||
985 986 987 988 989 990 991 |
Stmt q;
int s = atoi(PD("s","0"));
int n = atoi(PD("n","5000"));
int mx = db_int(0, "SELECT max(rid) FROM blob");
char *zRange;
login_check_credentials();
| | | 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 |
Stmt q;
int s = atoi(PD("s","0"));
int n = atoi(PD("n","5000"));
int mx = db_int(0, "SELECT max(rid) FROM blob");
char *zRange;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
style_header("List Of Artifacts");
if( mx>n && P("s")==0 ){
int i;
@ <p>Select a range of artifacts to view:</p>
@ <ul>
for(i=1; i<=mx; i+=n){
@ <li> %z(href("%R/bloblist?s=%d&n=%d",i,n))
|
| ︙ | ︙ | |||
1081 1082 1083 1084 1085 1086 1087 |
char zPrev[UUID_SIZE+1];
struct {
int cnt;
char *azHit[MAX_COLLIDE];
char z[UUID_SIZE+1];
} aCollide[UUID_SIZE+1];
login_check_credentials();
| | | 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 |
char zPrev[UUID_SIZE+1];
struct {
int cnt;
char *azHit[MAX_COLLIDE];
char z[UUID_SIZE+1];
} aCollide[UUID_SIZE+1];
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
memset(aCollide, 0, sizeof(aCollide));
memset(zPrev, 0, sizeof(zPrev));
db_prepare(&q,"SELECT uuid FROM blob ORDER BY 1");
while( db_step(&q)==SQLITE_ROW ){
const char *zUuid = db_column_text(&q,0);
int n = db_column_bytes(&q,0);
int i;
|
| ︙ | ︙ |
Changes to src/path.c.
| ︙ | ︙ | |||
541 542 543 544 545 546 547 |
** This page is intended for for testing purposes only and may change
** or be discontinued without notice.
*/
void test_rename_list_page(void){
Stmt q;
login_check_credentials();
| | | 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 |
** This page is intended for for testing purposes only and may change
** or be discontinued without notice.
*/
void test_rename_list_page(void){
Stmt q;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
style_header("List Of File Name Changes");
@ <h3>NB: Experimental Page</h3>
@ <table border="1" width="100%%">
@ <tr><th>Date & Time</th>
@ <th>Old Name</th>
@ <th>New Name</th>
@ <th>Check-in</th></tr>
|
| ︙ | ︙ |
Changes to src/report.c.
| ︙ | ︙ | |||
38 39 40 41 42 43 44 | const char *zScript; Blob ril; /* Report Item List */ Stmt q; int rn = 0; int cnt = 0; login_check_credentials(); | | > > > | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
const char *zScript;
Blob ril; /* Report Item List */
Stmt q;
int rn = 0;
int cnt = 0;
login_check_credentials();
if( !g.perm.RdTkt && !g.perm.NewTkt ){
login_needed(g.anon.RdTkt || g.anon.NewTkt);
return;
}
style_header("Ticket Main Menu");
ticket_standard_submenu(T_ALL_BUT(T_REPLIST));
if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST<br />\n", -1);
zScript = ticket_reportlist_code();
if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST_SCRIPT<br />\n", -1);
blob_zero(&ril);
|
| ︙ | ︙ | |||
291 292 293 294 295 296 297 |
const char *zSQL;
const char *zOwner;
const char *zClrKey;
Stmt q;
login_check_credentials();
if( !g.perm.TktFmt ){
| | | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
const char *zSQL;
const char *zOwner;
const char *zClrKey;
Stmt q;
login_check_credentials();
if( !g.perm.TktFmt ){
login_needed(g.anon.TktFmt);
return;
}
rn = atoi(PD("rn","0"));
db_prepare(&q, "SELECT title, sqlcode, owner, cols "
"FROM reportfmt WHERE rn=%d",rn);
style_header("SQL For Report Format Number %d", rn);
if( db_step(&q)!=SQLITE_ROW ){
|
| ︙ | ︙ | |||
341 342 343 344 345 346 347 |
const char *zOwner;
const char *zClrKey;
char *zSQL;
char *zErr = 0;
login_check_credentials();
if( !g.perm.TktFmt ){
| | | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 |
const char *zOwner;
const char *zClrKey;
char *zSQL;
char *zErr = 0;
login_check_credentials();
if( !g.perm.TktFmt ){
login_needed(g.anon.TktFmt);
return;
}
/*view_add_functions(0);*/
rn = atoi(PD("rn","0"));
zTitle = P("t");
zOwner = PD("w",g.zLogin);
z = P("s");
|
| ︙ | ︙ | |||
1076 1077 1078 1079 1080 1081 1082 | char *zClrKey; int tabs; Stmt q; char *zErr1 = 0; char *zErr2 = 0; login_check_credentials(); | | | 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 |
char *zClrKey;
int tabs;
Stmt q;
char *zErr1 = 0;
char *zErr2 = 0;
login_check_credentials();
if( !g.perm.RdTkt ){ login_needed(g.anon.RdTkt); return; }
rn = atoi(PD("rn","0"));
if( rn==0 ){
cgi_redirect("reportlist");
return;
}
tabs = P("tablist")!=0;
/* view_add_functions(tabs); */
|
| ︙ | ︙ |
Changes to src/setup.c.
| ︙ | ︙ | |||
57 58 59 60 61 62 63 |
/*
** WEBPAGE: /setup
*/
void setup_page(void){
login_check_credentials();
if( !g.perm.Setup ){
| | | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
/*
** WEBPAGE: /setup
*/
void setup_page(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
}
style_header("Server Administration");
/* Make sure the header contains <base href="...">. Issue a warning
** if it does not. */
if( !cgi_header_contains("<base href=") ){
|
| ︙ | ︙ | |||
150 151 152 153 154 155 156 |
*/
void setup_ulist(void){
Stmt s;
int prevLevel = 0;
login_check_credentials();
if( !g.perm.Admin ){
| | | 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
*/
void setup_ulist(void){
Stmt s;
int prevLevel = 0;
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
style_submenu_element("Add", "Add User", "setup_uedit");
style_header("User List");
@ <table class="usetupLayoutTable">
@ <tr><td class="usetupColumnLayout">
|
| ︙ | ︙ | |||
334 335 336 337 338 339 340 | char *inherit[128]; int a[128]; const char *oa[128]; /* Must have ADMIN privileges to access this page */ login_check_credentials(); | | | 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
char *inherit[128];
int a[128];
const char *oa[128];
/* Must have ADMIN privileges to access this page
*/
login_check_credentials();
if( !g.perm.Admin ){ login_needed(0); return; }
/* Check to see if an ADMIN user is trying to edit a SETUP account.
** Don't allow that.
*/
zId = PD("id", "0");
uid = atoi(zId);
if( zId && !g.perm.Setup && uid>0 ){
|
| ︙ | ︙ | |||
996 997 998 999 1000 1001 1002 |
/*
** WEBPAGE: setup_access
*/
void setup_access(void){
login_check_credentials();
if( !g.perm.Setup ){
| | > | 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 |
/*
** WEBPAGE: setup_access
*/
void setup_access(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
style_header("Access Control Settings");
db_begin_transaction();
@ <form action="%s(g.zTop)/setup_access" method="post"><div>
login_insert_csrf_secret();
@ <hr />
|
| ︙ | ︙ | |||
1201 1202 1203 1204 1205 1206 1207 |
const char *zRepo = PD("repo", "");
const char *zLogin = PD("login", "");
const char *zPw = PD("pw", "");
const char *zNewName = PD("newname", "New Login Group");
login_check_credentials();
if( !g.perm.Setup ){
| | > | 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 |
const char *zRepo = PD("repo", "");
const char *zLogin = PD("login", "");
const char *zPw = PD("pw", "");
const char *zNewName = PD("newname", "New Login Group");
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
file_canonical_name(g.zRepositoryName, &fullName, 0);
zSelfRepo = fossil_strdup(blob_str(&fullName));
blob_reset(&fullName);
if( P("join")!=0 ){
login_group_join(zRepo, zLogin, zPw, zNewName, &zErrMsg);
}else if( P("leave") ){
|
| ︙ | ︙ | |||
1313 1314 1315 1316 1317 1318 1319 |
"1", "HH:MM:SS",
"2", "YYYY-MM-DD HH:MM",
"3", "YYMMDD HH:MM",
"4", "(off)"
};
login_check_credentials();
if( !g.perm.Setup ){
| | > | 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 |
"1", "HH:MM:SS",
"2", "YYYY-MM-DD HH:MM",
"3", "YYMMDD HH:MM",
"4", "(off)"
};
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
style_header("Timeline Display Preferences");
db_begin_transaction();
@ <form action="%s(g.zTop)/setup_timeline" method="post"><div>
login_insert_csrf_secret();
|
| ︙ | ︙ | |||
1391 1392 1393 1394 1395 1396 1397 |
** WEBPAGE: setup_settings
*/
void setup_settings(void){
Setting const *pSet;
login_check_credentials();
if( !g.perm.Setup ){
| | > | 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 |
** WEBPAGE: setup_settings
*/
void setup_settings(void){
Setting const *pSet;
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
(void) aCmdHelp; /* NOTE: Silence compiler warning. */
style_header("Settings");
if(!g.repositoryOpen){
/* Provide read-only access to versioned settings,
but only if no repo file was explicitly provided. */
|
| ︙ | ︙ | |||
1471 1472 1473 1474 1475 1476 1477 |
/*
** WEBPAGE: setup_config
*/
void setup_config(void){
login_check_credentials();
if( !g.perm.Setup ){
| | > | 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 |
/*
** WEBPAGE: setup_config
*/
void setup_config(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
style_header("WWW Configuration");
db_begin_transaction();
@ <form action="%s(g.zTop)/setup_config" method="post"><div>
login_insert_csrf_secret();
@ <hr />
|
| ︙ | ︙ | |||
1549 1550 1551 1552 1553 1554 1555 |
/*
** WEBPAGE: setup_editcss
*/
void setup_editcss(void){
login_check_credentials();
if( !g.perm.Setup ){
| | > | 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 |
/*
** WEBPAGE: setup_editcss
*/
void setup_editcss(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
db_begin_transaction();
if( P("clear")!=0 ){
db_multi_exec("DELETE FROM config WHERE name='css'");
cgi_replace_parameter("css", builtin_text("skins/default/css.txt"));
db_end_transaction(0);
cgi_redirect("setup_editcss");
|
| ︙ | ︙ | |||
1594 1595 1596 1597 1598 1599 1600 |
/*
** WEBPAGE: setup_header
*/
void setup_header(void){
login_check_credentials();
if( !g.perm.Setup ){
| | > | 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 |
/*
** WEBPAGE: setup_header
*/
void setup_header(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
db_begin_transaction();
if( P("clear")!=0 ){
db_multi_exec("DELETE FROM config WHERE name='header'");
cgi_replace_parameter("header", builtin_text("skins/default/header.txt"));
}else if( P("submit")!=0 ){
textarea_attribute(0, 0, 0, "header", "header",
|
| ︙ | ︙ | |||
1658 1659 1660 1661 1662 1663 1664 |
/*
** WEBPAGE: setup_footer
*/
void setup_footer(void){
login_check_credentials();
if( !g.perm.Setup ){
| | > | 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 |
/*
** WEBPAGE: setup_footer
*/
void setup_footer(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
db_begin_transaction();
if( P("clear")!=0 ){
db_multi_exec("DELETE FROM config WHERE name='footer'");
cgi_replace_parameter("footer", builtin_text("skins/default/footer.txt"));
}
|
| ︙ | ︙ | |||
1695 1696 1697 1698 1699 1700 1701 |
/*
** WEBPAGE: setup_modreq
*/
void setup_modreq(void){
login_check_credentials();
if( !g.perm.Setup ){
| | > | 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 |
/*
** WEBPAGE: setup_modreq
*/
void setup_modreq(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
style_header("Moderator For Wiki And Tickets");
db_begin_transaction();
@ <form action="%R/setup_modreq" method="post"><div>
login_insert_csrf_secret();
@ <hr />
|
| ︙ | ︙ | |||
1739 1740 1741 1742 1743 1744 1745 |
/*
** WEBPAGE: setup_adunit
*/
void setup_adunit(void){
login_check_credentials();
if( !g.perm.Setup ){
| | > | 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 |
/*
** WEBPAGE: setup_adunit
*/
void setup_adunit(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
db_begin_transaction();
if( P("clear")!=0 ){
db_multi_exec("DELETE FROM config WHERE name GLOB 'adunit*'");
cgi_replace_parameter("adunit","");
}
|
| ︙ | ︙ | |||
1820 1821 1822 1823 1824 1825 1826 |
zLogoMime = PD("logoim:mimetype","image/gif");
}
if( szBgImg>0 ){
zBgMime = PD("bgim:mimetype","image/gif");
}
login_check_credentials();
if( !g.perm.Setup ){
| | > | 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 |
zLogoMime = PD("logoim:mimetype","image/gif");
}
if( szBgImg>0 ){
zBgMime = PD("bgim:mimetype","image/gif");
}
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
db_begin_transaction();
if( P("setlogo")!=0 && zLogoMime && zLogoMime[0] && szLogoImg>0 ){
Blob img;
Stmt ins;
blob_init(&img, aLogoImg, szLogoImg);
db_prepare(&ins,
|
| ︙ | ︙ | |||
1959 1960 1961 1962 1963 1964 1965 |
** Run raw SQL commands against the database file using the web interface.
*/
void sql_page(void){
const char *zQ = P("q");
int go = P("go")!=0;
login_check_credentials();
if( !g.perm.Setup ){
| | > | 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 |
** Run raw SQL commands against the database file using the web interface.
*/
void sql_page(void){
const char *zQ = P("q");
int go = P("go")!=0;
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
db_begin_transaction();
style_header("Raw SQL Commands");
@ <p><b>Caution:</b> There are no restrictions on the SQL that can be
@ run by this page. You can do serious and irrepairable damage to the
@ repository. Proceed with extreme caution.</p>
@
|
| ︙ | ︙ | |||
2080 2081 2082 2083 2084 2085 2086 |
** may be run as well.
*/
void th1_page(void){
const char *zQ = P("q");
int go = P("go")!=0;
login_check_credentials();
if( !g.perm.Setup ){
| | > | 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 |
** may be run as well.
*/
void th1_page(void){
const char *zQ = P("q");
int go = P("go")!=0;
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
db_begin_transaction();
style_header("Raw TH1 Commands");
@ <p><b>Caution:</b> There are no restrictions on the TH1 that can be
@ run by this page. If Tcl integration was enabled at compile-time and
@ the "tcl" setting is enabled, Tcl commands may be run as well.</p>
@
|
| ︙ | ︙ | |||
2140 2141 2142 2143 2144 2145 2146 |
Stmt stLog = empty_Stmt;
Blob qLog = empty_blob;
int limit;
int fLogEnabled;
int counter = 0;
login_check_credentials();
if( !g.perm.Setup && !g.perm.Admin ){
| | > | 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 |
Stmt stLog = empty_Stmt;
Blob qLog = empty_blob;
int limit;
int fLogEnabled;
int counter = 0;
login_check_credentials();
if( !g.perm.Setup && !g.perm.Admin ){
login_needed(0);
return;
}
style_header("Admin Log");
create_admin_log_table();
limit = atoi(PD("n","20"));
fLogEnabled = db_get_boolean("admin-log", 0);
@ <div>Admin logging is %s(fLogEnabled?"on":"off").</div>
|
| ︙ | ︙ | |||
2197 2198 2199 2200 2201 2202 2203 |
** WEBPAGE: srchsetup
**
** Configure the search engine.
*/
void page_srchsetup(){
login_check_credentials();
if( !g.perm.Setup && !g.perm.Admin ){
| | > | 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 |
** WEBPAGE: srchsetup
**
** Configure the search engine.
*/
void page_srchsetup(){
login_check_credentials();
if( !g.perm.Setup && !g.perm.Admin ){
login_needed(0);
return;
}
style_header("Search Configuration");
@ <form action="%s(g.zTop)/srchsetup" method="post"><div>
login_insert_csrf_secret();
@ <div style="text-align:center;font-weight:bold;">
@ Server-specific settings that affect the
@ <a href="%R/search">/search</a> webpage.
|
| ︙ | ︙ |
Changes to src/shun.c.
| ︙ | ︙ | |||
47 48 49 50 51 52 53 |
const char *zRcvid = P("rcvid");
int nRcvid = 0;
int numRows = 3;
char *zCanonical = 0;
login_check_credentials();
if( !g.perm.Admin ){
| | > | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
const char *zRcvid = P("rcvid");
int nRcvid = 0;
int numRows = 3;
char *zCanonical = 0;
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
if( P("rebuild") ){
db_close(1);
db_open_repository(g.zRepositoryName);
db_begin_transaction();
rebuild_db(0, 0, 0);
admin_log("Rebuilt database.");
|
| ︙ | ︙ | |||
299 300 301 302 303 304 305 |
int ofst = atoi(PD("ofst","0"));
int showAll = P("all")!=0;
int cnt;
Stmt q;
login_check_credentials();
if( !g.perm.Admin ){
| | > | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
int ofst = atoi(PD("ofst","0"));
int showAll = P("all")!=0;
int cnt;
Stmt q;
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
style_header("Artifact Receipts");
if( showAll ){
ofst = 0;
}else{
style_submenu_element("All", "All", "rcvfromlist?all=1");
}
|
| ︙ | ︙ | |||
379 380 381 382 383 384 385 |
*/
void rcvfrom_page(void){
int rcvid = atoi(PD("rcvid","0"));
Stmt q;
login_check_credentials();
if( !g.perm.Admin ){
| | > | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
*/
void rcvfrom_page(void){
int rcvid = atoi(PD("rcvid","0"));
Stmt q;
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
style_header("Artifact Receipt %d", rcvid);
if( db_exists(
"SELECT 1 FROM blob WHERE rcvid=%d AND"
" NOT EXISTS (SELECT 1 FROM shun WHERE shun.uuid=blob.uuid)", rcvid)
){
style_submenu_element("Shun All", "Shun All",
|
| ︙ | ︙ |
Changes to src/skins.c.
| ︙ | ︙ | |||
287 288 289 290 291 292 293 |
const char *zCurrent = 0; /* Current skin */
int i; /* Loop counter */
Stmt q;
int seenCurrent = 0;
login_check_credentials();
if( !g.perm.Setup ){
| | > | 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
const char *zCurrent = 0; /* Current skin */
int i; /* Loop counter */
Stmt q;
int seenCurrent = 0;
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
db_begin_transaction();
zCurrent = getSkin(0);
for(i=0; i<sizeof(aBuiltinSkin)/sizeof(aBuiltinSkin[0]); i++){
aBuiltinSkin[i].zSQL = getSkin(aBuiltinSkin[i].zLabel);
}
|
| ︙ | ︙ |
Changes to src/stat.c.
| ︙ | ︙ | |||
50 51 52 53 54 55 56 | int szMax, szAvg; const char *zDb; int brief; char zBuf[100]; const char *p; login_check_credentials(); | | | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
int szMax, szAvg;
const char *zDb;
int brief;
char zBuf[100];
const char *p;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
brief = P("brief")!=0;
style_header("Repository Statistics");
style_adunit_config(ADUNIT_RIGHT_OK);
if( g.perm.Admin ){
style_submenu_element("URLs", "URLs and Checkouts", "urllist");
style_submenu_element("Schema", "Repository Schema", "repo_schema");
style_submenu_element("Web-Cache", "Web-Cache Stats", "cachestat");
|
| ︙ | ︙ | |||
290 291 292 293 294 295 296 |
**
** Show ways in which this repository has been accessed
*/
void urllist_page(void){
Stmt q;
int cnt;
login_check_credentials();
| | | 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
**
** Show ways in which this repository has been accessed
*/
void urllist_page(void){
Stmt q;
int cnt;
login_check_credentials();
if( !g.perm.Admin ){ login_needed(0); return; }
style_header("URLs and Checkouts");
style_adunit_config(ADUNIT_RIGHT_OK);
style_submenu_element("Stat", "Repository Stats", "stat");
style_submenu_element("Schema", "Repository Schema", "repo_schema");
@ <div class="section">URLs</div>
@ <table border="0" width='100%%'>
|
| ︙ | ︙ | |||
337 338 339 340 341 342 343 |
** WEBPAGE: repo_schema
**
** Show the repository schema
*/
void repo_schema_page(void){
Stmt q;
login_check_credentials();
| | | 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 |
** WEBPAGE: repo_schema
**
** Show the repository schema
*/
void repo_schema_page(void){
Stmt q;
login_check_credentials();
if( !g.perm.Admin ){ login_needed(0); return; }
style_header("Repository Schema");
style_adunit_config(ADUNIT_RIGHT_OK);
style_submenu_element("Stat", "Repository Stats", "stat");
style_submenu_element("URLs", "URLs and Checkouts", "urllist");
db_prepare(&q, "SELECT sql FROM %s.sqlite_master WHERE sql IS NOT NULL",
db_name("repository"));
|
| ︙ | ︙ |
Changes to src/statrep.c.
| ︙ | ︙ | |||
726 727 728 729 730 731 732 |
*/
void stats_report_page(){
HQuery url; /* URL for various branch links */
const char *zView = P("view"); /* Which view/report to show. */
const char *zUserName = P("user");
login_check_credentials();
| | | 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 |
*/
void stats_report_page(){
HQuery url; /* URL for various branch links */
const char *zView = P("view"); /* Which view/report to show. */
const char *zUserName = P("user");
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
if(!zUserName) zUserName = P("u");
url_initialize(&url, "reports");
if(zUserName && *zUserName){
url_add_parameter(&url,"user", zUserName);
statrep_submenu(&url, "(Remove User Flag)", "view", zView, "user");
}
statrep_submenu(&url, "By Year", "view", "byyear", 0);
|
| ︙ | ︙ |
Changes to src/style.c.
| ︙ | ︙ | |||
1409 1410 1411 1412 1413 1414 1415 |
"HTTP_USER_AGENT", "HTTP_REFERER", "PATH_INFO", "PATH_TRANSLATED",
"QUERY_STRING", "REMOTE_ADDR", "REMOTE_PORT", "REQUEST_METHOD",
"REQUEST_URI", "SCRIPT_FILENAME", "SCRIPT_NAME", "SERVER_PROTOCOL",
};
login_check_credentials();
if( !g.perm.Admin && !g.perm.Setup && !db_get_boolean("test_env_enable",0) ){
| | | > > > > > > > > | 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 |
"HTTP_USER_AGENT", "HTTP_REFERER", "PATH_INFO", "PATH_TRANSLATED",
"QUERY_STRING", "REMOTE_ADDR", "REMOTE_PORT", "REQUEST_METHOD",
"REQUEST_URI", "SCRIPT_FILENAME", "SCRIPT_NAME", "SERVER_PROTOCOL",
};
login_check_credentials();
if( !g.perm.Admin && !g.perm.Setup && !db_get_boolean("test_env_enable",0) ){
login_needed(0);
return;
}
for(i=0; i<count(azCgiVars); i++) (void)P(azCgiVars[i]);
style_header("Environment Test");
showAll = atoi(PD("showall","0"));
if( !showAll ){
style_submenu_element("Show Cookies", 0, "%R/test_env?showall=1");
}else{
style_submenu_element("Hide Cookies", 0, "%R/test_env");
}
#if !defined(_WIN32)
@ uid=%d(getuid()), gid=%d(getgid())<br />
#endif
@ g.zBaseURL = %h(g.zBaseURL)<br />
@ g.zHttpsURL = %h(g.zHttpsURL)<br />
@ g.zTop = %h(g.zTop)<br />
@ g.zPath = %h(g.zPath)<br />
for(i=0, c='a'; c<='z'; c++){
if( login_has_capability(&c, 1, 0) ) zCap[i++] = c;
}
zCap[i] = 0;
@ g.userUid = %d(g.userUid)<br />
@ g.zLogin = %h(g.zLogin)<br />
@ g.isHuman = %d(g.isHuman)<br />
@ capabilities = %s(zCap)<br />
for(i=0, c='a'; c<='z'; c++){
if( login_has_capability(&c, 1, LOGIN_ANON)
&& !login_has_capability(&c, 1, 0) ) zCap[i++] = c;
}
zCap[i] = 0;
if( i>0 ){
@ anonymous-adds = %s(zCap)<br />
}
@ g.zRepositoryName = %h(g.zRepositoryName)<br />
@ load_average() = %f(load_average())<br />
@ <hr>
P("HTTP_USER_AGENT");
cgi_print_all(showAll);
if( showAll && blob_size(&g.httpHeader)>0 ){
@ <hr>
|
| ︙ | ︙ |
Changes to src/tag.c.
| ︙ | ︙ | |||
540 541 542 543 544 545 546 |
** WEBPAGE: taglist
*/
void taglist_page(void){
Stmt q;
login_check_credentials();
if( !g.perm.Read ){
| | | 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 |
** WEBPAGE: taglist
*/
void taglist_page(void){
Stmt q;
login_check_credentials();
if( !g.perm.Read ){
login_needed(g.anon.Read);
}
login_anonymous_available();
style_header("Tags");
style_adunit_config(ADUNIT_RIGHT_OK);
style_submenu_element("Timeline", "Timeline", "tagtimeline");
@ <h2>Non-propagating tags:</h2>
db_prepare(&q,
|
| ︙ | ︙ | |||
578 579 580 581 582 583 584 |
/*
** WEBPAGE: /tagtimeline
*/
void tagtimeline_page(void){
Stmt q;
login_check_credentials();
| | | 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 |
/*
** WEBPAGE: /tagtimeline
*/
void tagtimeline_page(void){
Stmt q;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
style_header("Tagged Check-ins");
style_submenu_element("List", "List", "taglist");
login_anonymous_available();
@ <h2>Check-ins with non-propagating tags:</h2>
db_prepare(&q,
"%s AND blob.rid IN (SELECT rid FROM tagxref"
|
| ︙ | ︙ |
Changes to src/tar.c.
| ︙ | ︙ | |||
601 602 603 604 605 606 607 |
void tarball_page(void){
int rid;
char *zName, *zRid, *zKey;
int nName, nRid;
Blob tarball;
login_check_credentials();
| | | 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 |
void tarball_page(void){
int rid;
char *zName, *zRid, *zKey;
int nName, nRid;
Blob tarball;
login_check_credentials();
if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
load_control();
zName = mprintf("%s", PD("name",""));
nName = strlen(zName);
zRid = mprintf("%s", PD("uuid","trunk"));
nRid = strlen(zRid);
if( nName>7 && fossil_strcmp(&zName[nName-7], ".tar.gz")==0 ){
/* Special case: Remove the ".tar.gz" suffix. */
|
| ︙ | ︙ |
Changes to src/th_main.c.
| ︙ | ︙ | |||
340 341 342 343 344 345 346 347 | Th_SetResult(interp, zOut, -1); free(zOut); return TH_OK; } /* ** TH1 command: hascap STRING... ** | > > | | | 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
Th_SetResult(interp, zOut, -1);
free(zOut);
return TH_OK;
}
/*
** TH1 command: hascap STRING...
** TH1 command: anoncap STRING...
**
** Return true if the current user (hascap) or if the anonymous user
** (anoncap) has all of the capabilities listed in STRING.
*/
static int hascapCmd(
Th_Interp *interp,
void *p,
int argc,
const char **argv,
int *argl
){
int rc = 0, i;
if( argc<2 ){
return Th_WrongNumArgs(interp, "hascap STRING ...");
}
for(i=1; i<argc && rc==0; i++){
rc = login_has_capability((char*)argv[i],argl[i],*(int*)p);
}
if( g.thTrace ){
Th_Trace("[hascap %#h] => %d<br />\n", argl[1], argv[1], rc);
}
Th_SetResultInt(interp, rc);
return TH_OK;
}
|
| ︙ | ︙ | |||
541 542 543 544 545 546 547 | return TH_OK; } /* ** TH1 command: anycap STRING ** | > | | | 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 |
return TH_OK;
}
/*
** TH1 command: anycap STRING
**
** Return true if the current user user
** has any one of the capabilities listed in STRING.
*/
static int anycapCmd(
Th_Interp *interp,
void *p,
int argc,
const char **argv,
int *argl
){
int rc = 0;
int i;
if( argc!=2 ){
return Th_WrongNumArgs(interp, "anycap STRING");
}
for(i=0; rc==0 && i<argl[1]; i++){
rc = login_has_capability((char*)&argv[1][i],1,0);
}
if( g.thTrace ){
Th_Trace("[hascap %#h] => %d<br />\n", argl[1], argv[1], rc);
}
Th_SetResultInt(interp, rc);
return TH_OK;
}
|
| ︙ | ︙ | |||
1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 |
void Th_FossilInit(u32 flags){
int wasInit = 0;
int needConfig = flags & TH_INIT_NEED_CONFIG;
int forceReset = flags & TH_INIT_FORCE_RESET;
int forceTcl = flags & TH_INIT_FORCE_TCL;
int forceSetup = flags & TH_INIT_FORCE_SETUP;
static unsigned int aFlags[] = { 0, 1, WIKI_LINKSONLY };
static struct _Command {
const char *zName;
Th_CommandProc xProc;
void *pContext;
} aCommand[] = {
{"anycap", anycapCmd, 0},
{"artifact", artifactCmd, 0},
{"checkout", checkoutCmd, 0},
{"combobox", comboboxCmd, 0},
{"date", dateCmd, 0},
{"decorate", wikiCmd, (void*)&aFlags[2]},
{"enable_output", enableOutputCmd, 0},
{"getParameter", getParameterCmd, 0},
{"globalState", globalStateCmd, 0},
{"httpize", httpizeCmd, 0},
| > > > | | 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 |
void Th_FossilInit(u32 flags){
int wasInit = 0;
int needConfig = flags & TH_INIT_NEED_CONFIG;
int forceReset = flags & TH_INIT_FORCE_RESET;
int forceTcl = flags & TH_INIT_FORCE_TCL;
int forceSetup = flags & TH_INIT_FORCE_SETUP;
static unsigned int aFlags[] = { 0, 1, WIKI_LINKSONLY };
static int anonFlag = LOGIN_ANON;
static int zeroInt = 0;
static struct _Command {
const char *zName;
Th_CommandProc xProc;
void *pContext;
} aCommand[] = {
{"anoncap", hascapCmd, (void*)&anonFlag},
{"anycap", anycapCmd, 0},
{"artifact", artifactCmd, 0},
{"checkout", checkoutCmd, 0},
{"combobox", comboboxCmd, 0},
{"date", dateCmd, 0},
{"decorate", wikiCmd, (void*)&aFlags[2]},
{"enable_output", enableOutputCmd, 0},
{"getParameter", getParameterCmd, 0},
{"globalState", globalStateCmd, 0},
{"httpize", httpizeCmd, 0},
{"hascap", hascapCmd, (void*)&zeroInt},
{"hasfeature", hasfeatureCmd, 0},
{"html", putsCmd, (void*)&aFlags[0]},
{"htmlize", htmlizeCmd, 0},
{"http", httpCmd, 0},
{"linecount", linecntCmd, 0},
{"puts", putsCmd, (void*)&aFlags[1]},
{"query", queryCmd, 0},
|
| ︙ | ︙ |
Changes to src/timeline.c.
| ︙ | ︙ | |||
161 162 163 164 165 166 167 |
** testing the hash_color() function.
*/
void test_hash_color_page(void){
const char *zBr;
char zNm[10];
int i, cnt;
login_check_credentials();
| | | 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
** testing the hash_color() function.
*/
void test_hash_color_page(void){
const char *zBr;
char zNm[10];
int i, cnt;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
style_header("Hash Color Test");
for(i=cnt=0; i<10; i++){
sqlite3_snprintf(sizeof(zNm),zNm,"b%d",i);
zBr = P(zNm);
if( zBr && zBr[0] ){
@ <p style='border:1px solid;background-color:%s(hash_color(zBr));'>
|
| ︙ | ︙ | |||
1173 1174 1175 1176 1177 1178 1179 |
*/
pd_rid = name_to_typed_rid(P("dp"),"ci");
if( pd_rid ){
p_rid = d_rid = pd_rid;
}
login_check_credentials();
if( !g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki ){
| | | 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 |
*/
pd_rid = name_to_typed_rid(P("dp"),"ci");
if( pd_rid ){
p_rid = d_rid = pd_rid;
}
login_check_credentials();
if( !g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki ){
login_needed(g.anon.Read && g.anon.RdTkt && g.anon.RdWiki);
return;
}
url_initialize(&url, "timeline");
cgi_query_parameters_to_url(&url);
if( zTagName && g.perm.Read ){
tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'", zTagName);
zThisTag = zTagName;
|
| ︙ | ︙ | |||
2066 2067 2068 2069 2070 2071 2072 |
/*
** WEBPAGE: test_timewarps
*/
void test_timewarp_page(void){
Stmt q;
login_check_credentials();
| | > > > | 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 |
/*
** WEBPAGE: test_timewarps
*/
void test_timewarp_page(void){
Stmt q;
login_check_credentials();
if( !g.perm.Read || !g.perm.Hyperlink ){
login_needed(g.anon.Read && g.anon.Hyperlink);
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"
|
| ︙ | ︙ |
Changes to src/tkt.c.
| ︙ | ︙ | |||
447 448 449 450 451 452 453 |
*/
void tktview_page(void){
const char *zScript;
char *zFullName;
const char *zUuid = PD("name","");
login_check_credentials();
| | | 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 |
*/
void tktview_page(void){
const char *zScript;
char *zFullName;
const char *zUuid = PD("name","");
login_check_credentials();
if( !g.perm.RdTkt ){ login_needed(g.anon.RdTkt); 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);
|
| ︙ | ︙ | |||
685 686 687 688 689 690 691 |
** top of the screen.
*/
void tktnew_page(void){
const char *zScript;
char *zNewUuid = 0;
login_check_credentials();
| | | 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 |
** top of the screen.
*/
void tktnew_page(void){
const char *zScript;
char *zNewUuid = 0;
login_check_credentials();
if( !g.perm.NewTkt ){ login_needed(g.anon.NewTkt); return; }
if( P("cancel") ){
cgi_redirect("home");
}
style_header("New Ticket");
ticket_standard_submenu(T_ALL_BUT(T_NEW));
if( g.thTrace ) Th_Trace("BEGIN_TKTNEW<br />\n", -1);
ticket_init();
|
| ︙ | ︙ | |||
736 737 738 739 740 741 742 |
void tktedit_page(void){
const char *zScript;
int nName;
const char *zName;
int nRec;
login_check_credentials();
| | > > > | 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 |
void tktedit_page(void){
const char *zScript;
int nName;
const char *zName;
int nRec;
login_check_credentials();
if( !g.perm.ApndTkt && !g.perm.WrTkt ){
login_needed(g.anon.ApndTkt || g.anon.WrTkt);
return;
}
zName = P("name");
if( P("cancel") ){
cgi_redirectf("tktview?name=%T", zName);
}
style_header("Edit Ticket");
if( zName==0 || (nName = strlen(zName))<4 || nName>UUID_SIZE
|| !validate16(zName,nName) ){
|
| ︙ | ︙ | |||
837 838 839 840 841 842 843 | const char *zUuid; char *zFullUuid; int tagid; char zGlobPattern[50]; const char *zType; login_check_credentials(); | | > > > | 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 |
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(g.anon.Hyperlink && g.anon.RdTkt);
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",
|
| ︙ | ︙ | |||
910 911 912 913 914 915 916 | Stmt q; char *zTitle; const char *zUuid; int tagid; int nChng = 0; login_check_credentials(); | | > > > | 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 |
Stmt q;
char *zTitle;
const char *zUuid;
int tagid;
int nChng = 0;
login_check_credentials();
if( !g.perm.Hyperlink || !g.perm.RdTkt ){
login_needed(g.anon.Hyperlink && g.anon.RdTkt);
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",
|
| ︙ | ︙ |
Changes to src/tktsetup.c.
| ︙ | ︙ | |||
25 26 27 28 29 30 31 |
/*
** Main sub-menu for configuring the ticketing system.
** WEBPAGE: tktsetup
*/
void tktsetup_page(void){
login_check_credentials();
if( !g.perm.Setup ){
| | > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
/*
** Main sub-menu for configuring the ticketing system.
** WEBPAGE: tktsetup
*/
void tktsetup_page(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
style_header("Ticket Setup");
@ <table border="0" cellspacing="20">
setup_menu_entry("Table", "tktsetup_tab",
"Specify the schema of the \"ticket\" table in the database.");
setup_menu_entry("Timeline", "tktsetup_timeline",
|
| ︙ | ︙ | |||
116 117 118 119 120 121 122 |
int height /* Height of the edit box */
){
const char *z;
int isSubmit;
login_check_credentials();
if( !g.perm.Setup ){
| | > | | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
int height /* Height of the edit box */
){
const char *z;
int isSubmit;
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
if( PB("setup") ){
cgi_redirect("tktsetup");
}
isSubmit = P("submit")!=0;
z = P("x");
if( z==0 ){
z = db_get(zDbField, (char*)zDfltValue);
}
|
| ︙ | ︙ | |||
856 857 858 859 860 861 862 |
/*
** WEBPAGE: tktsetup_timeline
*/
void tktsetup_timeline_page(void){
login_check_credentials();
if( !g.perm.Setup ){
| | > | 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 |
/*
** WEBPAGE: tktsetup_timeline
*/
void tktsetup_timeline_page(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
if( P("setup") ){
cgi_redirect("tktsetup");
}
style_header("Ticket Display On Timelines");
db_begin_transaction();
|
| ︙ | ︙ |
Changes to src/user.c.
| ︙ | ︙ | |||
422 423 424 425 426 427 428 |
int skip = atoi(PD("o","0"));
Blob sql;
Stmt q;
int cnt = 0;
int rc;
login_check_credentials();
| | | 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 |
int skip = atoi(PD("o","0"));
Blob sql;
Stmt q;
int cnt = 0;
int rc;
login_check_credentials();
if( !g.perm.Admin ){ login_needed(0); return; }
create_accesslog_table();
if( P("delall") && P("delallbtn") ){
db_multi_exec("DELETE FROM accesslog");
cgi_redirectf("%s/access_log?y=%d&n=%d&o=%o", g.zTop, y, n, skip);
return;
}
|
| ︙ | ︙ |
Changes to src/wiki.c.
| ︙ | ︙ | |||
237 238 239 240 241 242 243 |
/*
** WEBPAGE: wikihelp
** A generic landing page for wiki.
*/
void wiki_helppage(void){
login_check_credentials();
| | | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
/*
** WEBPAGE: wikihelp
** A generic landing page for wiki.
*/
void wiki_helppage(void){
login_check_credentials();
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
style_header("Wiki Help");
wiki_standard_submenu(W_ALL_BUT(W_HELP));
@ <h2>Wiki Links</h2>
@ <ul>
{ char *zWikiHomePageName = db_get("index-page",0);
if( zWikiHomePageName ){
@ <li> %z(href("%R%s",zWikiHomePageName))
|
| ︙ | ︙ | |||
310 311 312 313 314 315 316 |
Blob wiki;
Manifest *pWiki = 0;
const char *zPageName;
const char *zMimetype = 0;
char *zBody = mprintf("%s","<i>Empty Page</i>");
login_check_credentials();
| | | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
Blob wiki;
Manifest *pWiki = 0;
const char *zPageName;
const char *zMimetype = 0;
char *zBody = mprintf("%s","<i>Empty Page</i>");
login_check_credentials();
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
zPageName = P("name");
if( zPageName==0 ){
if( search_restrict(SRCH_WIKI)!=0 ){
wiki_srchpage();
}else{
wiki_helppage();
}
|
| ︙ | ︙ | |||
483 484 485 486 487 488 489 |
}
login_check_credentials();
zPageName = PD("name","");
if( check_name(zPageName) ) return;
isSandbox = is_sandbox(zPageName);
if( isSandbox ){
if( !g.perm.WrWiki ){
| | | | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 |
}
login_check_credentials();
zPageName = PD("name","");
if( check_name(zPageName) ) return;
isSandbox = is_sandbox(zPageName);
if( isSandbox ){
if( !g.perm.WrWiki ){
login_needed(g.anon.WrWiki);
return;
}
if( zBody==0 ){
zBody = db_get("sandbox","");
zMimetype = db_get("sandbox-mimetype","text/x-fossil-wiki");
}
}else{
zTag = mprintf("wiki-%s", zPageName);
rid = db_int(0,
"SELECT rid FROM tagxref"
" WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
" ORDER BY mtime DESC", zTag
);
free(zTag);
if( (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){
login_needed(rid ? g.anon.WrWiki : g.anon.NewWiki);
return;
}
if( zBody==0 && (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))!=0 ){
zBody = pWiki->zWiki;
zMimetype = pWiki->zMimetype;
}
}
|
| ︙ | ︙ | |||
623 624 625 626 627 628 629 |
** to the wikiedit screen for that new page.
*/
void wikinew_page(void){
const char *zName;
const char *zMimetype;
login_check_credentials();
if( !g.perm.NewWiki ){
| | | 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 |
** to the wikiedit screen for that new page.
*/
void wikinew_page(void){
const char *zName;
const char *zMimetype;
login_check_credentials();
if( !g.perm.NewWiki ){
login_needed(g.anon.NewWiki);
return;
}
zName = PD("name","");
zMimetype = wiki_filter_mimetypes(P("mimetype"));
if( zName[0] && wiki_name_is_wellformed((const unsigned char *)zName) ){
if( fossil_strcmp(zMimetype,"text/x-fossil-wiki")==0
&& db_get_boolean("wysiwyg-wiki", 0)
|
| ︙ | ︙ | |||
725 726 727 728 729 730 731 |
free(zTag);
if( !rid ){
fossil_redirect_home();
return;
}
}
if( !g.perm.ApndWiki ){
| | | 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 |
free(zTag);
if( !rid ){
fossil_redirect_home();
return;
}
}
if( !g.perm.ApndWiki ){
login_needed(g.anon.ApndWiki);
return;
}
if( P("submit")!=0 && P("r")!=0 && P("u")!=0
&& (goodCaptcha = captcha_is_correct())
){
char *zDate;
Blob cksum;
|
| ︙ | ︙ | |||
838 839 840 841 842 843 844 |
**
** Show the complete change history for a single wiki page.
*/
void whistory_page(void){
Stmt q;
const char *zPageName;
login_check_credentials();
| | | 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 |
**
** Show the complete change history for a single wiki page.
*/
void whistory_page(void){
Stmt q;
const char *zPageName;
login_check_credentials();
if( !g.perm.Hyperlink ){ login_needed(g.anon.Hyperlink); return; }
zPageName = PD("name","");
style_header("History Of %s", zPageName);
db_prepare(&q, "%s AND event.objid IN "
" (SELECT rid FROM tagxref WHERE tagid="
"(SELECT tagid FROM tag WHERE tagname='wiki-%q')"
" UNION SELECT attachid FROM attachment"
|
| ︙ | ︙ | |||
870 871 872 873 874 875 876 |
const char *zPageName;
Manifest *pW1, *pW2 = 0;
Blob w1, w2, d;
u64 diffFlags;
login_check_credentials();
rid1 = atoi(PD("a","0"));
| | | 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 |
const char *zPageName;
Manifest *pW1, *pW2 = 0;
Blob w1, w2, d;
u64 diffFlags;
login_check_credentials();
rid1 = atoi(PD("a","0"));
if( !g.perm.Hyperlink ){ login_needed(g.anon.Hyperlink); return; }
if( rid1==0 ) fossil_redirect_home();
rid2 = atoi(PD("b","0"));
zPageName = PD("name","");
style_header("Changes To %s", zPageName);
if( rid2==0 ){
rid2 = db_int(0,
|
| ︙ | ︙ | |||
933 934 935 936 937 938 939 |
** List all available wiki pages with date created and last modified.
*/
void wcontent_page(void){
Stmt q;
int showAll = P("all")!=0;
login_check_credentials();
| | | 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 |
** List all available wiki pages with date created and last modified.
*/
void wcontent_page(void){
Stmt q;
int showAll = P("all")!=0;
login_check_credentials();
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
style_header("Available Wiki Pages");
if( showAll ){
style_submenu_element("Active", "Only Active Pages", "%s/wcontent", g.zTop);
}else{
style_submenu_element("All", "All", "%s/wcontent?all=1", g.zTop);
}
wiki_standard_submenu(W_ALL_BUT(W_LIST));
|
| ︙ | ︙ | |||
967 968 969 970 971 972 973 |
** URL: /wfind?title=TITLE
** List all wiki pages whose titles contain the search text
*/
void wfind_page(void){
Stmt q;
const char *zTitle;
login_check_credentials();
| | | 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 |
** URL: /wfind?title=TITLE
** List all wiki pages whose titles contain the search text
*/
void wfind_page(void){
Stmt q;
const char *zTitle;
login_check_credentials();
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
zTitle = PD("title","*");
style_header("Wiki Pages Found");
@ <ul>
db_prepare(&q,
"SELECT substr(tagname, 6, 1000) FROM tag WHERE tagname like 'wiki-%%%q%%'"
" ORDER BY lower(tagname) /*sort*/" ,
zTitle);
|
| ︙ | ︙ |
Changes to src/xfersetup.c.
| ︙ | ︙ | |||
25 26 27 28 29 30 31 |
/*
** Main sub-menu for configuring the transfer system.
** WEBPAGE: xfersetup
*/
void xfersetup_page(void){
login_check_credentials();
if( !g.perm.Setup ){
| | > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
/*
** Main sub-menu for configuring the transfer system.
** WEBPAGE: xfersetup
*/
void xfersetup_page(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
style_header("Transfer Setup");
@ <table border="0" cellspacing="20">
setup_menu_entry("Common", "xfersetup_com",
"Common TH1 code run before all transfer request processing.");
|
| ︙ | ︙ | |||
102 103 104 105 106 107 108 |
int height /* Height of the edit box */
){
const char *z;
int isSubmit;
login_check_credentials();
if( !g.perm.Setup ){
| | > | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
int height /* Height of the edit box */
){
const char *z;
int isSubmit;
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
if( P("setup") ){
cgi_redirect("xfersetup");
}
isSubmit = P("submit")!=0;
z = P("x");
if( z==0 ){
|
| ︙ | ︙ |
Changes to src/zip.c.
| ︙ | ︙ | |||
446 447 448 449 450 451 452 | int rid; char *zName, *zRid; int nName, nRid; Blob zip; char *zKey; login_check_credentials(); | | | 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 |
int rid;
char *zName, *zRid;
int nName, nRid;
Blob zip;
char *zKey;
login_check_credentials();
if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
load_control();
zName = mprintf("%s", PD("name",""));
nName = strlen(zName);
zRid = mprintf("%s", PD("uuid","trunk"));
nRid = strlen(zRid);
if( nName>4 && fossil_strcmp(&zName[nName-4], ".zip")==0 ){
/* Special case: Remove the ".zip" suffix. */
|
| ︙ | ︙ |