Esempio n. 1
0
                $retval = '<a href="' . $_CONF['site_admin_url'] . '/menu.php?mode=deletemenu&amp;id=' . $A['menu_id'] . '" onclick="return confirm(\'' . $LANG_MB01['confirm_delete'] . '\');"><img src="' . $_CONF['layout_url'] . '/images/delete.png" alt="' . $LANG_MB01['delete'] . '"' . '/></a>';
            }
            break;
        case 'options':
            $retval = '<a href="' . $_CONF['site_admin_url'] . '/menu.php?mode=editmenu&amp;menuid=' . $A['menu_id'] . '">' . '<img src="' . $_CONF['layout_url'] . '/images/gear.png" height="16" width="16" alt="' . $LANG_MB01['options'] . '"/></a>';
            break;
        default:
            $retval = $fieldvalue;
            break;
    }
    return $retval;
}
/*
 * Main processing loop
 */
$msg = COM_getMessage();
if (isset($_GET['mode'])) {
    $mode = COM_applyFilter($_GET['mode']);
} else {
    if (isset($_POST['mode'])) {
        $mode = COM_applyFilter($_POST['mode']);
    } else {
        $mode = '';
    }
}
if (isset($_REQUEST['menumid'])) {
    $menu_id = COM_applyFilter($_REQUEST['menumid'], true);
} else {
    $menu_id = 0;
}
if (isset($_REQUEST['menu'])) {
Esempio n. 2
0
/**
* Returns the site footer
*
* This loads the proper templates, does variable substitution and returns the
* HTML for the site footer.
*
* @param   boolean     $rightblock     Whether or not to show blocks on right hand side default is no
* @param   array       $custom         An array defining custom function to be used to format Rightblocks
* @see function COM_siteHeader
* @return   string  Formated HTML containing site footer and optionally right blocks
*
*/
function COM_siteFooter($rightblock = -1, $custom = '')
{
    global $_CONF, $_TABLES, $_USER, $LANG01, $LANG12, $LANG_BUTTONS, $LANG_DIRECTION, $_IMAGE_TYPE, $topic, $_COM_VERBOSE, $_PAGE_TIMER, $theme_what, $theme_pagetitle, $theme_headercode, $theme_layout, $_LOGO, $uiStyles;
    COM_hit();
    if (isset($blockInterface['right'])) {
        $currentURL = COM_getCurrentURL();
        if (strpos($currentURL, $_CONF['site_admin_url']) === 0) {
            if ($blockInterface['right']['location'] == 'right' || $blockInterface['right']['location'] == 'left') {
                $rightblocks = -1;
            }
        }
    }
    $function = $_USER['theme'] . '_siteFooter';
    if (function_exists($function)) {
        return $function($rightblock, $custom);
    }
    $dt = new Date('now', $_USER['tzid']);
    $what = $theme_what;
    $pagetitle = $theme_pagetitle;
    $themecode = $theme_headercode;
    // Grab any content that was cached by the system
    $content = ob_get_contents();
    ob_end_clean();
    $theme = new Template($_CONF['path_layout']);
    $theme->set_file(array('header' => 'header.thtml', 'footer' => 'footer.thtml', 'leftblocks' => 'leftblocks.thtml', 'rightblocks' => 'rightblocks.thtml'));
    $theme->set_var('num_search_results', $_CONF['num_search_results']);
    // get topic if not on home page
    if (!isset($_GET['topic'])) {
        if (isset($_GET['story'])) {
            $sid = COM_applyFilter($_GET['story']);
        } elseif (isset($_GET['sid'])) {
            $sid = COM_applyFilter($_GET['sid']);
        } elseif (isset($_POST['story'])) {
            $sid = COM_applyFilter($_POST['story']);
        }
        if (empty($sid) && $_CONF['url_rewrite'] && strpos($_SERVER['PHP_SELF'], 'article.php') !== false) {
            COM_setArgNames(array('story', 'mode'));
            $sid = COM_applyFilter(COM_getArgument('story'));
        }
        if (!empty($sid)) {
            $topic = DB_getItem($_TABLES['stories'], 'tid', "sid='" . DB_escapeString($sid) . "'");
        }
    } else {
        $topic = COM_applyFilter($_GET['topic']);
    }
    $loggedInUser = !COM_isAnonUser();
    $theme->set_var('site_name', $_CONF['site_name']);
    $theme->set_var('background_image', $_CONF['layout_url'] . '/images/bg.' . $_IMAGE_TYPE);
    $theme->set_var('site_mail', "mailto:{$_CONF['site_mail']}");
    if ($_LOGO['display_site_slogan']) {
        $theme->set_var('site_slogan', $_CONF['site_slogan']);
    }
    $msg = $LANG01[67] . ' ' . $_CONF['site_name'];
    if (!empty($_USER['username']) && !COM_isAnonUser()) {
        $msg .= ', ' . COM_getDisplayName($_USER['uid'], $_USER['username'], $_USER['fullname']);
    }
    $curtime = $dt->format($dt->getUserFormat(), true);
    $theme->set_var('welcome_msg', $msg);
    $theme->set_var('datetime', $curtime);
    if ($_LOGO['use_graphic_logo'] == 1 && file_exists($_CONF['path_html'] . '/images/' . $_LOGO['logo_name'])) {
        $L = new Template($_CONF['path_layout']);
        $L->set_file(array('logo' => 'logo-graphic.thtml'));
        $imgInfo = @getimagesize($_CONF['path_html'] . '/images/' . $_LOGO['logo_name']);
        $dimension = $imgInfo[3];
        $L->set_var('site_name', $_CONF['site_name']);
        $site_logo = $_CONF['site_url'] . '/images/' . $_LOGO['logo_name'];
        $L->set_var('site_logo', $site_logo);
        $L->set_var('dimension', $dimension);
        if ($imgInfo[1] != 100) {
            $delta = 100 - $imgInfo[1];
            $newMargin = $delta;
            $L->set_var('delta', 'style="padding-top:' . $newMargin . 'px;"');
        } else {
            $L->set_var('delta', '');
        }
        if ($_LOGO['display_site_slogan']) {
            $L->set_var('site_slogan', $_CONF['site_slogan']);
        }
        $L->parse('output', 'logo');
        $theme->set_var('logo_block', $L->finish($L->get_var('output')));
    } else {
        if ($_LOGO['use_graphic_logo'] == 0) {
            $L = new Template($_CONF['path_layout']);
            $L->set_file(array('logo' => 'logo-text.thtml'));
            $L->set_var('site_name', $_CONF['site_name']);
            if ($_LOGO['display_site_slogan']) {
                $L->set_var('site_slogan', $_CONF['site_slogan']);
            }
            $L->parse('output', 'logo');
            $theme->set_var('logo_block', $L->finish($L->get_var('output')));
        } else {
            $theme->set_var('logo_block', '');
        }
    }
    $theme->set_var('site_logo', $_CONF['layout_url'] . '/images/logo.' . $_IMAGE_TYPE);
    $theme->set_var(array('lang_login' => $LANG01[58], 'lang_myaccount' => $LANG01[48], 'lang_logout' => $LANG01[35], 'lang_newuser' => $LANG12[3]));
    $menu_navigation = displayMenu('navigation');
    $menu_footer = displayMenu('footer');
    $menu_header = displayMenu('header');
    $theme->set_var(array('menu_navigation' => $menu_navigation, 'menu_footer' => $menu_footer, 'menu_header' => $menu_header, 'st_hmenu' => $menu_navigation, 'st_footer_menu' => $menu_footer, 'st_header_menu' => $menu_header));
    $lblocks = '';
    /* Check if an array has been passed that includes the name of a plugin
     * function or custom function
     * This can be used to take control over what blocks are then displayed
     */
    if (is_array($what)) {
        $function = $what[0];
        if (function_exists($function)) {
            $lblocks = $function($what[1], 'left');
        } else {
            $lblocks = COM_showBlocks('left', $topic);
        }
    } else {
        if ($what != 'none') {
            // Now show any blocks -- need to get the topic if not on home page
            $lblocks = COM_showBlocks('left', $topic);
        }
    }
    /* Now build footer */
    if (empty($lblocks)) {
        $theme->set_var('left_blocks', '');
        $theme->set_var('glfusion_blocks', '');
    } else {
        $theme->set_var('glfusion_blocks', $lblocks);
    }
    // Do variable assignments
    $theme->set_var('site_mail', "mailto:{$_CONF['site_mail']}");
    $theme->set_var('site_slogan', $_CONF['site_slogan']);
    $rdf = substr_replace($_CONF['rdf_file'], $_CONF['site_url'], 0, strlen($_CONF['path_html']) - 1) . LB;
    $theme->set_var('rdf_file', $rdf);
    $theme->set_var('rss_url', $rdf);
    $year = date('Y');
    $copyrightyear = $year;
    if (!empty($_CONF['copyrightyear'])) {
        if ($year == $_CONF['copyrightyear']) {
            $copyrightyear = $_CONF['copyrightyear'];
        } else {
            $copyrightyear = $_CONF['copyrightyear'] . " - " . $year;
        }
    }
    $theme->set_var('copyright_notice', $LANG01[93] . ' &copy; ' . $copyrightyear . ' ' . $_CONF['site_name'] . '&nbsp;&nbsp;&bull;&nbsp;&nbsp;' . $LANG01[94]);
    $theme->set_var('copyright_msg', $LANG01[93] . ' &copy; ' . $copyrightyear . ' ' . $_CONF['site_name']);
    $theme->set_var('current_year', $year);
    $theme->set_var('lang_copyright', $LANG01[93]);
    $theme->set_var('trademark_msg', $LANG01[94]);
    $theme->set_var('powered_by', $LANG01[95]);
    $theme->set_var('glfusion_url', 'http://www.glfusion.org/');
    $theme->set_var('glfusion_version', GVERSION);
    $theme->set_var('direction', empty($LANG_DIRECTION) ? 'ltr' : $LANG_DIRECTION);
    /* Check if an array has been passed that includes the name of a plugin
     * function or custom function.
     * This can be used to take control over what blocks are then displayed
     */
    if (is_array($custom)) {
        $function = $custom['0'];
        if (function_exists($function)) {
            $rblocks = $function($custom['1'], 'right');
        }
    } elseif ($rightblock == 1 || $_CONF['show_right_blocks'] == 1) {
        $rblocks = '';
        $rblocks = COM_showBlocks('right', $topic);
        if (empty($rblocks)) {
            $theme->set_var('glfusion_rblocks', '');
            $theme->set_var('right_blocks', '');
            if (empty($lblocks)) {
                // using full_content
                $theme->set_var('centercolumn', $uiStyles['full_content']['content_class']);
            } else {
                // using left_content
                $theme->set_var('centercolumn', $uiStyles['left_content']['content_class']);
                $theme->set_var('footercolumn-l', $uiStyles['left_content']['left_class']);
            }
        } else {
            $theme->set_var('glfusion_rblocks', $rblocks);
            if (empty($lblocks)) {
                // using content_right
                $theme->set_var('centercolumn', $uiStyles['content_right']['content_class']);
                $theme->set_var('footercolumn-r', $uiStyles['content_right']['right_class']);
            } else {
                // using left_content_right
                $theme->set_var('centercolumn', $uiStyles['left_content_right']['content_class']);
                $theme->set_var('footercolumn-l', $uiStyles['left_content_right']['left_class']);
                $theme->set_var('footercolumn-r', $uiStyles['left_content_right']['right_class']);
            }
        }
    } else {
        $theme->set_var('glfusion_rblocks', '');
        $theme->set_var('right_blocks', '');
        if (empty($lblocks)) {
            // using full content
            $theme->set_var('centercolumn', $uiStyles['full_content']['content_class']);
        } else {
            // using left_content
            $theme->set_var('centercolumn', $uiStyles['left_content']['content_class']);
            $theme->set_var('footercolumn-l', $uiStyles['left_content']['left_class']);
        }
    }
    if (!empty($lblocks)) {
        $theme->parse('left_blocks', 'leftblocks', true);
        $theme->set_var('glfusion_blocks', '');
    }
    if (!empty($rblocks)) {
        $theme->parse('right_blocks', 'rightblocks', true);
        $theme->set_var('glfusion_rblocks', '');
    }
    $exectime = $_PAGE_TIMER->stopTimer();
    $exectext = $LANG01[91] . ' ' . $exectime . ' ' . $LANG01[92];
    $theme->set_var('execution_time', $exectime);
    $theme->set_var('execution_textandtime', $exectext);
    $theme->set_var('content', $content);
    // grab header data from outputHandler
    $outputHandle = outputHandler::getInstance();
    if (isset($_CONF['fb_appid']) && $_CONF['fb_appid'] != '') {
        $outputHandle->addMeta('property', 'fb:app_id', $_CONF['fb_appid']);
    }
    $jsFooter = '<script type="text/javascript" src="' . $_CONF['layout_url'] . '/js/footer.js"></script>';
    if (isset($_CONF['comment_engine'])) {
        switch ($_CONF['comment_engine']) {
            case 'disqus':
                $jsFooter .= '<script id="dsq-count-scr" src="//' . $_CONF['comment_disqus_shortname'] . '.disqus.com/count.js" async></script>';
                break;
            case 'facebook':
                $theme->set_var('integrated_comments', '<div id="fb-root"></div><script>(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) return;js = d.createElement(s); js.id = id;js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.6";fjs.parentNode.insertBefore(js, fjs);}(document, \'script\', \'facebook-jssdk\'));</script>');
                $outputHandle->addRaw('<meta property="fb:app_id" content="{' . $_CONF['comment_fb_appid'] . '}" />');
                break;
        }
    }
    $theme->set_var('js-footer', $jsFooter);
    $theme->set_var(array('meta-header' => $outputHandle->renderHeader('meta'), 'css-header' => $outputHandle->renderHeader('style'), 'js-header' => $outputHandle->renderHeader('script'), 'raw-header' => $outputHandle->renderHeader('raw')));
    $msgTxt = '';
    $msg = COM_getMessage();
    if ($msg > 0) {
        $plugin = '';
        if (isset($_GET['plugin'])) {
            $plugin = COM_applyFilter($_GET['plugin']);
        }
        $msgTxt = COM_showMessage($msg, $plugin, '', 0, 'info');
    }
    if (SESS_isSet('glfusion.infoblock')) {
        $msgArray = @unserialize(SESS_getVar('glfusion.infoblock'));
        $msgTxt .= COM_showMessageText($msgArray['msg'], '', $persist = false, $msgArray['type']);
        SESS_unSet('glfusion.infoblock');
    }
    $theme->set_var('info_block', $msgTxt);
    // Call to plugins to set template variables in the footer
    PLG_templateSetVars('header', $theme);
    PLG_templateSetVars('footer', $theme);
    if (function_exists('CUSTOM_preContent')) {
        $count = 0;
        $tvars = CUSTOM_preContent('get');
        foreach ($tvars as $name => $value) {
            $theme->set_var($name, $value);
            $count++;
        }
        if ($count > 0) {
            $theme->set_var('precontent', true);
        }
    }
    // Actually parse the template and make variable substitutions
    $theme->parse('index_footer', 'footer');
    $tmp = $theme->finish($theme->parse('index_header', 'header'));
    echo $tmp;
    // send the header.thtml
    $retval = $theme->finish($theme->get_var('index_footer'));
    _js_out();
    _css_out();
    return $retval;
}