234
235
236
237
238
239
240
241
242
243
244
245
246
247
|
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
|
+
|
const char *zTkt = P("tkt");
const char *zFrom = P("from");
const char *aContent = P("f");
const char *zName = PD("f:filename","unknown");
const char *zTarget;
const char *zTargetType;
int szContent = atoi(PD("f:bytes","0"));
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();
|
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
|
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
|
-
+
|
zTargetType = mprintf("Ticket <a href=\"%s/tktview/%S\">%S</a>",
g.zTop, zTkt, zTkt);
}
if( zFrom==0 ) zFrom = mprintf("%s/home", g.zTop);
if( P("cancel") ){
cgi_redirect(zFrom);
}
if( P("ok") && szContent>0 ){
if( P("ok") && szContent>0 && (goodCaptcha = captcha_is_correct()) ){
Blob content;
Blob manifest;
Blob cksum;
char *zUUID;
const char *zComment;
char *zDate;
int rid;
|
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
|
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
|
+
+
+
-
+
+
+
|
blob_appendf(&manifest, "Z %b\n", &cksum);
attach_put(&manifest, rid, needModerator);
assert( blob_is_reset(&manifest) );
db_end_transaction(0);
cgi_redirect(zFrom);
}
style_header("Add Attachment");
if( !goodCaptcha ){
@ <p class="generalError">Error: Incorrect security code.</p>
}
@ <h2>Add Attachment To %s(zTargetType)</h2>
form_begin("enctype='multipart/form-data'", "%R/attachadd");
@ <div>
@ File to Attach:
@ <input type="file" name="f" size="60" /><br />
@ Description:<br />
@ <textarea name="comment" cols="80" rows="5" wrap="virtual"></textarea><br />
if( zTkt ){
@ <input type="hidden" name="tkt" value="%h(zTkt)" />
}else{
@ <input type="hidden" name="page" value="%h(zPage)" />
}
@ <input type="hidden" name="from" value="%h(zFrom)" />
@ <input type="submit" name="ok" value="Add Attachment" />
@ <input type="submit" name="cancel" value="Cancel" />
@ </div></form>
@ </div>
captcha_generate();
@ </form>
style_footer();
}
/*
** WEBPAGE: ainfo
** URL: /ainfo?name=ARTIFACTID
**
|