View/Edit #84:tell_www_page

Switch to edit mode.

Name(s): tell_www_page
1:  player:isa($webber) && caller == $www || raise(E_PERM)
2:  set_task_perms(player.user)
3:  {?object = #-1} = args
4:  if (!valid(object))
5:    return pass(@args)
6:  endif
7:  $www.error:OK("Cache-Control: no-cache")
8:  url = $www:find_ref(object)
9:  prepstr = $string_utils:substitute(prepstr, $www.subst)
10: edit = 0
11: for x in [1..length(prepstr)]
12:   if (!(prepstr[x] in {".", ":", "!", ",", ";"}))
13:     edit = 1
14:     break x
15:   endif
16: endfor
17: player:tell("<HTML><HEAD><META NAME='robots' CONTENT=\"noindex,nofollow\"><TITLE>", $name, ": ", edit ? "Edit " | "Examine ", object.name, " (", object, ")</TITLE><LINK href='http://static.moo.ca:8082/web.css' rel='stylesheet' type='text/css'><link href='", $www:fileURL(this, "code.css"), "' rel='stylesheet' type='text/css'><link REL='icon' HREF='/favicon.ico' TYPE='image/x-ico'><link REL='SHORTCUT ICON' HREF='/favicon.ico'></HEAD><BODY BGCOLOR=\"#FFFFFF\">")
18: if (edit)
19:   player:tell("<H1>View/Edit <A HREF=\"/", url, "\">", object, "</A>", $html_utils:literal_text(prepstr), "</H1>")
20:   if (prepstr[1] == "." || prepstr[1] == ",")
21:     this:edit_prop(prepstr[2..$], object)
22:   elseif (prepstr[1] == ":" || prepstr[1] == ";")
23:     this:edit_verb(prepstr[2..$], object)
24:   elseif (prepstr[1] == "!")
25:     this:edit_file(prepstr[2..$], object)
26:   endif
27: else
28:   if (player.referer && $www:previous_object() != object && iobjstr)
29:     "We have an unknown form refering an chmod/chown to us."
30:     $msg:mtell("www_error", "Warning!  Previous page doesn't appear to be this one!")
31:     player:tell("For security reasons the chmod or chown will not be made.  Refering page: [", player.referer, "]")
32:   elseif ($www:parse_POST("chmod"))
33:     player.user:controls(object) || raise(E_PERM)
34:     object.r = !!$www:parse_POST("r")
35:     object.w = !!$www:parse_POST("w")
36:     object.f = !!$www:parse_POST("f")
37:     player:tell("<B>Object chmoded.</B>")
38:   elseif ((x = $www:parse_POST("chown")) && x != $su:nn(object.owner))
39:     newowner = $su:match_nn_object(x, object.location, player.user)
40:     valid(newowner) || (newowner = $su:match_player(x, player.user))
41:     if (newowner == object.owner)
42:       "Don't touch it."
43:     elseif (!player.user.wizard)
44:       $msg:mtell("www_error", "Permission denied, only wizards can change the owner.")
45:     elseif (!valid(newowner))
46:       $msg:mtell("www_error", "Couldn't match new owner (" + x + ").")
47:     elseif (!newowner:isa($accountable))
48:       $msg:mtell("www_error", $su:nn(newowner) + " doesn't look like a reasonable owner.  Ownership not changed.")
49:     else
50:       player:tell("<B>Chowning object to ", $su:nn(newowner), ".</B><BR>")
51:       oldowner = object.owner
52:       x = $wiz_utils:set_owner(object, newowner, 1)
53:       if (typeof(x) == $ERR)
54:         $msg:mtell("www_error", tostr("Error during chown (", x, ")."))
55:       elseif (oldowner.wizard == newowner.wizard)
56:         for vnum in [1..length(verbs(object))]
57:           info = verb_info(object, vnum)
58:           if (info[1] == oldowner)
59:             info[1] == newowner
60:             set_verb_info(object, vnum, info)
61:           endif
62:         endfor
63:         "+c props were chowned in $wiz_utils:set_owner"
64:       endif
65:     endif
66:   endif
67:   player:tell("<H1>Examining <A HREF=\"/", url, "\">", object.name, " (", object, ")</A></H1>")
68:   this:tell_general(object)
69:   if (index(prepstr, ","))
70:     this:tell_props(object)
71:     this:tell_iprops(object)
72:   elseif (index(prepstr, "."))
73:     this:tell_props(object)
74:     player:tell("View the <A HREF=\"/", url, ",\">inherited properties</A>.")
75:   endif
76:   if (index(prepstr, ";"))
77:     this:tell_verbs(object)
78:     this:tell_iverbs(object)
79:   elseif (index(prepstr, ":"))
80:     this:tell_verbs(object)
81:     player:tell("View the <A HREF=\"/", url, ";\">inherited verbs</A>.")
82:   endif
83:   index(prepstr, "!") && this:tell_files(object)
84: endif
85: this:tell_www_tail(object)
86: player:tell("</BODY></HTML>")
87: "Last modified by whiz (#3135) on Wed Jul 28 21:22:40 2010 UTC."

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]