Error: requires post."; } if ($remote && $remote->{'user'} ne $POST{'remoteuser'}) { return "Error: invalid user."; } $ret .= "[ console | reference ]

"; foreach my $cmd (split(/\n/, $commands)) { my @args = LJ::Con::parse_line($cmd); next unless @args; my $first = 1; $ret .= "

"; foreach (@args) { my $arg = BML::eall($_); if ($first) { $ret .= ""; $first = 0; } else { $ret .= ""; } } $ret .= "
$arg$arg
"; my @output; my $rv; # TODO: make the entire console library not take $db args. my $dbh = LJ::get_db_writer(); $rv = LJ::Con::execute($dbh, $remote, \@args, \@output); unless ($rv) { $ret .= "

Failed!"; } if (@output) { $ret .= "

";
             foreach my $line (@output) {
                 my $color = "#000000";
                 if ($line->[0] eq "error") { 
                     $color = "#FF0000";
                 } 
                 if ($line->[0] eq "info") { 
                     $color = "#008800";
                 } 
                 
                 $ret .= "".LJ::eall($line->[1])."\n";
                 
             }
             $ret .= "
"; } } $ret .= "

"; $ret .= "enter commands:
"; $ret .= LJ::html_hidden('remoteuser', $remote->{'user'}) if $remote; $ret .= " "; $ret .= "

\n"; return $ret; } else { $ret .= "[ console | reference ]

"; $ret .= "

"; $ret .= LJ::html_hidden('remoteuser', $remote->{'user'}) if $remote; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= "\n"; $ret .= "
command console."; $ret .= "

welcome to the console. from here administrators can do administrative type things. you will forget the commands, so there is a reference.

"; $ret .= "

enter commands:
"; $ret .= "

\n"; return $ret; } _code?> lib: cgi-bin/console.pl, cgi-bin/ljlib.pl link: htdocs/admin/console/reference.bml post: htdocs/admin/console/index.bml _c?>