';
} else {
$install_url = 'plog-admin/_install.php';
$upgrade_url = 'plog-admin/_upgrade.php';
$img = '
';
}
die($img."\n" . '
'.plog_tr('Please run _install.php to set up Plogger. If you are upgrading from a previous version, please run _upgrade.php').'.
'); } connect_db(); $query = "SELECT * FROM `".PLOGGER_TABLE_PREFIX."config`"; $result = run_query($query); if (mysql_num_rows($result) == 0) { die(plog_tr('No config information in the database.')); } $config = mysql_fetch_assoc($result); $config['gallery_name'] = SmartStripSlashes($config['gallery_name']); $config['basedir'] = PLOGGER_DIR; // Try to figure out whether we are embedded (for example, running from within WordPress) if (!defined('PLOGGER_EMBEDDED') || PLOGGER_EMBEDDED == '') { // $_SERVER['PATH_TRANSLATED'] is not set in all server environments, so backup with $_SERVER['SCRIPT_FILENAME'] // $_SERVER['SCRIPT_FILENAME'] should produce the same result as __FILE__ if inclusion script in same location as Plogger // In some environments (virtual hosts) $_SERVER['SCRIPT_FILENAME'] is not the correct absolute path, but realpath() seems to clear it up $compare_path = (isset($_SERVER['PATH_TRANSLATED'])) ? $_SERVER['PATH_TRANSLATED'] : realpath($_SERVER['SCRIPT_FILENAME']); if (dirname(__FILE__) != dirname($compare_path) && strpos($compare_path, 'plog-admin') === false) { $config['embedded'] = 1; // Disable our own cruft-free urls, because the URL has already been processed by WordPress $config['use_mod_rewrite'] = 0; trace('Plogger is embedded'); trace('dirname: '.dirname(__FILE__)); trace('$_SERVER[\'SCRIPT_FILENAME\']' .': '.$_SERVER['SCRIPT_FILENAME']); trace('realpath($_SERVER[\'SCRIPT_FILENAME\'])' .': '.realpath($_SERVER['SCRIPT_FILENAME'])); } else { $config['embedded'] = 0; } } else { // Set PLOGGER_EMBEDDED to 1 in config file to overrule automatic test if (PLOGGER_EMBEDDED == '1') { $config['embedded'] = 1; $config['use_mod_rewrite'] = 0; trace('Plogger is embedded'); // Set PLOGGER_EMBEDDED to 0 in case Plogger inclusion in different folder location, but does not already use mod_rewrite paths } else { $config['embedded'] = 0; } } // if mod_rewrite is on and we're not embedded, remove the file basename if ($config['use_mod_rewrite'] == 1 && $config['embedded'] == 0) { // Set up the base URL and convert any Windows slashes to PHP slashes $config['baseurl'] = 'http://'.$_SERVER['HTTP_HOST'].str_replace('\\', '/', dirname($_SERVER['PHP_SELF'])); // Verify URL for a trailing slash. If not, add one. if ($config['baseurl']{strlen($config['baseurl'])-1} != '/') { $config['baseurl'] = $config['baseurl'].'/'; } // otherwise just use our cleaned up version of $_SERVER['PHP_SELF'] from plog-globals.php } else { $config['baseurl'] = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; } // Remove plog-admin/ from the end, if present .. is there a better way to determine the full url? // Do we need this anymore? $is_admin = strpos($config['baseurl'], 'plog-admin/'); if ($is_admin !== false) { $config['baseurl'] = substr($config['baseurl'], 0, $is_admin); } $config['theme_url'] = $config['gallery_url'].'plog-content/themes/'.basename($config['theme_dir']).'/'; $config['charset'] = 'utf-8'; // Fill $revision with latest changeset number from SVN $revision = '$LastChangedRevision$'; // This string is automatically changed by SVN version control $revision = substr($revision, strpos($revision, ' ')+1, strrpos($revision, ' ')-strpos($revision, ' ')-1); $config['version'] = 'VERSION: 1.0-RC1-Rev'.$revision; // Charset set with HTTP headers has higher priority than that set in HTML head section // Since some servers set their own charset for PHP files, this should take care of it // and hopefully doesn't break anything if (!headers_sent()) { header('Content-Type: text/html; charset='.$config['charset']); } $query = "SELECT * FROM `".PLOGGER_TABLE_PREFIX."thumbnail_config`"; $result = run_query($query); if (mysql_num_rows($result) == 0) { die(plog_tr('No thumbnail config information in the database.')); } $prefix_arr = array(1 => 'small', 2 => 'large', 3 => 'rss', 4 => 'thumbnav'); while($row = mysql_fetch_assoc($result)) { $thumbnail_config[$row['id']] = array( 'type' => $prefix_arr[$row['id']], 'size' => $row['max_size'], 'timestamp' => $row['update_timestamp'], 'disabled' => $row['disabled'], 'resize_option' => $row['resize_option']); } // Add the new theme preview thumbnail array $thumbnail_config[5] = array( 'type' => 'theme', 'size' => 150, 'timestamp' => 0, 'disabled' => 0, 'resize_option' => 3); // Debugging functions function display_uservariables() { foreach ($config as $keys => $values) { echo "$keys = $values