View/Edit #555:tell_www_page

Switch to edit mode.

Name(s): tell_www_page
1:  if (!player:isa($webber) || !(caller in {$www, this, this.owner}))
2:    raise(E_PERM)
3:  elseif (!$ticketmaster:authorized())
4:    $www.error:forbidden()
5:  elseif (index(prepstr, "/setup") == 1)
6:    return pass(@args)
7:  elseif (question = $www:parse_GET("q"))
8:    question = tostr(" ", question, " ")
9:    for accent in ({"À", "Á", "Â", "Ä", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ò", "Ó", "Ô", "Ö", "Ù", "Ú", "Û", "Ü", "Ç"})
10:     question = strsub(question, accent, accent[2])
11:   endfor
12:   puncts = "#-3,./|\\"
13:   for punct in [1..length(puncts)]
14:     question = strsub(question, puncts[punct], " ")
15:   endfor
16:   oldstr = ""
17:   while (question != oldstr)
18:     oldstr = question
19:     question = strsub(question, "  ", " ")
20:   endwhile
21:   pages = {}
22:   for page in (this.db)
23:     pageok = 0
24:     for line in (page[1])
25:       if (line && line[1] == "!")
26:         line = line[2..$]
27:         not = 1
28:       else
29:         if (pageok)
30:           continue line
31:         endif
32:         not = 0
33:       endif
34:       questioncopy = question
35:       lineok = 1
36:       for word in (line)
37:         if (x = index(questioncopy, word))
38:           questioncopy = questioncopy[x + length(word)..$]
39:         else
40:           lineok = 0
41:           break word
42:         endif
43:       endfor
44:       if (lineok)
45:         if (not)
46:           pageok = 0
47:           continue page
48:         endif
49:         pageok = 1
50:       endif
51:     endfor
52:     if (pageok)
53:       pages = {@pages, {page[2], page[3]}}
54:     endif
55:     $command_utils:suspend_if_needed()
56:   endfor
57:   if (!pages)
58:     pages = {{"huh.html", "Huh?!?  ********************"}}
59:   endif
60:   this:fileappend("log.txt", tostr(question, "  (", $string_utils:connection_hostname(connection_name(player)), " ", ctime(), ")"))
61:   for page in (pages)
62:     this:fileappend("log.txt", "    => " + page[$])
63:   endfor
64: else
65:   pages = {{"index.html"}}
66: endif
67: if (length(pages) == 1)
68:   player:tell($www.error:moved_temporarily($www:fileURL(this, pages[1][1] + prepstr + dobjstr)))
69: else
70:   this:tell_multiple_page(pages)
71: endif
72: "Last modified by Slacker (#55) on Mon Jun 21 05:47:13 1999 MDT."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Dax (#789)

You are not logged in.

[home | help | who | search | setup | code]