login. p?>" unless $remote; my @journals = ($remote->{'user'}); push @journals, LJ::get_shared_journals($remote); my $journal = $GET{'journal'} || $remote->{'user'}; unless (grep { $_ eq $journal } @journals) { return BML::redirect("/customize/"); } my $u = $remote; $u = LJ::load_user($journal) unless $journal eq $remote->{'user'}; my $userid = $u->{'userid'}; LJ::load_user_props($u, "stylesys", "s2_style"); $body = ""; $title = "User Layer"; if (@journals > 1) { $body .= "
"; $body .= "Work with journal: "; $body .= LJ::html_select({ 'name' => 'journal', 'selected' => $journal, }, map { $_, $_ } @journals); $body .= "
"; } $body .= "<< customize

"; my $err = sub { $title = "Error"; $body = shift; return; }; my ($style, $layer); my $save_arg; my $save_redir; # when given 'w' argument, load user's current style, and edit the user layer. # this is the mode redirected to from /customize/ (the simple customization UI) if ($u->{'stylesys'} == 2) { $style = LJ::S2::load_style($u->{'s2_style'}); return $err->("Style not found.") unless $style && $style->{'userid'} == $u->{'userid'}; $layer = LJ::S2::load_layer($dbh, $style->{'layer'}->{'user'}); } unless ($layer) { $body .= "No user layer"; return; } return $err->("Layer belongs to another user.") unless $layer->{'userid'} == $u->{'userid'}; return $err->("Layer isn't of type user or theme.") unless $layer->{'type'} eq "user"; my $lyr_layout = LJ::S2::load_layer($dbh, $layer->{'b2lid'}); return $err->("Layout layer for this $layer->{'type'} layer not found.") unless $lyr_layout; my $lyr_core = LJ::S2::load_layer($dbh, $lyr_layout->{'b2lid'}); return $err->("Core layer for layout not found.") unless $lyr_core; $lyr_layout->{'uniq'} = $dbh->selectrow_array("SELECT value FROM s2info WHERE s2lid=? AND infokey=?", undef, $lyr_layout->{'s2lid'}, "redist_uniq"); my ($lid_i18nc, $lid_theme, $lid_i18n); $lid_i18nc = $style->{'layer'}->{'i18nc'}; $lid_theme = $style->{'layer'}->{'theme'}; $lid_i18n = $style->{'layer'}->{'i18n'}; my $layerid = $layer->{'s2lid'}; my @layers; push @layers, ([ 'core' => $lyr_core->{'s2lid'} ], [ 'i18nc' => $lid_i18nc ], [ 'layout' => $lyr_layout->{'s2lid'} ], [ 'i18n' => $lid_i18n ]); if ($layer->{'type'} eq "user" && $lid_theme) { push @layers, [ 'theme' => $lid_theme ]; } push @layers, [ $layer->{'type'} => $layer->{'s2lid'} ]; my @layerids = grep { $_ } map { $_->[1] } @layers; LJ::S2::load_layers(@layerids); my %layerinfo; # load the language and layout choices for core. LJ::S2::load_layer_info(\%layerinfo, \@layerids); $body .= "Raw | "; $body .= "As Theme\n"; $body .= "

"; return; } _code?> body=> page?>