This file is indexed.

/usr/lib/Wt/examples/blog/BlogSession.C is in witty-examples 3.1.10-1ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
/*
 * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
 *
 * See the LICENSE file for terms of use.
 */

#include "BlogSession.h"
#include "asciidoc/asciidoc.h"

#include "model/Comment.h"
#include "model/Post.h"
#include "model/Tag.h"
#include "model/User.h"

namespace dbo = Wt::Dbo;

BlogSession::BlogSession(const std::string& sqliteDb)
  : connection_(sqliteDb)
{
  // connection_.setProperty("show-queries", "true");

  setConnection(connection_);

  mapClass<Post>("post");
  mapClass<Comment>("comment");
  mapClass<User>("user");
  mapClass<Tag>("tag");

  try {
    dbo::Transaction t(*this);
    createTables();

    dbo::ptr<User> admin = add(new User());
    User *a = admin.modify();
    a->name = "admin";
    a->role = User::Admin;
    a->setPassword("admin");

    dbo::ptr<Post> post = add(new Post());
    Post *p = post.modify();

    p->state = Post::Published;
    p->author = admin;
    p->title = "Welcome!";
    p->briefSrc = "Welcome to your own blog.";
    p->bodySrc = "We have created for you an admin user with password admin";
    p->briefHtml = asciidoc(p->briefSrc);
    p->bodyHtml = asciidoc(p->bodySrc);
    p->date = Wt::WDateTime::currentDateTime();

    dbo::ptr<Comment> rootComment = add(new Comment());
    rootComment.modify()->post = post;

    t.commit();

    std::cerr << "Created database, and admin/admin user";
  } catch (std::exception& e) {
    std::cerr << e.what() << std::endl;
    std::cerr << "Using existing database";
  }
}

void BlogSession::setUser(dbo::ptr<User> user)
{
  user_ = user;
}