Hex Artifact Content
Not logged in

Artifact a2062a7125ffb8774d7c1f34332e1dc7b7cf1df1:

File src/shun.c part of check-in [766bec08ce] - Documentation tweaks. Change the "Setup" menu title to "Admin". Added pages under Admin to view the RCVFROM table of the database. by drh on 2009-01-25 19:18:09.

0000: 2f 2a 0a 2a 2a 20 43 6f 70 79 72 69 67 68 74 20  /*.** Copyright 
0010: 28 63 29 20 32 30 30 38 20 44 2e 20 52 69 63 68  (c) 2008 D. Rich
0020: 61 72 64 20 48 69 70 70 0a 2a 2a 0a 2a 2a 20 54  ard Hipp.**.** T
0030: 68 69 73 20 70 72 6f 67 72 61 6d 20 69 73 20 66  his program is f
0040: 72 65 65 20 73 6f 66 74 77 61 72 65 3b 20 79 6f  ree software; yo
0050: 75 20 63 61 6e 20 72 65 64 69 73 74 72 69 62 75  u can redistribu
0060: 74 65 20 69 74 20 61 6e 64 2f 6f 72 0a 2a 2a 20  te it and/or.** 
0070: 6d 6f 64 69 66 79 20 69 74 20 75 6e 64 65 72 20  modify it under 
0080: 74 68 65 20 74 65 72 6d 73 20 6f 66 20 74 68 65  the terms of the
0090: 20 47 4e 55 20 47 65 6e 65 72 61 6c 20 50 75 62   GNU General Pub
00a0: 6c 69 63 0a 2a 2a 20 4c 69 63 65 6e 73 65 20 76  lic.** License v
00b0: 65 72 73 69 6f 6e 20 32 20 61 73 20 70 75 62 6c  ersion 2 as publ
00c0: 69 73 68 65 64 20 62 79 20 74 68 65 20 46 72 65  ished by the Fre
00d0: 65 20 53 6f 66 74 77 61 72 65 20 46 6f 75 6e 64  e Software Found
00e0: 61 74 69 6f 6e 2e 0a 2a 2a 0a 2a 2a 20 54 68 69  ation..**.** Thi
00f0: 73 20 70 72 6f 67 72 61 6d 20 69 73 20 64 69 73  s program is dis
0100: 74 72 69 62 75 74 65 64 20 69 6e 20 74 68 65 20  tributed in the 
0110: 68 6f 70 65 20 74 68 61 74 20 69 74 20 77 69 6c  hope that it wil
0120: 6c 20 62 65 20 75 73 65 66 75 6c 2c 0a 2a 2a 20  l be useful,.** 
0130: 62 75 74 20 57 49 54 48 4f 55 54 20 41 4e 59 20  but WITHOUT ANY 
0140: 57 41 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75  WARRANTY; withou
0150: 74 20 65 76 65 6e 20 74 68 65 20 69 6d 70 6c 69  t even the impli
0160: 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66 0a 2a  ed warranty of.*
0170: 2a 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54  * MERCHANTABILIT
0180: 59 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52  Y or FITNESS FOR
0190: 20 41 20 50 41 52 54 49 43 55 4c 41 52 20 50 55   A PARTICULAR PU
01a0: 52 50 4f 53 45 2e 20 20 53 65 65 20 74 68 65 20  RPOSE.  See the 
01b0: 47 4e 55 0a 2a 2a 20 47 65 6e 65 72 61 6c 20 50  GNU.** General P
01c0: 75 62 6c 69 63 20 4c 69 63 65 6e 73 65 20 66 6f  ublic License fo
01d0: 72 20 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a  r more details..
01e0: 2a 2a 20 0a 2a 2a 20 59 6f 75 20 73 68 6f 75 6c  ** .** You shoul
01f0: 64 20 68 61 76 65 20 72 65 63 65 69 76 65 64 20  d have received 
0200: 61 20 63 6f 70 79 20 6f 66 20 74 68 65 20 47 4e  a copy of the GN
0210: 55 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69 63  U General Public
0220: 0a 2a 2a 20 4c 69 63 65 6e 73 65 20 61 6c 6f 6e  .** License alon
0230: 67 20 77 69 74 68 20 74 68 69 73 20 6c 69 62 72  g with this libr
0240: 61 72 79 3b 20 69 66 20 6e 6f 74 2c 20 77 72 69  ary; if not, wri
0250: 74 65 20 74 6f 20 74 68 65 0a 2a 2a 20 46 72 65  te to the.** Fre
0260: 65 20 53 6f 66 74 77 61 72 65 20 46 6f 75 6e 64  e Software Found
0270: 61 74 69 6f 6e 2c 20 49 6e 63 2e 2c 20 35 39 20  ation, Inc., 59 
0280: 54 65 6d 70 6c 65 20 50 6c 61 63 65 20 2d 20 53  Temple Place - S
0290: 75 69 74 65 20 33 33 30 2c 0a 2a 2a 20 42 6f 73  uite 330,.** Bos
02a0: 74 6f 6e 2c 20 4d 41 20 20 30 32 31 31 31 2d 31  ton, MA  02111-1
02b0: 33 30 37 2c 20 55 53 41 2e 0a 2a 2a 0a 2a 2a 20  307, USA..**.** 
02c0: 41 75 74 68 6f 72 20 63 6f 6e 74 61 63 74 20 69  Author contact i
02d0: 6e 66 6f 72 6d 61 74 69 6f 6e 3a 0a 2a 2a 20 20  nformation:.**  
02e0: 20 64 72 68 40 68 77 61 63 69 2e 63 6f 6d 0a 2a   drh@hwaci.com.*
02f0: 2a 20 20 20 68 74 74 70 3a 2f 2f 77 77 77 2e 68  *   http://www.h
0300: 77 61 63 69 2e 63 6f 6d 2f 64 72 68 2f 0a 2a 2a  waci.com/drh/.**
0310: 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  .***************
0320: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0330: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0340: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0350: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0360: 0a 2a 2a 0a 2a 2a 20 54 68 69 73 20 66 69 6c 65  .**.** This file
0370: 20 63 6f 6e 74 61 69 6e 73 20 63 6f 64 65 20 75   contains code u
0380: 73 65 64 20 74 6f 20 6d 61 6e 61 67 65 20 53 48  sed to manage SH
0390: 55 4e 20 74 61 62 6c 65 20 6f 66 20 74 68 65 20  UN table of the 
03a0: 72 65 70 6f 73 69 74 6f 72 79 0a 2a 2f 0a 23 69  repository.*/.#i
03b0: 6e 63 6c 75 64 65 20 22 63 6f 6e 66 69 67 2e 68  nclude "config.h
03c0: 22 0a 23 69 6e 63 6c 75 64 65 20 22 73 68 75 6e  ".#include "shun
03d0: 2e 68 22 0a 23 69 6e 63 6c 75 64 65 20 3c 61 73  .h".#include <as
03e0: 73 65 72 74 2e 68 3e 0a 0a 2f 2a 0a 2a 2a 20 52  sert.h>../*.** R
03f0: 65 74 75 72 6e 20 74 72 75 65 20 69 66 20 74 68  eturn true if th
0400: 65 20 67 69 76 65 6e 20 61 72 74 69 66 61 63 74  e given artifact
0410: 20 49 44 20 73 68 6f 75 6c 64 20 62 65 20 73 68   ID should be sh
0420: 75 6e 6e 65 64 2e 0a 2a 2f 0a 69 6e 74 20 75 75  unned..*/.int uu
0430: 69 64 5f 69 73 5f 73 68 75 6e 6e 65 64 28 63 6f  id_is_shunned(co
0440: 6e 73 74 20 63 68 61 72 20 2a 7a 55 75 69 64 29  nst char *zUuid)
0450: 7b 0a 20 20 73 74 61 74 69 63 20 53 74 6d 74 20  {.  static Stmt 
0460: 71 3b 0a 20 20 69 6e 74 20 72 63 3b 0a 20 20 69  q;.  int rc;.  i
0470: 66 28 20 7a 55 75 69 64 3d 3d 30 20 7c 7c 20 7a  f( zUuid==0 || z
0480: 55 75 69 64 5b 30 5d 3d 3d 30 20 29 20 72 65 74  Uuid[0]==0 ) ret
0490: 75 72 6e 20 30 3b 0a 20 20 64 62 5f 73 74 61 74  urn 0;.  db_stat
04a0: 69 63 5f 70 72 65 70 61 72 65 28 26 71 2c 20 22  ic_prepare(&q, "
04b0: 53 45 4c 45 43 54 20 31 20 46 52 4f 4d 20 73 68  SELECT 1 FROM sh
04c0: 75 6e 20 57 48 45 52 45 20 75 75 69 64 3d 3a 75  un WHERE uuid=:u
04d0: 75 69 64 22 29 3b 0a 20 20 64 62 5f 62 69 6e 64  uid");.  db_bind
04e0: 5f 74 65 78 74 28 26 71 2c 20 22 3a 75 75 69 64  _text(&q, ":uuid
04f0: 22 2c 20 7a 55 75 69 64 29 3b 0a 20 20 72 63 20  ", zUuid);.  rc 
0500: 3d 20 64 62 5f 73 74 65 70 28 26 71 29 3b 0a 20  = db_step(&q);. 
0510: 20 64 62 5f 72 65 73 65 74 28 26 71 29 3b 0a 20   db_reset(&q);. 
0520: 20 72 65 74 75 72 6e 20 72 63 3d 3d 53 51 4c 49   return rc==SQLI
0530: 54 45 5f 52 4f 57 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a  TE_ROW;.}../*.**
0540: 20 57 45 42 50 41 47 45 3a 20 73 68 75 6e 0a 2a   WEBPAGE: shun.*
0550: 2f 0a 76 6f 69 64 20 73 68 75 6e 5f 70 61 67 65  /.void shun_page
0560: 28 76 6f 69 64 29 7b 0a 20 20 53 74 6d 74 20 71  (void){.  Stmt q
0570: 3b 0a 20 20 69 6e 74 20 63 6e 74 20 3d 20 30 3b  ;.  int cnt = 0;
0580: 0a 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a  .  const char *z
0590: 55 75 69 64 20 3d 20 50 28 22 75 75 69 64 22 29  Uuid = P("uuid")
05a0: 3b 0a 20 20 69 6e 74 20 6e 55 75 69 64 3b 0a 20  ;.  int nUuid;. 
05b0: 20 63 68 61 72 20 7a 43 61 6e 6f 6e 69 63 61 6c   char zCanonical
05c0: 5b 55 55 49 44 5f 53 49 5a 45 2b 31 5d 3b 0a 0a  [UUID_SIZE+1];..
05d0: 20 20 6c 6f 67 69 6e 5f 63 68 65 63 6b 5f 63 72    login_check_cr
05e0: 65 64 65 6e 74 69 61 6c 73 28 29 3b 0a 20 20 69  edentials();.  i
05f0: 66 28 20 21 67 2e 6f 6b 41 64 6d 69 6e 20 29 7b  f( !g.okAdmin ){
0600: 0a 20 20 20 20 6c 6f 67 69 6e 5f 6e 65 65 64 65  .    login_neede
0610: 64 28 29 3b 0a 20 20 7d 0a 20 20 69 66 28 20 50  d();.  }.  if( P
0620: 28 22 72 65 62 75 69 6c 64 22 29 20 29 7b 0a 20  ("rebuild") ){. 
0630: 20 20 20 64 62 5f 63 6c 6f 73 65 28 29 3b 0a 20     db_close();. 
0640: 20 20 20 64 62 5f 6f 70 65 6e 5f 72 65 70 6f 73     db_open_repos
0650: 69 74 6f 72 79 28 67 2e 7a 52 65 70 6f 73 69 74  itory(g.zReposit
0660: 6f 72 79 4e 61 6d 65 29 3b 0a 20 20 20 20 64 62  oryName);.    db
0670: 5f 62 65 67 69 6e 5f 74 72 61 6e 73 61 63 74 69  _begin_transacti
0680: 6f 6e 28 29 3b 0a 20 20 20 20 72 65 62 75 69 6c  on();.    rebuil
0690: 64 5f 64 62 28 30 2c 30 29 3b 0a 20 20 20 20 64  d_db(0,0);.    d
06a0: 62 5f 65 6e 64 5f 74 72 61 6e 73 61 63 74 69 6f  b_end_transactio
06b0: 6e 28 30 29 3b 0a 20 20 7d 0a 20 20 69 66 28 20  n(0);.  }.  if( 
06c0: 7a 55 75 69 64 20 29 7b 0a 20 20 20 20 6e 55 75  zUuid ){.    nUu
06d0: 69 64 20 3d 20 73 74 72 6c 65 6e 28 7a 55 75 69  id = strlen(zUui
06e0: 64 29 3b 0a 20 20 20 20 69 66 28 20 6e 55 75 69  d);.    if( nUui
06f0: 64 21 3d 34 30 20 7c 7c 20 21 76 61 6c 69 64 61  d!=40 || !valida
0700: 74 65 31 36 28 7a 55 75 69 64 2c 20 6e 55 75 69  te16(zUuid, nUui
0710: 64 29 20 29 7b 0a 20 20 20 20 20 20 7a 55 75 69  d) ){.      zUui
0720: 64 20 3d 20 30 3b 0a 20 20 20 20 7d 65 6c 73 65  d = 0;.    }else
0730: 7b 0a 20 20 20 20 20 20 6d 65 6d 63 70 79 28 7a  {.      memcpy(z
0740: 43 61 6e 6f 6e 69 63 61 6c 2c 20 7a 55 75 69 64  Canonical, zUuid
0750: 2c 20 55 55 49 44 5f 53 49 5a 45 2b 31 29 3b 0a  , UUID_SIZE+1);.
0760: 20 20 20 20 20 20 63 61 6e 6f 6e 69 63 61 6c 31        canonical1
0770: 36 28 7a 43 61 6e 6f 6e 69 63 61 6c 2c 20 55 55  6(zCanonical, UU
0780: 49 44 5f 53 49 5a 45 29 3b 0a 20 20 20 20 20 20  ID_SIZE);.      
0790: 7a 55 75 69 64 20 3d 20 7a 43 61 6e 6f 6e 69 63  zUuid = zCanonic
07a0: 61 6c 3b 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20  al;.    }.  }.  
07b0: 73 74 79 6c 65 5f 68 65 61 64 65 72 28 22 53 68  style_header("Sh
07c0: 75 6e 6e 65 64 20 41 72 74 69 66 61 63 74 73 22  unned Artifacts"
07d0: 29 3b 0a 20 20 69 66 28 20 7a 55 75 69 64 20 26  );.  if( zUuid &
07e0: 26 20 50 28 22 73 75 62 22 29 20 29 7b 0a 20 20  & P("sub") ){.  
07f0: 20 20 6c 6f 67 69 6e 5f 76 65 72 69 66 79 5f 63    login_verify_c
0800: 73 72 66 5f 73 65 63 72 65 74 28 29 3b 0a 20 20  srf_secret();.  
0810: 20 20 64 62 5f 6d 75 6c 74 69 5f 65 78 65 63 28    db_multi_exec(
0820: 22 44 45 4c 45 54 45 20 46 52 4f 4d 20 73 68 75  "DELETE FROM shu
0830: 6e 20 57 48 45 52 45 20 75 75 69 64 3d 27 25 73  n WHERE uuid='%s
0840: 27 22 2c 20 7a 55 75 69 64 29 3b 0a 20 20 20 20  '", zUuid);.    
0850: 69 66 28 20 64 62 5f 65 78 69 73 74 73 28 22 53  if( db_exists("S
0860: 45 4c 45 43 54 20 31 20 46 52 4f 4d 20 62 6c 6f  ELECT 1 FROM blo
0870: 62 20 57 48 45 52 45 20 75 75 69 64 3d 27 25 73  b WHERE uuid='%s
0880: 27 22 2c 20 7a 55 75 69 64 29 20 29 7b 0a 20 20  '", zUuid) ){.  
0890: 20 20 20 20 40 20 3c 70 3e 3c 66 6f 6e 74 20 63      @ <p><font c
08a0: 6f 6c 6f 72 3d 22 62 6c 75 65 22 3e 41 72 74 69  olor="blue">Arti
08b0: 66 61 63 74 20 0a 20 20 20 20 20 20 40 20 3c 61  fact .      @ <a
08c0: 20 68 72 65 66 3d 22 25 73 28 67 2e 7a 42 61 73   href="%s(g.zBas
08d0: 65 55 52 4c 29 2f 61 72 74 69 66 61 63 74 2f 25  eURL)/artifact/%
08e0: 73 28 7a 55 75 69 64 29 22 3e 25 73 28 7a 55 75  s(zUuid)">%s(zUu
08f0: 69 64 29 3c 2f 61 3e 20 69 73 20 6e 6f 0a 20 20  id)</a> is no.  
0900: 20 20 20 20 40 20 6c 6f 6e 67 65 72 20 62 65 69      @ longer bei
0910: 6e 67 20 73 68 75 6e 6e 65 64 2e 3c 2f 66 6f 6e  ng shunned.</fon
0920: 74 3e 3c 2f 70 3e 0a 20 20 20 20 7d 65 6c 73 65  t></p>.    }else
0930: 7b 0a 20 20 20 20 20 20 40 20 3c 70 3e 3c 66 6f  {.      @ <p><fo
0940: 6e 74 20 63 6f 6c 6f 72 3d 22 62 6c 75 65 22 3e  nt color="blue">
0950: 41 72 74 69 66 61 63 74 20 25 73 28 7a 55 75 69  Artifact %s(zUui
0960: 64 29 3c 2f 61 3e 20 77 69 6c 6c 20 6e 6f 20 6c  d)</a> will no l
0970: 6f 6e 67 65 72 0a 20 20 20 20 20 20 40 20 62 65  onger.      @ be
0980: 20 73 68 75 6e 6e 65 64 2e 20 20 42 75 74 20 69   shunned.  But i
0990: 74 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74  t does not exist
09a0: 20 69 6e 20 74 68 65 20 72 65 70 6f 73 69 74 6f   in the reposito
09b0: 72 79 2e 20 20 49 74 0a 20 20 20 20 20 20 40 20  ry.  It.      @ 
09c0: 6d 61 79 20 62 65 20 6e 65 63 65 73 73 61 72 79  may be necessary
09d0: 20 74 6f 20 72 65 62 75 69 6c 64 20 74 68 65 20   to rebuild the 
09e0: 72 65 70 6f 73 69 74 6f 72 79 20 75 73 69 6e 67  repository using
09f0: 20 74 68 65 0a 20 20 20 20 20 20 40 20 3c 62 3e   the.      @ <b>
0a00: 66 6f 73 73 69 6c 20 72 65 62 75 69 6c 64 3c 2f  fossil rebuild</
0a10: 62 3e 20 63 6f 6d 6d 61 6e 64 2d 6c 69 6e 65 20  b> command-line 
0a20: 62 65 66 6f 72 65 20 74 68 65 20 61 72 74 69 66  before the artif
0a30: 61 63 74 20 63 6f 6e 74 65 6e 74 0a 20 20 20 20  act content.    
0a40: 20 20 40 20 63 61 6e 20 70 75 6c 6c 65 64 20 69    @ can pulled i
0a50: 6e 20 66 72 6f 6d 20 6f 74 68 65 72 20 72 65 73  n from other res
0a60: 70 6f 73 69 74 6f 72 69 65 73 2e 3c 2f 66 6f 6e  positories.</fon
0a70: 74 3e 3c 2f 70 3e 0a 20 20 20 20 7d 0a 20 20 7d  t></p>.    }.  }
0a80: 0a 20 20 69 66 28 20 7a 55 75 69 64 20 26 26 20  .  if( zUuid && 
0a90: 50 28 22 61 64 64 22 29 20 29 7b 0a 20 20 20 20  P("add") ){.    
0aa0: 6c 6f 67 69 6e 5f 76 65 72 69 66 79 5f 63 73 72  login_verify_csr
0ab0: 66 5f 73 65 63 72 65 74 28 29 3b 0a 20 20 20 20  f_secret();.    
0ac0: 64 62 5f 6d 75 6c 74 69 5f 65 78 65 63 28 22 49  db_multi_exec("I
0ad0: 4e 53 45 52 54 20 4f 52 20 49 47 4e 4f 52 45 20  NSERT OR IGNORE 
0ae0: 49 4e 54 4f 20 73 68 75 6e 20 56 41 4c 55 45 53  INTO shun VALUES
0af0: 28 27 25 73 27 29 22 2c 20 7a 55 75 69 64 29 3b  ('%s')", zUuid);
0b00: 0a 20 20 20 20 40 20 3c 70 3e 3c 66 6f 6e 74 20  .    @ <p><font 
0b10: 63 6f 6c 6f 72 3d 22 62 6c 75 65 22 3e 41 72 74  color="blue">Art
0b20: 69 66 61 63 74 0a 20 20 20 20 40 20 3c 61 20 68  ifact.    @ <a h
0b30: 72 65 66 3d 22 25 73 28 67 2e 7a 42 61 73 65 55  ref="%s(g.zBaseU
0b40: 52 4c 29 2f 61 72 74 69 66 61 63 74 2f 25 73 28  RL)/artifact/%s(
0b50: 7a 55 75 69 64 29 22 3e 25 73 28 7a 55 75 69 64  zUuid)">%s(zUuid
0b60: 29 3c 2f 61 3e 20 68 61 73 20 62 65 65 6e 0a 20  )</a> has been. 
0b70: 20 20 20 40 20 73 68 75 6e 6e 65 64 2e 20 20 49     @ shunned.  I
0b80: 74 20 77 69 6c 6c 20 6e 6f 20 6c 6f 6e 67 65 72  t will no longer
0b90: 20 62 65 20 70 75 73 68 65 64 2e 0a 20 20 20 20   be pushed..    
0ba0: 40 20 49 74 20 77 69 6c 6c 20 62 65 20 72 65 6d  @ It will be rem
0bb0: 6f 76 65 64 20 66 72 6f 6d 20 74 68 65 20 72 65  oved from the re
0bc0: 70 6f 73 69 74 6f 72 79 20 74 68 65 20 6e 65 78  pository the nex
0bd0: 74 20 74 69 6d 65 20 74 68 65 20 72 65 73 70 6f  t time the respo
0be0: 73 69 74 6f 72 79 0a 20 20 20 20 40 20 69 73 20  sitory.    @ is 
0bf0: 72 65 62 75 69 6c 74 20 75 73 69 6e 67 20 74 68  rebuilt using th
0c00: 65 20 3c 62 3e 66 6f 73 73 69 6c 20 72 65 62 75  e <b>fossil rebu
0c10: 69 6c 64 3c 2f 62 3e 20 63 6f 6d 6d 61 6e 64 2d  ild</b> command-
0c20: 6c 69 6e 65 3c 2f 66 6f 6e 74 3e 3c 2f 70 3e 0a  line</font></p>.
0c30: 20 20 7d 0a 20 20 40 20 3c 70 3e 54 68 65 20 61    }.  @ <p>The a
0c40: 72 74 69 66 61 63 74 73 20 6c 69 73 74 65 64 20  rtifacts listed 
0c50: 62 65 6c 6f 77 20 68 61 76 65 20 62 65 65 6e 20  below have been 
0c60: 73 68 75 6e 6e 65 64 20 62 79 20 74 68 69 73 20  shunned by this 
0c70: 72 65 70 6f 73 69 74 6f 72 79 2e 0a 20 20 40 20  repository..  @ 
0c80: 54 68 69 73 20 6d 65 61 6e 73 20 74 68 61 74 20  This means that 
0c90: 74 68 65 20 61 72 74 69 66 61 63 74 73 20 77 69  the artifacts wi
0ca0: 6c 6c 20 6e 6f 74 20 62 65 20 74 72 61 6e 73 6d  ll not be transm
0cb0: 69 74 74 65 64 20 6f 6e 20 61 20 70 75 73 68 20  itted on a push 
0cc0: 6e 6f 72 0a 20 20 40 20 72 65 63 69 65 76 65 64  nor.  @ recieved
0cd0: 20 6f 6e 20 61 20 70 75 6c 6c 2e 20 20 54 68 65   on a pull.  The
0ce0: 73 65 20 61 72 74 69 66 61 63 74 73 20 61 72 65  se artifacts are
0cf0: 20 62 61 6e 6e 65 64 20 66 72 6f 6d 20 74 68 65   banned from the
0d00: 20 72 65 73 70 6f 73 69 74 6f 72 79 2e 3c 2f 70   respository.</p
0d10: 3e 0a 20 20 40 20 3c 62 6c 6f 63 6b 71 75 6f 74  >.  @ <blockquot
0d20: 65 3e 0a 20 20 64 62 5f 70 72 65 70 61 72 65 28  e>.  db_prepare(
0d30: 26 71 2c 20 0a 20 20 20 20 20 22 53 45 4c 45 43  &q, .     "SELEC
0d40: 54 20 75 75 69 64 2c 20 45 58 49 53 54 53 28 53  T uuid, EXISTS(S
0d50: 45 4c 45 43 54 20 31 20 46 52 4f 4d 20 62 6c 6f  ELECT 1 FROM blo
0d60: 62 20 57 48 45 52 45 20 62 6c 6f 62 2e 75 75 69  b WHERE blob.uui
0d70: 64 3d 73 68 75 6e 2e 75 75 69 64 29 22 0a 20 20  d=shun.uuid)".  
0d80: 20 20 20 22 20 20 46 52 4f 4d 20 73 68 75 6e 20     "  FROM shun 
0d90: 4f 52 44 45 52 20 42 59 20 75 75 69 64 22 29 3b  ORDER BY uuid");
0da0: 0a 20 20 77 68 69 6c 65 28 20 64 62 5f 73 74 65  .  while( db_ste
0db0: 70 28 26 71 29 3d 3d 53 51 4c 49 54 45 5f 52 4f  p(&q)==SQLITE_RO
0dc0: 57 20 29 7b 0a 20 20 20 20 63 6f 6e 73 74 20 63  W ){.    const c
0dd0: 68 61 72 20 2a 7a 55 75 69 64 20 3d 20 64 62 5f  har *zUuid = db_
0de0: 63 6f 6c 75 6d 6e 5f 74 65 78 74 28 26 71 2c 20  column_text(&q, 
0df0: 30 29 3b 0a 20 20 20 20 69 6e 74 20 73 74 69 6c  0);.    int stil
0e00: 6c 45 78 69 73 74 73 20 3d 20 64 62 5f 63 6f 6c  lExists = db_col
0e10: 75 6d 6e 5f 69 6e 74 28 26 71 2c 20 31 29 3b 0a  umn_int(&q, 1);.
0e20: 20 20 20 20 63 6e 74 2b 2b 3b 0a 20 20 20 20 69      cnt++;.    i
0e30: 66 28 20 73 74 69 6c 6c 45 78 69 73 74 73 20 29  f( stillExists )
0e40: 7b 0a 20 20 20 20 20 20 40 20 3c 62 3e 3c 61 20  {.      @ <b><a 
0e50: 68 72 65 66 3d 22 25 73 28 67 2e 7a 42 61 73 65  href="%s(g.zBase
0e60: 55 52 4c 29 2f 61 72 74 69 66 61 63 74 2f 25 73  URL)/artifact/%s
0e70: 28 7a 55 75 69 64 29 22 3e 25 73 28 7a 55 75 69  (zUuid)">%s(zUui
0e80: 64 29 3c 2f 61 3e 3c 2f 62 3e 3c 62 72 3e 0a 20  d)</a></b><br>. 
0e90: 20 20 20 7d 65 6c 73 65 7b 0a 20 20 20 20 20 20     }else{.      
0ea0: 40 20 3c 62 3e 25 73 28 7a 55 75 69 64 29 3c 2f  @ <b>%s(zUuid)</
0eb0: 62 3e 3c 62 72 3e 0a 20 20 20 20 7d 0a 20 20 7d  b><br>.    }.  }
0ec0: 0a 20 20 69 66 28 20 63 6e 74 3d 3d 30 20 29 7b  .  if( cnt==0 ){
0ed0: 0a 20 20 20 20 40 20 3c 69 3e 6e 6f 20 61 72 74  .    @ <i>no art
0ee0: 69 66 61 63 74 73 20 61 72 65 20 73 68 75 6e 6e  ifacts are shunn
0ef0: 65 64 20 6f 6e 20 74 68 69 73 20 73 65 72 76 65  ed on this serve
0f00: 72 3c 2f 69 3e 0a 20 20 7d 0a 20 20 64 62 5f 66  r</i>.  }.  db_f
0f10: 69 6e 61 6c 69 7a 65 28 26 71 29 3b 0a 20 20 40  inalize(&q);.  @
0f20: 20 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 20   </blockquote>. 
0f30: 20 40 20 3c 68 72 3e 0a 20 20 40 20 3c 61 20 6e   @ <hr>.  @ <a n
0f40: 61 6d 65 3d 22 61 64 64 73 68 75 6e 22 3e 3c 2f  ame="addshun"></
0f50: 61 3e 0a 20 20 40 20 3c 70 3e 54 6f 20 73 68 75  a>.  @ <p>To shu
0f60: 6e 20 61 6e 20 61 72 74 69 66 61 63 74 2c 20 65  n an artifact, e
0f70: 6e 74 65 72 20 69 74 73 20 61 72 74 69 66 61 63  nter its artifac
0f80: 74 20 49 44 20 28 74 68 65 20 34 30 2d 63 68 61  t ID (the 40-cha
0f90: 72 61 63 74 65 72 20 53 48 41 31 0a 20 20 40 20  racter SHA1.  @ 
0fa0: 68 61 73 68 20 6f 66 20 74 68 65 20 61 72 74 69  hash of the arti
0fb0: 66 61 63 74 29 20 69 6e 20 74 68 65 0a 20 20 40  fact) in the.  @
0fc0: 20 66 6f 6c 6c 6f 77 69 6e 67 20 62 6f 78 20 61   following box a
0fd0: 6e 64 20 70 72 65 73 73 20 74 68 65 20 22 53 68  nd press the "Sh
0fe0: 75 6e 22 20 62 75 74 74 6f 6e 2e 20 20 54 68 69  un" button.  Thi
0ff0: 73 20 77 69 6c 6c 20 63 61 75 73 65 20 74 68 65  s will cause the
1000: 20 61 72 74 69 66 61 63 74 0a 20 20 40 20 74 6f   artifact.  @ to
1010: 20 62 65 20 72 65 6d 6f 76 65 64 20 66 72 6f 6d   be removed from
1020: 20 74 68 65 20 72 65 70 6f 73 69 74 6f 72 79 20   the repository 
1030: 61 6e 64 20 77 69 6c 6c 20 70 72 65 76 65 6e 74  and will prevent
1040: 20 74 68 65 20 61 72 74 69 66 61 63 74 20 66 72   the artifact fr
1050: 6f 6d 20 62 65 69 6e 67 0a 20 20 40 20 72 65 61  om being.  @ rea
1060: 64 64 65 64 20 74 6f 20 74 68 65 20 72 65 70 6f  dded to the repo
1070: 73 69 74 6f 72 79 20 62 79 20 73 75 62 73 65 71  sitory by subseq
1080: 75 65 6e 74 20 73 79 6e 63 20 6f 70 65 72 61 74  uent sync operat
1090: 69 6f 6e 2e 3c 2f 70 3e 0a 20 20 40 0a 20 20 40  ion.</p>.  @.  @
10a0: 20 3c 70 3e 4e 6f 74 65 20 74 68 61 74 20 79 6f   <p>Note that yo
10b0: 75 20 6d 75 73 74 20 65 6e 74 65 72 20 74 68 65  u must enter the
10c0: 20 66 75 6c 6c 20 34 30 2d 63 68 61 72 61 63 74   full 40-charact
10d0: 65 72 20 61 72 74 69 66 61 63 74 20 49 44 2c 20  er artifact ID, 
10e0: 6e 6f 74 0a 20 20 40 20 61 6e 20 61 62 62 72 65  not.  @ an abbre
10f0: 76 69 61 74 69 6f 6e 20 6f 72 20 61 20 73 79 6d  viation or a sym
1100: 62 6f 6c 69 63 20 74 61 67 2e 3c 2f 70 3e 0a 20  bolic tag.</p>. 
1110: 20 40 0a 20 20 40 20 3c 70 3e 57 61 72 6e 69 6e   @.  @ <p>Warnin
1120: 67 3a 20 20 53 68 75 6e 6e 69 6e 67 20 73 68 6f  g:  Shunning sho
1130: 75 6c 64 20 6f 6e 6c 79 20 62 65 20 75 73 65 64  uld only be used
1140: 20 74 6f 20 72 65 6d 6f 76 65 20 69 6e 61 70 70   to remove inapp
1150: 72 6f 70 72 69 61 74 65 20 63 6f 6e 74 65 6e 74  ropriate content
1160: 0a 20 20 40 20 66 72 6f 6d 20 74 68 65 20 72 65  .  @ from the re
1170: 70 6f 73 69 74 6f 72 79 2e 20 20 49 6e 61 70 70  pository.  Inapp
1180: 72 6f 70 72 69 61 74 65 20 63 6f 6e 74 65 6e 74  ropriate content
1190: 20 69 6e 63 6c 75 64 65 73 20 73 75 63 68 20 74   includes such t
11a0: 68 69 6e 67 73 20 61 73 0a 20 20 40 20 73 70 61  hings as.  @ spa
11b0: 6d 20 61 64 64 65 64 20 74 6f 20 57 69 6b 69 2c  m added to Wiki,
11c0: 20 66 69 6c 65 73 20 74 68 61 74 20 76 69 6f 6c   files that viol
11d0: 61 74 65 20 63 6f 70 79 72 69 67 68 74 20 6f 72  ate copyright or
11e0: 20 70 61 74 65 6e 74 20 61 67 72 65 65 6d 65 6e   patent agreemen
11f0: 74 73 2c 0a 20 20 40 20 6f 72 20 61 72 74 69 66  ts,.  @ or artif
1200: 61 63 74 73 20 74 68 61 74 20 62 79 20 64 65 73  acts that by des
1210: 69 67 6e 20 6f 72 20 61 63 63 69 64 65 6e 74 20  ign or accident 
1220: 69 6e 74 65 72 66 65 72 65 20 77 69 74 68 20 74  interfere with t
1230: 68 65 20 70 72 6f 63 65 73 73 69 6e 67 0a 20 20  he processing.  
1240: 40 20 6f 66 20 74 68 65 20 72 65 70 6f 73 69 74  @ of the reposit
1250: 6f 72 79 2e 20 20 44 6f 20 6e 6f 74 20 73 68 75  ory.  Do not shu
1260: 6e 20 61 72 74 69 66 61 63 74 73 20 6d 65 72 65  n artifacts mere
1270: 6c 79 20 74 6f 20 72 65 6d 6f 76 65 20 74 68 65  ly to remove the
1280: 6d 20 66 72 6f 6d 0a 20 20 40 20 73 69 67 68 74  m from.  @ sight
1290: 20 2d 20 73 65 74 20 74 68 65 20 22 68 69 64 64   - set the "hidd
12a0: 65 6e 22 20 74 61 67 20 6f 6e 20 73 75 63 68 20  en" tag on such 
12b0: 61 72 74 69 66 61 63 74 73 20 69 6e 73 74 65 61  artifacts instea
12c0: 64 2e 3c 2f 70 3e 0a 20 20 40 20 0a 20 20 40 20  d.</p>.  @ .  @ 
12d0: 3c 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 20 20 40  <blockquote>.  @
12e0: 20 3c 66 6f 72 6d 20 6d 65 74 68 6f 64 3d 22 50   <form method="P
12f0: 4f 53 54 22 20 61 63 74 69 6f 6e 3d 22 25 73 28  OST" action="%s(
1300: 67 2e 7a 42 61 73 65 55 52 4c 29 2f 25 73 28 67  g.zBaseURL)/%s(g
1310: 2e 7a 50 61 74 68 29 22 3e 0a 20 20 6c 6f 67 69  .zPath)">.  logi
1320: 6e 5f 69 6e 73 65 72 74 5f 63 73 72 66 5f 73 65  n_insert_csrf_se
1330: 63 72 65 74 28 29 3b 0a 20 20 40 20 3c 69 6e 70  cret();.  @ <inp
1340: 75 74 20 74 79 70 65 3d 22 74 65 78 74 22 20 6e  ut type="text" n
1350: 61 6d 65 3d 22 75 75 69 64 22 20 76 61 6c 75 65  ame="uuid" value
1360: 3d 22 25 68 28 50 44 28 22 73 68 75 6e 22 2c 22  ="%h(PD("shun","
1370: 22 29 29 22 20 73 69 7a 65 3d 22 35 30 22 3e 0a  "))" size="50">.
1380: 20 20 40 20 3c 69 6e 70 75 74 20 74 79 70 65 3d    @ <input type=
1390: 22 73 75 62 6d 69 74 22 20 6e 61 6d 65 3d 22 61  "submit" name="a
13a0: 64 64 22 20 76 61 6c 75 65 3d 22 53 68 75 6e 22  dd" value="Shun"
13b0: 3e 0a 20 20 40 20 3c 2f 66 6f 72 6d 3e 0a 20 20  >.  @ </form>.  
13c0: 40 20 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a  @ </blockquote>.
13d0: 20 20 40 0a 20 20 40 20 3c 70 3e 45 6e 74 65 72    @.  @ <p>Enter
13e0: 20 74 68 65 20 55 55 49 44 20 6f 66 20 61 20 70   the UUID of a p
13f0: 72 65 76 69 6f 75 73 20 73 68 75 6e 6e 65 64 20  revious shunned 
1400: 61 72 74 69 66 61 63 74 20 74 6f 20 63 61 75 73  artifact to caus
1410: 65 20 69 74 20 74 6f 20 62 65 0a 20 20 40 20 61  e it to be.  @ a
1420: 63 63 65 70 74 65 64 20 61 67 61 69 6e 20 69 6e  ccepted again in
1430: 20 74 68 65 20 72 65 70 6f 73 69 74 6f 72 79 2e   the repository.
1440: 20 20 54 68 65 20 61 72 74 69 66 61 63 74 20 63    The artifact c
1450: 6f 6e 74 65 6e 74 20 69 73 20 6e 6f 74 0a 20 20  ontent is not.  
1460: 40 20 72 65 73 74 6f 72 65 64 20 62 65 63 61 75  @ restored becau
1470: 73 65 20 74 68 65 20 63 6f 6e 74 65 6e 74 20 69  se the content i
1480: 73 20 75 6e 6b 6e 6f 77 6e 2e 20 20 54 68 65 20  s unknown.  The 
1490: 6f 6e 6c 79 20 63 68 61 6e 67 65 20 69 73 20 74  only change is t
14a0: 68 61 74 0a 20 20 40 20 74 68 65 20 66 6f 72 6d  hat.  @ the form
14b0: 65 72 6c 79 20 73 68 75 6e 6e 65 64 20 61 72 74  erly shunned art
14c0: 69 66 61 63 74 20 77 69 6c 6c 20 62 65 20 61 63  ifact will be ac
14d0: 63 65 70 74 65 64 20 6f 6e 20 73 75 62 73 65 71  cepted on subseq
14e0: 75 65 6e 74 20 73 79 6e 63 0a 20 20 40 20 6f 70  uent sync.  @ op
14f0: 65 72 61 74 69 6f 6e 73 2e 3c 2f 70 3e 0a 20 20  erations.</p>.  
1500: 40 0a 20 20 40 20 3c 62 6c 6f 63 6b 71 75 6f 74  @.  @ <blockquot
1510: 65 3e 0a 20 20 40 20 3c 66 6f 72 6d 20 6d 65 74  e>.  @ <form met
1520: 68 6f 64 3d 22 50 4f 53 54 22 20 61 63 74 69 6f  hod="POST" actio
1530: 6e 3d 22 25 73 28 67 2e 7a 42 61 73 65 55 52 4c  n="%s(g.zBaseURL
1540: 29 2f 25 73 28 67 2e 7a 50 61 74 68 29 22 3e 0a  )/%s(g.zPath)">.
1550: 20 20 6c 6f 67 69 6e 5f 69 6e 73 65 72 74 5f 63    login_insert_c
1560: 73 72 66 5f 73 65 63 72 65 74 28 29 3b 0a 20 20  srf_secret();.  
1570: 40 20 3c 69 6e 70 75 74 20 74 79 70 65 3d 22 74  @ <input type="t
1580: 65 78 74 22 20 6e 61 6d 65 3d 22 75 75 69 64 22  ext" name="uuid"
1590: 20 73 69 7a 65 3d 22 35 30 22 3e 0a 20 20 40 20   size="50">.  @ 
15a0: 3c 69 6e 70 75 74 20 74 79 70 65 3d 22 73 75 62  <input type="sub
15b0: 6d 69 74 22 20 6e 61 6d 65 3d 22 73 75 62 22 20  mit" name="sub" 
15c0: 76 61 6c 75 65 3d 22 41 63 63 65 70 74 22 3e 0a  value="Accept">.
15d0: 20 20 40 20 3c 2f 66 6f 72 6d 3e 0a 20 20 40 20    @ </form>.  @ 
15e0: 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 20 20  </blockquote>.  
15f0: 40 0a 20 20 40 20 3c 68 72 3e 0a 20 20 40 20 3c  @.  @ <hr>.  @ <
1600: 70 3e 50 72 65 73 73 20 74 68 65 20 62 75 74 74  p>Press the butt
1610: 6f 6e 20 62 65 6c 6f 77 20 74 6f 20 72 65 62 75  on below to rebu
1620: 69 6c 64 20 74 68 65 20 72 65 73 70 6f 73 69 74  ild the resposit
1630: 6f 72 79 2e 20 20 54 68 65 20 72 65 62 75 69 6c  ory.  The rebuil
1640: 64 0a 20 20 40 20 6d 61 79 20 74 61 6b 65 20 73  d.  @ may take s
1650: 65 76 65 72 61 6c 20 73 65 63 6f 6e 64 73 2c 20  everal seconds, 
1660: 73 6f 20 62 65 20 70 61 74 69 65 6e 74 20 61 66  so be patient af
1670: 74 65 72 20 70 72 65 73 73 69 6e 67 20 74 68 65  ter pressing the
1680: 20 62 75 74 74 6f 6e 2e 3c 2f 70 3e 0a 20 20 40   button.</p>.  @
1690: 0a 20 20 40 20 3c 62 6c 6f 63 6b 71 75 6f 74 65  .  @ <blockquote
16a0: 3e 0a 20 20 40 20 3c 66 6f 72 6d 20 6d 65 74 68  >.  @ <form meth
16b0: 6f 64 3d 22 50 4f 53 54 22 20 61 63 74 69 6f 6e  od="POST" action
16c0: 3d 22 25 73 28 67 2e 7a 42 61 73 65 55 52 4c 29  ="%s(g.zBaseURL)
16d0: 2f 25 73 28 67 2e 7a 50 61 74 68 29 22 3e 0a 20  /%s(g.zPath)">. 
16e0: 20 6c 6f 67 69 6e 5f 69 6e 73 65 72 74 5f 63 73   login_insert_cs
16f0: 72 66 5f 73 65 63 72 65 74 28 29 3b 0a 20 20 40  rf_secret();.  @
1700: 20 3c 69 6e 70 75 74 20 74 79 70 65 3d 22 73 75   <input type="su
1710: 62 6d 69 74 22 20 6e 61 6d 65 3d 22 72 65 62 75  bmit" name="rebu
1720: 69 6c 64 22 20 76 61 6c 75 65 3d 22 52 65 62 75  ild" value="Rebu
1730: 69 6c 64 22 3e 0a 20 20 40 20 3c 2f 66 6f 72 6d  ild">.  @ </form
1740: 3e 0a 20 20 40 20 3c 2f 62 6c 6f 63 6b 71 75 6f  >.  @ </blockquo
1750: 74 65 3e 0a 20 20 40 20 20 0a 20 20 73 74 79 6c  te>.  @  .  styl
1760: 65 5f 66 6f 6f 74 65 72 28 29 3b 0a 7d 0a 0a 2f  e_footer();.}../
1770: 2a 0a 2a 2a 20 52 65 6d 6f 76 65 20 66 72 6f 6d  *.** Remove from
1780: 20 74 68 65 20 42 4c 4f 42 20 74 61 62 6c 65 20   the BLOB table 
1790: 61 6c 6c 20 61 72 74 69 66 61 63 74 73 20 74 68  all artifacts th
17a0: 61 74 20 61 72 65 20 69 6e 20 74 68 65 20 53 48  at are in the SH
17b0: 55 4e 20 74 61 62 6c 65 2e 0a 2a 2f 0a 76 6f 69  UN table..*/.voi
17c0: 64 20 73 68 75 6e 5f 61 72 74 69 66 61 63 74 73  d shun_artifacts
17d0: 28 76 6f 69 64 29 7b 0a 20 20 53 74 6d 74 20 71  (void){.  Stmt q
17e0: 3b 0a 20 20 64 62 5f 6d 75 6c 74 69 5f 65 78 65  ;.  db_multi_exe
17f0: 63 28 0a 20 20 20 20 20 22 43 52 45 41 54 45 20  c(.     "CREATE 
1800: 54 45 4d 50 20 54 41 42 4c 45 20 74 6f 73 68 75  TEMP TABLE toshu
1810: 6e 28 72 69 64 20 49 4e 54 45 47 45 52 20 50 52  n(rid INTEGER PR
1820: 49 4d 41 52 59 20 4b 45 59 29 3b 22 0a 20 20 20  IMARY KEY);".   
1830: 20 20 22 49 4e 53 45 52 54 20 49 4e 54 4f 20 74    "INSERT INTO t
1840: 6f 73 68 75 6e 20 53 45 4c 45 43 54 20 72 69 64  oshun SELECT rid
1850: 20 46 52 4f 4d 20 62 6c 6f 62 2c 20 73 68 75 6e   FROM blob, shun
1860: 20 57 48 45 52 45 20 62 6c 6f 62 2e 75 75 69 64   WHERE blob.uuid
1870: 3d 73 68 75 6e 2e 75 75 69 64 3b 22 0a 20 20 29  =shun.uuid;".  )
1880: 3b 0a 20 20 64 62 5f 70 72 65 70 61 72 65 28 26  ;.  db_prepare(&
1890: 71 2c 0a 20 20 20 20 20 22 53 45 4c 45 43 54 20  q,.     "SELECT 
18a0: 72 69 64 20 46 52 4f 4d 20 64 65 6c 74 61 20 57  rid FROM delta W
18b0: 48 45 52 45 20 73 72 63 69 64 20 49 4e 20 74 6f  HERE srcid IN to
18c0: 73 68 75 6e 22 0a 20 20 29 3b 0a 20 20 77 68 69  shun".  );.  whi
18d0: 6c 65 28 20 64 62 5f 73 74 65 70 28 26 71 29 3d  le( db_step(&q)=
18e0: 3d 53 51 4c 49 54 45 5f 52 4f 57 20 29 7b 0a 20  =SQLITE_ROW ){. 
18f0: 20 20 20 69 6e 74 20 73 72 63 69 64 20 3d 20 64     int srcid = d
1900: 62 5f 63 6f 6c 75 6d 6e 5f 69 6e 74 28 26 71 2c  b_column_int(&q,
1910: 20 30 29 3b 0a 20 20 20 20 63 6f 6e 74 65 6e 74   0);.    content
1920: 5f 75 6e 64 65 6c 74 61 28 73 72 63 69 64 29 3b  _undelta(srcid);
1930: 0a 20 20 7d 0a 20 20 64 62 5f 66 69 6e 61 6c 69  .  }.  db_finali
1940: 7a 65 28 26 71 29 3b 0a 20 20 64 62 5f 6d 75 6c  ze(&q);.  db_mul
1950: 74 69 5f 65 78 65 63 28 0a 20 20 20 20 20 22 44  ti_exec(.     "D
1960: 45 4c 45 54 45 20 46 52 4f 4d 20 64 65 6c 74 61  ELETE FROM delta
1970: 20 57 48 45 52 45 20 72 69 64 20 49 4e 20 74 6f   WHERE rid IN to
1980: 73 68 75 6e 3b 22 0a 20 20 20 20 20 22 44 45 4c  shun;".     "DEL
1990: 45 54 45 20 46 52 4f 4d 20 62 6c 6f 62 20 57 48  ETE FROM blob WH
19a0: 45 52 45 20 72 69 64 20 49 4e 20 74 6f 73 68 75  ERE rid IN toshu
19b0: 6e 3b 22 0a 20 20 20 20 20 22 44 52 4f 50 20 54  n;".     "DROP T
19c0: 41 42 4c 45 20 74 6f 73 68 75 6e 3b 22 0a 20 20  ABLE toshun;".  
19d0: 29 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 57 45 42 50  );.}../*.** WEBP
19e0: 41 47 45 3a 20 72 63 76 66 72 6f 6d 6c 69 73 74  AGE: rcvfromlist
19f0: 0a 2a 2a 0a 2a 2a 20 53 68 6f 77 20 61 20 6c 69  .**.** Show a li
1a00: 73 74 69 6e 67 20 6f 66 20 52 43 56 46 52 4f 4d  sting of RCVFROM
1a10: 20 74 61 62 6c 65 20 65 6e 74 72 69 65 73 2e 0a   table entries..
1a20: 2a 2f 0a 76 6f 69 64 20 72 63 76 66 72 6f 6d 6c  */.void rcvfroml
1a30: 69 73 74 5f 70 61 67 65 28 76 6f 69 64 29 7b 0a  ist_page(void){.
1a40: 20 20 69 6e 74 20 6f 66 73 74 20 3d 20 61 74 6f    int ofst = ato
1a50: 69 28 50 44 28 22 6f 66 73 74 22 2c 22 30 22 29  i(PD("ofst","0")
1a60: 29 3b 0a 20 20 69 6e 74 20 63 6e 74 3b 0a 20 20  );.  int cnt;.  
1a70: 53 74 6d 74 20 71 3b 0a 0a 20 20 6c 6f 67 69 6e  Stmt q;..  login
1a80: 5f 63 68 65 63 6b 5f 63 72 65 64 65 6e 74 69 61  _check_credentia
1a90: 6c 73 28 29 3b 0a 20 20 69 66 28 20 21 67 2e 6f  ls();.  if( !g.o
1aa0: 6b 41 64 6d 69 6e 20 29 7b 0a 20 20 20 20 6c 6f  kAdmin ){.    lo
1ab0: 67 69 6e 5f 6e 65 65 64 65 64 28 29 3b 0a 20 20  gin_needed();.  
1ac0: 7d 0a 20 20 73 74 79 6c 65 5f 68 65 61 64 65 72  }.  style_header
1ad0: 28 22 43 6f 6e 74 65 6e 74 20 53 6f 75 72 63 65  ("Content Source
1ae0: 73 22 29 3b 0a 20 20 69 66 28 20 6f 66 73 74 3e  s");.  if( ofst>
1af0: 30 20 29 7b 0a 20 20 20 20 73 74 79 6c 65 5f 73  0 ){.    style_s
1b00: 75 62 6d 65 6e 75 5f 65 6c 65 6d 65 6e 74 28 22  ubmenu_element("
1b10: 4c 61 74 65 72 22 2c 20 22 4c 61 74 65 72 22 2c  Later", "Later",
1b20: 20 22 72 63 76 66 72 6f 6d 6c 69 73 74 3f 6f 66   "rcvfromlist?of
1b30: 73 74 3d 25 64 22 2c 0a 20 20 20 20 20 20 20 20  st=%d",.        
1b40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1b50: 20 20 20 6f 66 73 74 3e 33 30 20 3f 20 6f 66 73     ofst>30 ? ofs
1b60: 74 2d 33 30 20 3a 20 30 29 3b 0a 20 20 7d 0a 20  t-30 : 0);.  }. 
1b70: 20 64 62 5f 70 72 65 70 61 72 65 28 26 71 2c 20   db_prepare(&q, 
1b80: 0a 20 20 20 20 22 53 45 4c 45 43 54 20 72 63 76  .    "SELECT rcv
1b90: 69 64 2c 20 6c 6f 67 69 6e 2c 20 64 61 74 65 74  id, login, datet
1ba0: 69 6d 65 28 72 63 76 66 72 6f 6d 2e 6d 74 69 6d  ime(rcvfrom.mtim
1bb0: 65 29 2c 20 72 63 76 66 72 6f 6d 2e 69 70 61 64  e), rcvfrom.ipad
1bc0: 64 72 22 0a 20 20 20 20 22 20 20 46 52 4f 4d 20  dr".    "  FROM 
1bd0: 72 63 76 66 72 6f 6d 20 4c 45 46 54 20 4a 4f 49  rcvfrom LEFT JOI
1be0: 4e 20 75 73 65 72 20 55 53 49 4e 47 28 75 69 64  N user USING(uid
1bf0: 29 22 0a 20 20 20 20 22 20 4f 52 44 45 52 20 42  )".    " ORDER B
1c00: 59 20 72 63 76 69 64 20 44 45 53 43 20 4c 49 4d  Y rcvid DESC LIM
1c10: 49 54 20 33 31 20 4f 46 46 53 45 54 20 25 64 22  IT 31 OFFSET %d"
1c20: 2c 0a 20 20 20 20 6f 66 73 74 0a 20 20 29 3b 0a  ,.    ofst.  );.
1c30: 20 20 40 20 3c 74 61 62 6c 65 20 63 65 6c 6c 70    @ <table cellp
1c40: 61 64 64 69 6e 67 3d 30 20 63 65 6c 6c 73 70 61  adding=0 cellspa
1c50: 63 69 6e 67 3d 30 20 62 6f 72 64 65 72 3d 30 3e  cing=0 border=0>
1c60: 0a 20 20 40 20 3c 74 72 3e 3c 74 68 3e 72 63 76  .  @ <tr><th>rcv
1c70: 69 64 3c 2f 74 68 3e 3c 74 68 20 77 69 64 74 68  id</th><th width
1c80: 3d 31 35 3e 0a 20 20 40 20 20 20 20 20 3c 74 68  =15>.  @     <th
1c90: 3e 44 61 74 65 3c 2f 74 68 3e 3c 74 68 20 77 69  >Date</th><th wi
1ca0: 64 74 68 3d 31 35 3e 3c 74 68 3e 55 73 65 72 3c  dth=15><th>User<
1cb0: 2f 74 68 3e 0a 20 20 40 20 20 20 20 20 3c 74 68  /th>.  @     <th
1cc0: 20 77 69 64 74 68 3d 31 35 3e 3c 74 68 3e 49 50   width=15><th>IP
1cd0: 26 6e 62 73 70 3b 41 64 64 72 65 73 73 3c 2f 74  &nbsp;Address</t
1ce0: 68 3e 3c 2f 74 72 3e 0a 20 20 63 6e 74 20 3d 20  h></tr>.  cnt = 
1cf0: 30 3b 0a 20 20 77 68 69 6c 65 28 20 64 62 5f 73  0;.  while( db_s
1d00: 74 65 70 28 26 71 29 3d 3d 53 51 4c 49 54 45 5f  tep(&q)==SQLITE_
1d10: 52 4f 57 20 29 7b 0a 20 20 20 20 69 6e 74 20 72  ROW ){.    int r
1d20: 63 76 69 64 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e  cvid = db_column
1d30: 5f 69 6e 74 28 26 71 2c 20 30 29 3b 0a 20 20 20  _int(&q, 0);.   
1d40: 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 55 73   const char *zUs
1d50: 65 72 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74  er = db_column_t
1d60: 65 78 74 28 26 71 2c 20 31 29 3b 0a 20 20 20 20  ext(&q, 1);.    
1d70: 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 44 61 74  const char *zDat
1d80: 65 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74 65  e = db_column_te
1d90: 78 74 28 26 71 2c 20 32 29 3b 0a 20 20 20 20 63  xt(&q, 2);.    c
1da0: 6f 6e 73 74 20 63 68 61 72 20 2a 7a 49 70 41 64  onst char *zIpAd
1db0: 64 72 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74  dr = db_column_t
1dc0: 65 78 74 28 26 71 2c 20 33 29 3b 0a 20 20 20 20  ext(&q, 3);.    
1dd0: 69 66 28 20 63 6e 74 3d 3d 33 30 20 29 7b 0a 20  if( cnt==30 ){. 
1de0: 20 20 20 20 20 73 74 79 6c 65 5f 73 75 62 6d 65       style_subme
1df0: 6e 75 5f 65 6c 65 6d 65 6e 74 28 22 45 61 72 6c  nu_element("Earl
1e00: 69 65 72 22 2c 20 22 45 61 72 6c 69 65 72 22 2c  ier", "Earlier",
1e10: 0a 20 20 20 20 20 20 20 20 20 22 72 63 76 66 72  .         "rcvfr
1e20: 6f 6d 6c 69 73 74 3f 6f 66 73 74 3d 25 64 22 2c  omlist?ofst=%d",
1e30: 20 6f 66 73 74 2b 33 30 29 3b 0a 20 20 20 20 7d   ofst+30);.    }
1e40: 65 6c 73 65 7b 0a 20 20 20 20 20 20 63 6e 74 2b  else{.      cnt+
1e50: 2b 3b 0a 20 20 20 20 20 20 40 20 3c 74 72 3e 0a  +;.      @ <tr>.
1e60: 20 20 20 20 20 20 40 20 3c 74 64 3e 3c 61 20 68        @ <td><a h
1e70: 72 65 66 3d 22 72 63 76 66 72 6f 6d 3f 72 63 76  ref="rcvfrom?rcv
1e80: 69 64 3d 25 64 28 72 63 76 69 64 29 22 3e 25 64  id=%d(rcvid)">%d
1e90: 28 72 63 76 69 64 29 3c 2f 61 3e 3c 2f 74 64 3e  (rcvid)</a></td>
1ea0: 3c 74 64 3e 0a 20 20 20 20 20 20 40 20 3c 74 64  <td>.      @ <td
1eb0: 3e 25 73 28 7a 44 61 74 65 29 3c 2f 74 64 3e 3c  >%s(zDate)</td><
1ec0: 74 64 3e 0a 20 20 20 20 20 20 40 20 3c 74 64 3e  td>.      @ <td>
1ed0: 25 68 28 7a 55 73 65 72 29 3c 2f 74 64 3e 3c 74  %h(zUser)</td><t
1ee0: 64 3e 0a 20 20 20 20 20 20 40 20 3c 74 64 3e 26  d>.      @ <td>&
1ef0: 6e 62 73 70 3b 25 73 28 7a 49 70 41 64 64 72 29  nbsp;%s(zIpAddr)
1f00: 26 6e 62 73 70 3c 2f 74 64 3e 0a 20 20 20 20 20  &nbsp</td>.     
1f10: 20 40 20 3c 2f 74 72 3e 0a 20 20 20 20 7d 0a 20   @ </tr>.    }. 
1f20: 20 7d 0a 20 20 64 62 5f 66 69 6e 61 6c 69 7a 65   }.  db_finalize
1f30: 28 26 71 29 3b 0a 20 20 40 20 3c 2f 74 61 62 6c  (&q);.  @ </tabl
1f40: 65 3e 0a 20 20 73 74 79 6c 65 5f 66 6f 6f 74 65  e>.  style_foote
1f50: 72 28 29 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 57 45  r();.}../*.** WE
1f60: 42 50 41 47 45 3a 20 72 63 76 66 72 6f 6d 0a 2a  BPAGE: rcvfrom.*
1f70: 2a 0a 2a 2a 20 53 68 6f 77 20 61 20 73 69 6e 67  *.** Show a sing
1f80: 6c 65 20 52 43 56 46 52 4f 4d 20 74 61 62 6c 65  le RCVFROM table
1f90: 20 65 6e 74 72 79 2e 0a 2a 2f 0a 76 6f 69 64 20   entry..*/.void 
1fa0: 72 63 76 66 72 6f 6d 5f 70 61 67 65 28 76 6f 69  rcvfrom_page(voi
1fb0: 64 29 7b 0a 20 20 69 6e 74 20 72 63 76 69 64 20  d){.  int rcvid 
1fc0: 3d 20 61 74 6f 69 28 50 44 28 22 72 63 76 69 64  = atoi(PD("rcvid
1fd0: 22 2c 22 30 22 29 29 3b 0a 20 20 53 74 6d 74 20  ","0"));.  Stmt 
1fe0: 71 3b 0a 0a 20 20 6c 6f 67 69 6e 5f 63 68 65 63  q;..  login_chec
1ff0: 6b 5f 63 72 65 64 65 6e 74 69 61 6c 73 28 29 3b  k_credentials();
2000: 0a 20 20 69 66 28 20 21 67 2e 6f 6b 41 64 6d 69  .  if( !g.okAdmi
2010: 6e 20 29 7b 0a 20 20 20 20 6c 6f 67 69 6e 5f 6e  n ){.    login_n
2020: 65 65 64 65 64 28 29 3b 0a 20 20 7d 0a 20 20 73  eeded();.  }.  s
2030: 74 79 6c 65 5f 68 65 61 64 65 72 28 22 43 6f 6e  tyle_header("Con
2040: 74 65 6e 74 20 53 6f 75 72 63 65 20 25 64 22 2c  tent Source %d",
2050: 20 72 63 76 69 64 29 3b 0a 20 20 64 62 5f 70 72   rcvid);.  db_pr
2060: 65 70 61 72 65 28 26 71 2c 20 0a 20 20 20 20 22  epare(&q, .    "
2070: 53 45 4c 45 43 54 20 6c 6f 67 69 6e 2c 20 64 61  SELECT login, da
2080: 74 65 74 69 6d 65 28 72 63 76 66 72 6f 6d 2e 6d  tetime(rcvfrom.m
2090: 74 69 6d 65 29 2c 20 72 63 76 66 72 6f 6d 2e 69  time), rcvfrom.i
20a0: 70 61 64 64 72 22 0a 20 20 20 20 22 20 20 46 52  paddr".    "  FR
20b0: 4f 4d 20 72 63 76 66 72 6f 6d 20 4c 45 46 54 20  OM rcvfrom LEFT 
20c0: 4a 4f 49 4e 20 75 73 65 72 20 55 53 49 4e 47 28  JOIN user USING(
20d0: 75 69 64 29 22 0a 20 20 20 20 22 20 57 48 45 52  uid)".    " WHER
20e0: 45 20 72 63 76 69 64 3d 25 64 22 2c 0a 20 20 20  E rcvid=%d",.   
20f0: 20 72 63 76 69 64 0a 20 20 29 3b 0a 20 20 40 20   rcvid.  );.  @ 
2100: 3c 74 61 62 6c 65 20 63 65 6c 6c 73 70 61 63 69  <table cellspaci
2110: 6e 67 3d 31 35 20 63 65 6c 6c 70 61 64 64 69 6e  ng=15 cellpaddin
2120: 67 3d 30 20 62 6f 72 64 65 72 3d 30 3e 0a 20 20  g=0 border=0>.  
2130: 40 20 3c 74 72 3e 3c 74 64 20 76 61 6c 69 67 6e  @ <tr><td valign
2140: 3d 22 74 6f 70 22 20 61 6c 69 67 6e 3d 22 72 69  ="top" align="ri
2150: 67 68 74 22 3e 72 63 76 69 64 3a 3c 2f 74 64 3e  ght">rcvid:</td>
2160: 0a 20 20 40 20 3c 74 64 20 76 61 6c 69 67 6e 3d  .  @ <td valign=
2170: 22 74 6f 70 22 3e 25 64 28 72 63 76 69 64 29 3c  "top">%d(rcvid)<
2180: 2f 74 64 3e 3c 2f 74 72 3e 0a 20 20 69 66 28 20  /td></tr>.  if( 
2190: 64 62 5f 73 74 65 70 28 26 71 29 3d 3d 53 51 4c  db_step(&q)==SQL
21a0: 49 54 45 5f 52 4f 57 20 29 7b 0a 20 20 20 20 63  ITE_ROW ){.    c
21b0: 6f 6e 73 74 20 63 68 61 72 20 2a 7a 55 73 65 72  onst char *zUser
21c0: 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74 65 78   = db_column_tex
21d0: 74 28 26 71 2c 20 30 29 3b 0a 20 20 20 20 63 6f  t(&q, 0);.    co
21e0: 6e 73 74 20 63 68 61 72 20 2a 7a 44 61 74 65 20  nst char *zDate 
21f0: 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74 65 78 74  = db_column_text
2200: 28 26 71 2c 20 31 29 3b 0a 20 20 20 20 63 6f 6e  (&q, 1);.    con
2210: 73 74 20 63 68 61 72 20 2a 7a 49 70 41 64 64 72  st char *zIpAddr
2220: 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74 65 78   = db_column_tex
2230: 74 28 26 71 2c 20 32 29 3b 0a 20 20 20 20 40 20  t(&q, 2);.    @ 
2240: 3c 74 72 3e 3c 74 64 20 76 61 6c 69 67 6e 3d 22  <tr><td valign="
2250: 74 6f 70 22 20 61 6c 69 67 6e 3d 22 72 69 67 68  top" align="righ
2260: 74 22 3e 55 73 65 72 3a 3c 2f 74 64 3e 0a 20 20  t">User:</td>.  
2270: 20 20 40 20 3c 74 64 20 76 61 6c 69 67 6e 3d 22    @ <td valign="
2280: 74 6f 70 22 3e 25 73 28 7a 55 73 65 72 29 3c 2f  top">%s(zUser)</
2290: 74 64 3e 3c 2f 74 72 3e 0a 20 20 20 20 40 20 3c  td></tr>.    @ <
22a0: 74 72 3e 3c 74 64 20 76 61 6c 69 67 6e 3d 22 74  tr><td valign="t
22b0: 6f 70 22 20 61 6c 69 67 6e 3d 22 72 69 67 68 74  op" align="right
22c0: 22 3e 44 61 74 65 3a 3c 2f 74 64 3e 0a 20 20 20  ">Date:</td>.   
22d0: 20 40 20 3c 74 64 20 76 61 6c 69 67 6e 3d 22 74   @ <td valign="t
22e0: 6f 70 22 3e 25 73 28 7a 44 61 74 65 29 3c 2f 74  op">%s(zDate)</t
22f0: 64 3e 3c 2f 74 72 3e 0a 20 20 20 20 40 20 3c 74  d></tr>.    @ <t
2300: 72 3e 3c 74 64 20 76 61 6c 69 67 6e 3d 22 74 6f  r><td valign="to
2310: 70 22 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22  p" align="right"
2320: 3e 49 50 26 6e 62 73 70 41 64 64 72 65 73 73 3a  >IP&nbspAddress:
2330: 3c 2f 74 64 3e 0a 20 20 20 20 40 20 3c 74 64 20  </td>.    @ <td 
2340: 76 61 6c 69 67 6e 3d 22 74 6f 70 22 3e 25 73 28  valign="top">%s(
2350: 7a 49 70 41 64 64 72 29 3c 2f 74 64 3e 3c 2f 74  zIpAddr)</td></t
2360: 72 3e 0a 20 20 7d 0a 20 20 64 62 5f 66 69 6e 61  r>.  }.  db_fina
2370: 6c 69 7a 65 28 26 71 29 3b 0a 20 20 64 62 5f 70  lize(&q);.  db_p
2380: 72 65 70 61 72 65 28 26 71 2c 0a 20 20 20 20 22  repare(&q,.    "
2390: 53 45 4c 45 43 54 20 72 69 64 2c 20 75 75 69 64  SELECT rid, uuid
23a0: 2c 20 73 69 7a 65 20 46 52 4f 4d 20 62 6c 6f 62  , size FROM blob
23b0: 20 57 48 45 52 45 20 72 63 76 69 64 3d 25 64 22   WHERE rcvid=%d"
23c0: 2c 20 72 63 76 69 64 0a 20 20 29 3b 0a 20 20 40  , rcvid.  );.  @
23d0: 20 3c 74 72 3e 3c 74 64 20 76 61 6c 69 67 6e 3d   <tr><td valign=
23e0: 22 74 6f 70 22 20 61 6c 69 67 6e 3d 22 72 69 67  "top" align="rig
23f0: 68 74 22 3e 41 72 74 69 66 61 63 74 73 3a 3c 2f  ht">Artifacts:</
2400: 74 64 3e 0a 20 20 40 20 3c 74 64 20 76 61 6c 69  td>.  @ <td vali
2410: 67 6e 3d 22 74 6f 70 22 3e 0a 20 20 77 68 69 6c  gn="top">.  whil
2420: 65 28 20 64 62 5f 73 74 65 70 28 26 71 29 3d 3d  e( db_step(&q)==
2430: 53 51 4c 49 54 45 5f 52 4f 57 20 29 7b 0a 20 20  SQLITE_ROW ){.  
2440: 20 20 69 6e 74 20 72 69 64 20 3d 20 64 62 5f 63    int rid = db_c
2450: 6f 6c 75 6d 6e 5f 69 6e 74 28 26 71 2c 20 30 29  olumn_int(&q, 0)
2460: 3b 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72  ;.    const char
2470: 20 2a 7a 55 75 69 64 20 3d 20 64 62 5f 63 6f 6c   *zUuid = db_col
2480: 75 6d 6e 5f 74 65 78 74 28 26 71 2c 20 31 29 3b  umn_text(&q, 1);
2490: 0a 20 20 20 20 69 6e 74 20 73 69 7a 65 20 3d 20  .    int size = 
24a0: 64 62 5f 63 6f 6c 75 6d 6e 5f 69 6e 74 28 26 71  db_column_int(&q
24b0: 2c 20 32 29 3b 0a 20 20 20 20 40 20 3c 61 20 68  , 2);.    @ <a h
24c0: 72 65 66 3d 22 25 73 28 67 2e 7a 42 61 73 65 55  ref="%s(g.zBaseU
24d0: 52 4c 29 2f 69 6e 66 6f 2f 25 73 28 7a 55 75 69  RL)/info/%s(zUui
24e0: 64 29 22 3e 25 73 28 7a 55 75 69 64 29 3c 2f 61  d)">%s(zUuid)</a
24f0: 3e 0a 20 20 20 20 40 20 28 72 69 64 3a 20 25 64  >.    @ (rid: %d
2500: 28 72 69 64 29 2c 20 73 69 7a 65 3a 20 25 64 28  (rid), size: %d(
2510: 73 69 7a 65 29 29 3c 62 72 3e 0a 20 20 7d 0a 20  size))<br>.  }. 
2520: 20 40 20 3c 2f 74 64 3e 3c 2f 74 72 3e 0a 20 20   @ </td></tr>.  
2530: 40 20 3c 2f 74 61 62 6c 65 3e 0a 7d 0a           @ </table>.}.