function get_content(&$arguments, $properties)
 {
     global $objbo;
     $indexarray = $objbo->getIndex(False, !@$arguments['sub_cats'], True);
     $subcatname = $catname = '';
     foreach ($indexarray as $temppage) {
         if ($catname != $temppage['catname'] && $temppage['catdepth'] == 1) {
             if ($catname != '') {
                 $content .= "\n</div>\n<br />";
             }
             $content .= "\n" . '<div style="position: relative; left: ' . max($temppage['catdepth'] * 15 - 30, 0) . 'px;">';
             $catname = $temppage['catname'];
             $content .= "\n\t<b>{$temppage['catlink']}</b><br />";
             $subcatname = '';
         }
         if ($temppage['catdepth'] == 1) {
             // dont show no pages availible in Production mode, just ignore it
             if ($GLOBALS['sitemgr_info']['mode'] == 'Edit' || $temppage['page_id'] && $temppage['pagelink'] != lang('No pages available')) {
                 $content .= "\n\t&nbsp;&middot;&nbsp;{$temppage['pagelink']}<br />";
             }
         } elseif ($subcatname != $temppage['catname'] && $temppage['catdepth'] == 2) {
             $content .= "\n\t&nbsp;&middot;&nbsp;" . str_replace('</a>', ' ...</a>', $temppage[catlink]) . '<br />';
             $subcatname = $temppage['catname'];
         }
     }
     if (count($indexarray)) {
         $content .= "\n</div>";
         if (!$arguments['no_full_index']) {
             $content .= "\n" . '<br /><i><a href="' . sitemgr_link2('/index.php', 'index=1') . '"><font size="1">(' . lang('View full index') . ')</font></a></i>';
         }
     } else {
         $content = lang('You do not have access to any content on this site.');
     }
     return $content;
 }
 function get_content(&$arguments, $properties)
 {
     global $objbo;
     global $page;
     $category_id = $arguments['category_id'];
     if ($category_id) {
         $cat = $objbo->getcatwrapper($category_id);
         if ($cat) {
             $page->title = lang('Category') . ' ' . $cat->name;
             $page->subtitle = '<i>' . $cat->description . '</i>';
             $content = '<b><a href="' . sitemgr_link2('/index.php', 'toc=1') . '">' . lang('Up to table of contents') . '</a></b>';
             if ($cat->depth > 1) {
                 $content .= ' | <b><a href="' . sitemgr_link2('/index.php', 'category_id=' . $cat->parent) . '">' . lang('Up to parent') . '</a></b>';
             }
             $children = $objbo->getCatLinks((int) $category_id, false);
             if (count($children)) {
                 $content .= '<br/><br/><b>' . lang('Subcategories') . ':</b><br/>';
                 foreach ($children as $cat_id => $child) {
                     $content .= '<br/>&nbsp;&nbsp;&nbsp;&middot;&nbsp;<b>' . $child['link'] . '</b> ' . $objbo->getEditIconsCat($cat_id) . ' &ndash; ' . $child['description'];
                 }
             }
             $content .= '<br/><br/><b>' . lang('Pages') . ':</b><br/>';
             $links = $objbo->getPageLinks($category_id, true);
             if (count($links) > 0) {
                 foreach ($links as $page_id => $pg) {
                     $content .= "\n<br/>" . '&nbsp;&nbsp;&nbsp;&middot;&nbsp;' . $pg['link'] . ' ' . $objbo->getEditIconsPage($page_id, $cat_id);
                     if (!empty($pg['subtitle'])) {
                         $content .= ' &ndash; <i>' . $pg['subtitle'] . '</i>';
                     }
                     $content .= '';
                 }
             } else {
                 $content .= '<li>' . lang('There are no pages in this section') . '</li>';
             }
         } else {
             $content = lang('There was an error accessing the requested page. Either you do not have permission to view this page, or the page does not exist.');
         }
     } else {
         $content = '<b>' . lang('Choose a category') . ':</b><br/>';
         $links = $objbo->getCatLinks();
         if (count($links) > 0) {
             foreach ($links as $cat_id => $cat) {
                 $buffer = str_pad('', $cat['depth'] * 24, '&nbsp;') . '&middot;&nbsp;';
                 if (!$cat['depth']) {
                     $buffer = '<br/>' . $buffer;
                 }
                 $content .= "\n" . $buffer . $cat['link'] . ' ' . $objbo->getEditIconsCat($cat_id) . ' &mdash; <i>' . $cat['description'] . '</i><br/>';
             }
         } else {
             $content .= lang('There are no sections available to you.');
         }
     }
     return $content;
 }
 function get_content(&$arguments, $properties)
 {
     global $page;
     if ($page->cat_id == CURRENT_SITE_ID || !$page->cat_id) {
         return '';
     }
     $catlinks = $GLOBALS['objbo']->getCatLinks((int) $page->cat_id, False, True);
     $pagelinks = $GLOBALS['objbo']->getPageLinks($page->cat_id, False, True);
     $category = $GLOBALS['objbo']->getcatwrapper($page->cat_id);
     $this->block->title = $category->name;
     $parent = $category->parent;
     unset($category);
     $content = '';
     if ($parent && $parent != CURRENT_SITE_ID && !$arguments['suppress_parent']) {
         $parentcat = $GLOBALS['objbo']->getcatwrapper($parent);
         $content .= "\n<b>" . lang('Parent Section:') . '</b><br/>&nbsp;&middot;&nbsp;<a href="' . sitemgr_link2('/index.php', 'category_id=' . $parent) . '" title="' . $parentcat->description . '">' . $parentcat->name . '</a><br/><br/>';
         unset($parentcat);
     }
     if (count($catlinks)) {
         $content .= "\n<b>" . lang('Subsections:') . '</b><br/>';
         foreach ($catlinks as $catlink) {
             $content .= "\n" . '&nbsp;&middot;&nbsp;' . $catlink['link'] . '<br/>';
         }
         $content .= '<br/>';
     }
     if (count($pagelinks) > 1 || count($pagelinks) > 0 && $content) {
         $content .= "\n<b>" . lang('Pages:') . '</b>';
         if (!$arguments['suppress_show_all']) {
             $content .= ' (<a href="' . sitemgr_link2('/index.php', 'category_id=' . $page->cat_id) . '"><i>' . lang('show all') . '</i></a>)';
         }
         $content .= "<br/>\n";
         foreach ($pagelinks as $pagelink_id => $pagelink) {
             if ($page->id && $page->id == $pagelink_id) {
                 if (!$arguments['suppress_current_page']) {
                     $content .= '&nbsp;<b>&gt;' . $pagelink['link'] . '&lt;</b><br/>';
                 }
             } else {
                 $content .= '&nbsp;&middot;&nbsp;' . $pagelink['link'] . '<br/>';
             }
         }
     }
     return $content;
 }
function replace_var($vars)
{
    $var = $vars[1];
    if (substr($var, 0, 9) == '?sitemgr:') {
        $params = explode(',', substr($var, 9));
        switch (count($params)) {
            case 0:
                $val = '';
                break;
            case 1:
                $val = sitemgr_link2('', $params[0]);
                break;
            case 2:
                $val = sitemgr_link2($params[0], $params[1]);
                break;
            default:
                $val = $var;
        }
    } elseif (substr($var, 0, 7) == '?phpgw:') {
        $params = explode(',', substr($var, 7));
        switch (count($params)) {
            case 0:
                $val = '';
                break;
            case 1:
                $val = phpgw_link('', $params[0]);
                break;
            case 2:
                $val = phpgw_link($params[0], $params[1]);
                break;
            default:
                $val = $var;
        }
    } elseif (substr($var, 0, 1) == '?') {
        $val = sitemgr_link2('/index.php', substr($var, 1));
    } elseif ($var == 'news') {
        $ui = new ui();
        $val = $ui->get_news();
        unset($ui);
    } elseif (substr($var, 0, 6) == 'block-') {
        if (file_exists('blocks/' . $var . '.php')) {
            $title = ereg_replace('_', ' ', substr($var, 6));
            include 'blocks/' . $var . '.php';
        } else {
            $title = lang('Block not found.');
            $content = lang('Contact the administrator.');
        }
        add_theme_var('block_title', $title);
        add_theme_var('block_content', $content);
        if (function_exists('themecenterbox')) {
            $val = themecenterbox($title, $content);
        } else {
            $val = parse_theme_vars(implode("", file('templates/' . $GLOBALS['sitemgr_info']['themesel'] . '/centerblock.tpl')));
        }
    } else {
        /* Check for reserved vars first, otherwise
        			   get from the global theme_vars
        			*/
        switch (strtolower($var)) {
            case 'opentable':
                $val = OpenTable();
                break;
            case 'opentable2':
                $val = OpenTable2();
                break;
            case 'closetable':
                $val = CloseTable();
                break;
            case 'closetable2':
                $val = CloseTable2();
                break;
            default:
                $val = $GLOBALS['theme_vars'][$var];
        }
    }
    return $val;
}