Fossil

Check-in [908009fd]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a couple of C++-isms in my_page.c and tagview.c. Remove the return value from autosync().
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 908009fdc446c4c3a109f70652b431fdd149db19
User & Date: drh 2008-05-07 17:38:57.000
Context
2008-05-07
23:56
Fix a typo on the "stat" page. ... (check-in: cf84ce2d user: drh tags: trunk)
17:38
Fix a couple of C++-isms in my_page.c and tagview.c. Remove the return value from autosync(). ... (check-in: 908009fd user: drh tags: trunk)
12:15
Add the --proxy option to the commit and update commands. ... (check-in: b714ab1e user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/my_page.c.
78
79
80
81
82
83
84



85
86
87
88
89
90
91
92
93
94
95
96
97
*/
static void mypage_page_default()
{
  int uid = g.userUid;
  char * sql = mprintf( "SELECT login,cap,info FROM user WHERE uid=%d",
			uid );
  Stmt st;



  db_prepare( &st, sql );
  free( sql );
  db_step(&st);
  char const * uname = db_column_text( &st, 0 );
  char const * ucap = db_column_text( &st, 1 );
  char const * uinfo = db_column_text( &st, 2 );

  @ <h2>Welcome, %s(uname)!</h2>
  @ Your user ID is: %d(uid)<br/>
  @ Your Fossil permissions are: [%s(ucap)]
  @   [TODO: explain these]<br/>
  if( g.okAdmin ){
    @ You are an <a href='%s(g.zBaseURL)/admin'>admin</a>.<br/>







>
>
>



|
|
|







78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
*/
static void mypage_page_default()
{
  int uid = g.userUid;
  char * sql = mprintf( "SELECT login,cap,info FROM user WHERE uid=%d",
			uid );
  Stmt st;
  char const *uname;
  char const *ucap;
  char const *uinfo;
  db_prepare( &st, sql );
  free( sql );
  db_step(&st);
  uname = db_column_text( &st, 0 );
  ucap = db_column_text( &st, 1 );
  uinfo = db_column_text( &st, 2 );

  @ <h2>Welcome, %s(uname)!</h2>
  @ Your user ID is: %d(uid)<br/>
  @ Your Fossil permissions are: [%s(ucap)]
  @   [TODO: explain these]<br/>
  if( g.okAdmin ){
    @ You are an <a href='%s(g.zBaseURL)/admin'>admin</a>.<br/>
123
124
125
126
127
128
129

130
131
132
133
134
135
136
137
138
139
140
141
142

}

/*
** WEBPAGE: /my
*/
void mypage_page(void){

  login_check_credentials();
  if( !g.okRdWiki ){
    login_needed();
  }
  style_header("Your Home");
  char const * name = P("name");
  if( name )
  {
    if( 0 == strcmp(name,"tickets") )
    {
      @ TODO: Tickets page.
    }
    else







>





|







126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

}

/*
** WEBPAGE: /my
*/
void mypage_page(void){
  const char *name;
  login_check_credentials();
  if( !g.okRdWiki ){
    login_needed();
  }
  style_header("Your Home");
  name = P("name");
  if( name )
  {
    if( 0 == strcmp(name,"tickets") )
    {
      @ TODO: Tickets page.
    }
    else
Changes to src/sync.c.
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#define AUTOSYNC_PULL  2

#endif /* INTERFACE */

/*
** If the respository is configured for autosyncing, then do an
** autosync.  This will be a pull if the argument is true or a push
** if the argument is false.  Return true if the autosync is done
** and false if autosync is not requested for the current repository.
*/
int autosync(int flags){
  const char *zUrl;
  if( db_get_boolean("autosync", 0)==0 ){
    return 0;
  }
  zUrl = db_get("last-sync-url", 0);
  if( zUrl==0 ){
    return 0;  /* No default server */
  }
  url_parse(zUrl);
  if( g.urlIsFile ){
    return 0;  /* Network sync only */
  }
  if( g.urlPort!=80 ){
    printf("Autosync:  http://%s:%d%s\n", g.urlName, g.urlPort, g.urlPath);
  }else{
    printf("Autosync:  http://%s%s\n", g.urlName, g.urlPath);
  }
  url_enable_proxy("via proxy: ");
  client_sync((flags & AUTOSYNC_PUSH)!=0, 1, 0);
  return 1;
}

/*
** This routine processes the command-line argument for push, pull,
** and sync.  If a command-line argument is given, that is the URL
** of a server to sync against.  If no argument is given, use the
** most recently synced URL.  Remember the current URL for next time.







|
<

|


|



|












<







35
36
37
38
39
40
41
42

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

64
65
66
67
68
69
70
#define AUTOSYNC_PULL  2

#endif /* INTERFACE */

/*
** If the respository is configured for autosyncing, then do an
** autosync.  This will be a pull if the argument is true or a push
** if the argument is false.

*/
void autosync(int flags){
  const char *zUrl;
  if( db_get_boolean("autosync", 0)==0 ){
    return;
  }
  zUrl = db_get("last-sync-url", 0);
  if( zUrl==0 ){
    return;  /* No default server */
  }
  url_parse(zUrl);
  if( g.urlIsFile ){
    return 0;  /* Network sync only */
  }
  if( g.urlPort!=80 ){
    printf("Autosync:  http://%s:%d%s\n", g.urlName, g.urlPort, g.urlPath);
  }else{
    printf("Autosync:  http://%s%s\n", g.urlName, g.urlPath);
  }
  url_enable_proxy("via proxy: ");
  client_sync((flags & AUTOSYNC_PUSH)!=0, 1, 0);

}

/*
** This routine processes the command-line argument for push, pull,
** and sync.  If a command-line argument is given, that is the URL
** of a server to sync against.  If no argument is given, use the
** most recently synced URL.  Remember the current URL for next time.
Changes to src/tagview.c.
137
138
139
140
141
142
143

144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
}


/*
** WEBPAGE: /tagview
*/
void tagview_page(void){

  login_check_credentials();
  if( !g.okRdWiki ){
    login_needed();
  }
  style_header("Tags");
  login_anonymous_available();
  tagview_page_search_miniform();
  @ <hr/>
  char const * check = 0;
  if( 0 != (check = P("tagid")) ){
    tagview_page_tag_by_id( atoi(check) );
  }else if( 0 != (check = P("like")) ){
    tagview_page_list_tags( check );
  }else if( 0 != (check = P("name")) ){
    tagview_page_tag_by_name( check );
  }else{







>








<







137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152

153
154
155
156
157
158
159
}


/*
** WEBPAGE: /tagview
*/
void tagview_page(void){
  char const * check = 0;
  login_check_credentials();
  if( !g.okRdWiki ){
    login_needed();
  }
  style_header("Tags");
  login_anonymous_available();
  tagview_page_search_miniform();
  @ <hr/>

  if( 0 != (check = P("tagid")) ){
    tagview_page_tag_by_id( atoi(check) );
  }else if( 0 != (check = P("like")) ){
    tagview_page_list_tags( check );
  }else if( 0 != (check = P("name")) ){
    tagview_page_tag_by_name( check );
  }else{