[dw-free] Strip ad-related code from the codebase
[commit: http://hg.dwscoalition.org/dw-free/rev/8c9107777876]
http://bugs.dwscoalition.org/show_bug.cgi?id=137
Kill more ad code! Yaaaaaay!
Patch by
denise.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=137
Kill more ad code! Yaaaaaay!
Patch by
![[staff profile]](https://www.dreamwidth.org/img/silk/identity/user_staff.png)
Files modified:
- cgi-bin/weblib.pl
-------------------------------------------------------------------------------- diff -r 04ccfef357b5 -r 8c9107777876 cgi-bin/weblib.pl --- a/cgi-bin/weblib.pl Sun Jul 12 21:05:12 2009 +0000 +++ b/cgi-bin/weblib.pl Sun Jul 12 21:34:10 2009 +0000 @@ -2405,105 +2405,6 @@ sub tag_cloud { return $ret; } - -sub get_next_ad_id { - return ++$LJ::REQ_GLOBAL{'curr_ad_id'}; -} - -## -## Function LJ::check_page_ad_block. Return answer (true/false) to question: -## Should we show ad of this type on this page. -## Args: uri of the page and orient of the ad block (e.g. 'App-Confirm') -## -sub check_page_ad_block { - my $uri = shift; - my $orient = shift; - - # The AD_MAPPING hash may contain code refs - # This allows us to choose an ad based on some logic - # Example: If LJ::did_post() show 'App-Confirm' type ad - my $ad_mapping = LJ::run_hook('get_ad_uri_mapping', $uri) || - LJ::conf_test($LJ::AD_MAPPING{$uri}); - - return 1 if $ad_mapping eq $orient; - return 1 if ref($ad_mapping) eq 'HASH' && $ad_mapping->{$orient}; - return; -} - -# returns a hash with keys "layout" and "theme" -# "theme" is empty for S1 users -sub get_style_for_ads { - my $u = shift; - - my %ret; - $ret{layout} = ""; - $ret{theme} = ""; - - # Values for custom layers, default themes, and S1 styles - my $custom_layout = "custom_layout"; - my $custom_theme = "custom_theme"; - my $default_theme = "default_theme"; - my $s1_prefix = "s1_"; - - if ($u->prop('stylesys') == 2) { - my %style = LJ::S2::get_style($u); - my $public = LJ::S2::get_public_layers(); - - # get layout - my $layout = $public->{$style{layout}}->{uniq}; # e.g. generator/layout - $layout =~ s/\/\w+$//; - - # get theme - # if the theme id == 0, then we have no theme for this layout (i.e. default theme) - my $theme; - if ($style{theme} == 0) { - $theme = $default_theme; - } else { - $theme = $public->{$style{theme}}->{uniq}; # e.g. generator/mintchoc - $theme =~ s/^\w+\///; - } - - $ret{layout} = $layout ? $layout : $custom_layout; - $ret{theme} = $theme ? $theme : $custom_theme; - } else { - confess 'S1 deprecated.'; - } - - return %ret; -} - -sub get_search_term { - my $uri = shift; - my $search_arg = shift; - - my %search_pages = ( - '/interests.bml' => 1, - '/directory.bml' => 1, - '/multisearch.bml' => 1, - ); - - return "" unless $search_pages{$uri}; - - my $term = ""; - my $args = DW::Request->get->query_string; - if ($uri eq '/interests.bml') { - if ($args =~ /int=([^&]+)/) { - $term = $1; - } - } elsif ($uri eq '/directory.bml') { - if ($args =~ /int_like=([^&]+)/) { - $term = $1; - } - } elsif ($uri eq '/multisearch.bml') { - $term = $search_arg; - } - - # change +'s to spaces - $term =~ s/\+/ /; - - return $term; -} - sub control_strip { --------------------------------------------------------------------------------