예제 #1
0
if (!$this->get('ad_network')) {
    $this->set('ad_network', 'doubleclick');
}
try {
    // this observer is brought to you by the letter "O"...
    $o = $this->controller->getObserver();
    // if we even have a request and an id...
    $l = new Locator($o);
    if ($o->exists('request') && $o->get('request')->exists('id')) {
        $forum_id = intval($this->controller->getObserver()->get('request')->get('id'));
        unset($o);
    } else {
        $forum_id = 0;
    }
    // see if we need to show something here...
    if (SC::exists('board_config.ad_display_forums') && strlen(SC::get('board_config.ad_display_forums')) > 0) {
        $params = explode(";", SC::get('board_config.ad_display_forums'));
        foreach ($params as $id => $param) {
            if (empty($param)) {
                continue;
            }
            // throw away empty rows...
            $section = substr($param, 0, strpos($param, "("));
            // get the main section name...
            if ($l->location == $section) {
                // if we matched sections, get the sub-section directives, otherwise skip it...
                $sub = array();
                $matches = ereg('\\([^\\(\\)]*\\)', $param, $sub);
                $ad_params = explode(",", str_replace(array('(', ')'), NULL, $sub[0]));
            }
        }