Fossil

Check-in [d73c5fd2]
Login

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

Overview
Comment:Fix the /forum webpage so that it works even if the forumpost table does not exist in the repository.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d73c5fd27e8af1a91c7b875a6ae9d60552554c2d9cf971e7d969f994a5fcdb62
User & Date: drh 2018-08-10 16:51:44
Context
2018-08-10
16:59
Fix the webmail screen so that it remembers the folder that is being viewed. check-in: e0377d04 user: drh tags: trunk
16:51
Fix the /forum webpage so that it works even if the forumpost table does not exist in the repository. check-in: d73c5fd2 user: drh tags: trunk
16:44
Allow login using either the username or the first email address found in the USER.INFO column. Note that it might be useful to create an index on user(find_emailaddr(info)) to make this efficient in the case where there are many rows in the user table. check-in: 8c91be8b user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/forum.c.

923
924
925
926
927
928
929

930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949


950
951
    style_footer();
    return;
  }
  iLimit = 50;
  iOfst = 0;
  @ <h1>Recent Threads</h1>
  @ <div class='fileage'><table width="100%%">

  db_prepare(&q,
     "SELECT julianday('now') - max(fmtime),"
     "       (SELECT uuid FROM blob WHERE rid=fpid),"
     "       (SELECT substr(comment,instr(comment,':')+2)"
     "          FROM event WHERE objid=fpid)"
     "  FROM forumpost"
     " GROUP BY froot ORDER BY 1 LIMIT %d OFFSET %d",
     iLimit, iOfst
  );
  while( db_step(&q)==SQLITE_ROW ){
    char *zAge = human_readable_age(db_column_double(&q,0));
    const char *zUuid = db_column_text(&q, 1);
    const char *zTitle = db_column_text(&q, 2);
    @ <tr><td>%h(zAge) ago</td>
    @ <td>%z(href("%R/forumpost/%S",zUuid))%h(zTitle)</a>
    @ </tr>
    fossil_free(zAge);
  }
  @ </table></div>
  db_finalize(&q);


  style_footer();
}







>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
>
>


923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948

949
950
951
952
953
    style_footer();
    return;
  }
  iLimit = 50;
  iOfst = 0;
  @ <h1>Recent Threads</h1>
  @ <div class='fileage'><table width="100%%">
  if( db_table_exists("repository","forumpost") ){
    db_prepare(&q,
       "SELECT julianday('now') - max(fmtime),"
       "       (SELECT uuid FROM blob WHERE rid=fpid),"
       "       (SELECT substr(comment,instr(comment,':')+2)"
       "          FROM event WHERE objid=fpid)"
       "  FROM forumpost"
       " GROUP BY froot ORDER BY 1 LIMIT %d OFFSET %d",
       iLimit, iOfst
    );
    while( db_step(&q)==SQLITE_ROW ){
      char *zAge = human_readable_age(db_column_double(&q,0));
      const char *zUuid = db_column_text(&q, 1);
      const char *zTitle = db_column_text(&q, 2);
      @ <tr><td>%h(zAge) ago</td>
      @ <td>%z(href("%R/forumpost/%S",zUuid))%h(zTitle)</a>
      @ </tr>
      fossil_free(zAge);
    }

    db_finalize(&q);
  }
  @ </table></div>
  style_footer();
}