Check-in [c74a7b455a]
Not logged in

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

Overview
Comment:index.cgi: Add sanitization function to functions. index.cgi: Add comments.
Timelines: family | ancestors | descendants | both | develop
Files: files | file ages | folders
SHA1:c74a7b455aa1f3379ad06431c848e676091a5668
User & Date: tux 2014-09-15 10:38:26
Context
2014-09-15
10:38
Merge fixes from develop. Leaf check-in: e1204b6194 user: tux tags: trunk, v0.4
10:38
index.cgi: Add sanitization function to functions. index.cgi: Add comments. Leaf check-in: c74a7b455a user: tux tags: develop
10:27
Remove additional exit codes potentially resulting in internal errors. check-in: ed9e534869 user: tux tags: develop
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to index.cgi.

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34



35
36
37
38
39
40
41
script_url="http://${HTTP_HOST%:*}:8082"
script_lastid=$(sqlite3 .repo.fossil "SELECT MAX(rid) FROM blob;")
script_rev=$(sqlite3 .repo.fossil "SELECT uuid FROM blob WHERE rid == $script_lastid;")

STYLE="default"
DEBUG=yes

sanitize() {
	sed -e 's|\&|\&amp;|g; s|<|\&lt;|g; s|>|\&gt;|g; s|"|\&quot;|g'
}

# ====
# Functions
# ====

[ ! -f "$db" ] && cat schema | sqlite3 $db




html_tmpl() {
	tmpl="$1"
	if [[ -f "${styles}/${STYLE}/${tmpl}.cgi" ]]; then
		. ${styles}/${STYLE}/${tmpl}.cgi
	fi
}







|
|
<





|
>
>
>







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
script_url="http://${HTTP_HOST%:*}:8082"
script_lastid=$(sqlite3 .repo.fossil "SELECT MAX(rid) FROM blob;")
script_rev=$(sqlite3 .repo.fossil "SELECT uuid FROM blob WHERE rid == $script_lastid;")

STYLE="default"
DEBUG=yes

# Ensure database exists.
[ ! -f "$db" ] && cat schema | sqlite3 $db


# ====
# Functions
# ====

# Ensure that problematic inserts doesn't exist.
sanitize() {
	sed -e 's|\&|\&amp;|g; s|<|\&lt;|g; s|>|\&gt;|g; s|\"|\&quot;|g'
}

html_tmpl() {
	tmpl="$1"
	if [[ -f "${styles}/${STYLE}/${tmpl}.cgi" ]]; then
		. ${styles}/${STYLE}/${tmpl}.cgi
	fi
}