Example #1
0
function display($string, $current)
{
    global $inHead;
    global $config;
    $tabs = array();
    $tabs['upload'] = array('url' => 'plog-upload.php', 'caption' => plog_tr('<em>U</em>pload'));
    $tabs['import'] = array('url' => 'plog-import.php?nojs=1', 'caption' => plog_tr('<em>I</em>mport'), 'onclick' => "window.location='plog-import.php'; return false;");
    $tabs['manage'] = array('url' => 'plog-manage.php', 'caption' => plog_tr('<em>M</em>anage'));
    $tabs['feedback'] = array('url' => 'plog-feedback.php', 'caption' => plog_tr('<em>F</em>eedback'));
    $tabs['options'] = array('url' => 'plog-options.php', 'caption' => plog_tr('<em>O</em>ptions'));
    $tabs['themes'] = array('url' => 'plog-themes.php', 'caption' => plog_tr('<em>T</em>hemes'));
    $tabs['plugins'] = array('url' => 'plog-plugins.php', 'caption' => plog_tr('<em>P</em>lugins'));
    $tabs['view'] = array('url' => $config['gallery_url'], 'caption' => plog_tr('<em>V</em>iew'), 'onclick' => "window.open('" . $config['gallery_url'] . "'); return false;");
    $tabs['support'] = array('url' => 'http://www.plogger.org/forum/', 'caption' => plog_tr('<em>S</em>upport'), 'onclick' => "window.open('http://www.plogger.org/forum/'); return false;");
    $tabs['logout'] = array('url' => $_SERVER['PHP_SELF'] . '?action=log_out', 'caption' => plog_tr('<em>L</em>og out'));
    // Get the accesskey from the localization - it should be surrounded by <em> tags
    foreach ($tabs as $key => $data) {
        if (preg_match('|<em>(.*)</em>|', $data['caption'], $matches)) {
            $tabs[$key]['accesskey'] = $matches[1];
        }
    }
    $output = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Plogger ' . plog_tr('Gallery Admin') . '</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" href="' . $config['gallery_url'] . 'plog-admin/css/admin.css" type="text/css" media="all" />
	<link rel="stylesheet" href="' . $config['gallery_url'] . 'plog-admin/css/lightbox.css" type="text/css" media="all" />
	<script type="text/javascript" src="' . $config['gallery_url'] . 'plog-admin/js/prototype.js"></script>
	<script type="text/javascript" src="' . $config['gallery_url'] . 'plog-admin/js/plogger.js"></script>
	<script type="text/javascript" src="' . $config['gallery_url'] . 'plog-admin/js/lightbox.js"></script>
	' . $inHead . '
</head>

<body onload="initLightbox();">

<div id="header">

	<div id="logo">
		<img src="' . $config['gallery_url'] . 'plog-admin/images/plogger.gif" width="393" height="90" alt="Plogger" />
	</div><!-- /logo -->

	<div id="plogger-version">
		<div class="align-right">
			' . $config['version'] . '&nbsp;&nbsp;&nbsp;[' . plogger_show_server_info_link() . ']
		</div><!-- /align-right -->
		' . plogger_generate_server_info() . '
	</div><!-- /plogger-version -->

	<div style="clear: both; height: 15px;">&nbsp;</div>

	<div id="tab-nav">
		<ul>';
    foreach ($tabs as $tab => $data) {
        $output .= '
			<li';
        if ($current == $tab) {
            $output .= ' id="current"';
        }
        $output .= '><a';
        if (!empty($data['onclick'])) {
            $output .= ' onclick="' . $data['onclick'] . '"';
        }
        if (!empty($data['accesskey'])) {
            $output .= ' accesskey="' . $data['accesskey'] . '"';
        }
        $output .= ' href="' . $data['url'] . '">' . $data['caption'] . '</a></li>';
    }
    $output .= '
		</ul>
	</div><!-- /tab-nav -->

</div><!-- /header -->

<div id="content">
' . $string . '
</div><!-- /content -->';
    if (defined('PLOGGER_DEBUG') && PLOGGER_DEBUG == '1') {
        $output .= trace('Queries: ' . $GLOBALS['query_count'], false);
        foreach ($GLOBALS['queries'] as $q) {
            $output .= trace($q, false);
        }
        $output .= trace(plog_timer('end'), false);
    }
    $output .= "\n\n" . '</body>
</html>';
    echo $output;
    close_db();
    close_ftp();
    exit;
}
$thumbnail_config = array();
if (is_file(dirname(__FILE__) . '/plog-config.php')) {
    require_once dirname(__FILE__) . '/plog-config.php';
} else {
    if (is_file(dirname(__FILE__) . '/plog-config-sample.php')) {
        require_once dirname(__FILE__) . '/plog-config-sample.php';
    } else {
        die(plog_tr('Could not find a config file!'));
    }
}
require_once dirname(__FILE__) . '/plog-globals.php';
require_once PLOGGER_DIR . 'plog-includes/plog-functions.php';
if (defined('PLOGGER_DEBUG') && PLOGGER_DEBUG == '1') {
    $GLOBALS['query_count'] = 0;
    $GLOBALS['queries'] = array();
    $plog_start_time = plog_timer();
}
// Check if Plogger is installed first
if (!is_plogger_installed()) {
    if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], 'plog-admin')) {
        $install_url = '_install.php';
        $upgrade_url = '_upgrade.php';
        $img = '<img src="images/plogger.gif" alt="Plogger" />';
    } else {
        $install_url = 'plog-admin/_install.php';
        $upgrade_url = 'plog-admin/_upgrade.php';
        $img = '<img src="plog-admin/images/plogger.gif" alt="Plogger" />';
    }
    die($img . "\n" . '<p style="font-family: tahoma, verdana, arial, sans-serif; font-size: 16px; letter-spacing: .25px; margin: 30px;">' . plog_tr('Please run <a href="' . $install_url . '">_install.php</a> to set up Plogger. If you are upgrading from a previous version, please run <a href="' . $upgrade_url . '">_upgrade.php</a>') . '.</p>');
}
connect_db();
Example #3
0
function the_plogger_gallery()
{
    // Collections mode (show all albums within a collection) it's the default
    $use_file = 'collections.php';
    if ($GLOBALS['plogger_level'] == 'picture') {
        $use_file = 'picture.php';
    } elseif ($GLOBALS['plogger_level'] == 'search') {
        if ($GLOBALS['plogger_mode'] == 'slideshow') {
            $use_file = 'slideshow.php';
        } else {
            $use_file = 'search.php';
        }
    } elseif ($GLOBALS['plogger_level'] == 'album') {
        // Album level display mode (display all pictures within album)
        if ($GLOBALS['plogger_mode'] == 'slideshow') {
            $use_file = 'slideshow.php';
        } else {
            $use_file = 'album.php';
        }
    } else {
        if ($GLOBALS['plogger_level'] == 'collection') {
            $use_file = 'collection.php';
        } else {
            if ($GLOBALS['plogger_level'] == '404') {
                $use_file = '404.php';
            }
        }
    }
    // If the theme does not have the requested file, then use the one from the default template
    if (file_exists(THEME_DIR . '/' . $use_file)) {
        include THEME_DIR . '/' . $use_file;
    } else {
        include PLOGGER_DIR . '/plog-content/themes/default/' . $use_file;
    }
    // Close the connections
    close_db();
    if (function_exists('close_ftp')) {
        close_ftp();
    }
    // Debug dump at bottom
    if (defined('PLOGGER_DEBUG') && PLOGGER_DEBUG == '1') {
        trace('Queries: ' . $GLOBALS['query_count']);
        foreach ($GLOBALS['queries'] as $q) {
            trace($q);
        }
        trace(plog_timer('end'));
    }
}