// this file will load all the configuration elements from the database
// and place them into a global associative array called $config
$config = array();
$thumbnail_config = array();
require_once("plog-globals.php");
require_once("plog-functions.php");
require_once("plog-config.php");
connect_db();
$query = "SELECT * FROM `".TABLE_PREFIX."config`";
$result = mysql_query($query) or die(mysql_error() .'
'.$query);
if (mysql_num_rows($result) == 0){
die("No config information in the database.");
}
$config = mysql_fetch_assoc($result);
$config["basedir"] = dirname(__FILE__).DIRECTORY_SEPARATOR;
$url_parts = parse_url($_SERVER["REQUEST_URI"]);
$config["baseurl"] = "http://www.lalovin.com/";
$config["embedded"] = 0;
// try to figure out whether we are embedded (for example running from Wordpress)
// on windows/apache $_SERVER['PATH_TRANSLATED'] uses "/" for directory separators,
// __FILE__ has them the other way, realpath takes care of that.
if (dirname(__FILE__) != dirname(realpath($_SERVER["PATH_TRANSLATED"])) && strpos($_SERVER["PATH_TRANSLATED"],"admin") === false) {
$config["embedded"] = 1;
// disable our own cruft-free urls, because the URL has already been processed
// by WordPress
$config["use_mod_rewrite"] = 1;
} else {
$config["baseurl"] = "http://".$_SERVER["SERVER_NAME"]. substr($_SERVER["PHP_SELF"],0,strrpos($_SERVER["PHP_SELF"],"/")) . "/";
}
// remove admin/ from the end, if present .. is there a better way to determine the full url?
if (substr($config["baseurl"],-6) == "admin/") {
$config["baseurl"] = substr($config["baseurl"],0,-6);
}
$config["theme_url"] = $config["gallery_url"]."themes/".basename($config["theme_dir"])."/";
$config['charset'] = 'utf-8';
$config['version'] = 'Beta 3 (dev)';
// charset set with HTTP headers has higher priority that 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 `".TABLE_PREFIX."thumbnail_config`";
$result = mysql_query($query) or die(mysql_error() .'
'.$query);
if (mysql_num_rows($result) == 0){
die("No thumbnail config information in the database.");
}
$prefix_arr = array(1 => '',2 => 'lrg-',3 => 'rss-',4 => 'tn-');
while($row = mysql_fetch_assoc($result)) {
$thumbnail_config[$row['id']] = array(
'filename_prefix' => $prefix_arr[$row['id']],
'size' => $row['max_size'],
'timestamp' => $row['update_timestamp'],
'disabled' => $row['disabled']);
}
// debugging function
function display_uservariables(){
foreach ($config as $keys => $values) {
echo "$keys = $values
";
}
}
if (!isset($_SESSION["plogger_sortby"])){
$_SESSION["plogger_sortby"] = $config['default_sortby'];
}
if (!isset($_SESSION["plogger_sortdir"])){
$_SESSION["plogger_sortdir"] = $config['default_sortdir'];
}
if (!isset($_SESSION["plogger_details"])){
$_SESSION["plogger_details"] = 0;
}
?>
function generate_album_names() {
global $config;
$output = '';
$image_count = array();
$output .= '
';
// $output .= '
';
return $output;
}
function generate_breadcrumb(){
global $config;
$id = $GLOBALS["plogger_id"];
switch ($GLOBALS['plogger_level']) {
case 'collection':
$row = get_collection_by_id($id);
// $breadcrumbs = ' Collections » ' . SmartStripSlashes($row["name"]) . '';
$breadcrumbs = ' ' . SmartStripSlashes($row["name"]) . '';
if ($GLOBALS['plogger_mode'] == "slideshow") $breadcrumbs .= ' » Slideshow';
break;
case 'slideshow':
case 'album':
$row = get_album_by_id($id);
$album_name = SmartStripSlashes($row["name"]);
$album_link = generate_url("album",$row["id"]);
$row = get_collection_by_id($row["parent_id"]);
$collection_link = '' . $row["name"] . '';
if ($GLOBALS['plogger_mode'] == "slideshow") {
// $breadcrumbs = ' Collections » ' . $collection_link . ' » ' . ''.$album_name.' » ' . ' Slideshow';
// $breadcrumbs = ' ' . $collection_link . ' » ' . ''.$album_name.' » ' . ' Slideshow';
} else {
// $breadcrumbs = ' Collections » ' . $collection_link . ' » ' . ''.$album_name.'';
$breadcrumbs = ' ' . $collection_link . ' » ' . ''.$album_name.'';
}
break;
case 'picture':
$row = get_picture_by_id($id);
$picture_name = SmartStripSlashes(basename($row["path"]));
$row = get_album_by_id($row["parent_album"]);
$album_link = '' . SmartStripSlashes($row["name"]) . '';
$row = get_collection_by_id($row["parent_id"]);
// $collection_link = ' Collections ' . ' » ' . '' . SmartStripSlashes($row["name"]) . '';
$collection_link = ' ' . SmartStripSlashes($row["name"]) . '';
$breadcrumbs = $collection_link . ' » ' . $album_link . ' » ' . ' ';
if ($GLOBALS['plogger_mode'] == "slideshow") $breadcrumbs .= ' » Slideshow';
break;
case 'search':
$breadcrumbs = 'You searched for '.htmlspecialchars($_GET["searchterms"]).'.';
break;
default:
$breadcrumbs = 'Daily Dish:';
break;
}
return '';
}
function generate_title(){
switch ($GLOBALS['plogger_level']) {
case 'collection':
$row = get_collection_by_id($GLOBALS['plogger_id']);
$breadcrumbs = SmartStripSlashes($row["name"]);
if ($GLOBALS['plogger_mode'] == "slideshow") $breadcrumbs .= ' » Slideshow';
break;
case 'slideshow':
case 'album':
$row = get_album_by_id($GLOBALS['plogger_id']);
$album_name = SmartStripSlashes($row["name"]);
$row = get_collection_by_id($row["parent_id"]);
if ($GLOBALS['plogger_mode'] == "slideshow") {
$breadcrumbs = SmartStripSlashes($row["name"]) . ' » ' . $album_name.' » ' . ' Slideshow';
} else {
$breadcrumbs = SmartStripSlashes($row["name"]) . ' » ' . $album_name;
}
break;
case 'picture':
$row = get_picture_by_id($GLOBALS['plogger_id']);
$picture_name = basename($row["path"]);
$caption = $row["caption"];
$row = get_album_by_id($row["parent_album"]);
$album_name = SmartStripSlashes($row["name"]);
$row = get_collection_by_id($row["parent_id"]);
$collection_name = SmartStripSlashes($row["name"]);
$breadcrumbs = $collection_name . ' » ' . $album_name . ' » ' . $caption;
if ($GLOBALS['plogger_mode'] == "slideshow") $breadcrumbs .= ' » Slideshow';
break;
default:
$breadcrumbs = 'Celebrity News, Pics, Paparazzi, Candid, Gossip, Nipple Slip, Topless - Your Daily dose of Hollywood!';
}
return $breadcrumbs;
}
function generate_jump_menu() {
global $config;
$output = '';
$image_count = array();
$output .= '';
return $output;
}
function generate_exif_table($id, $condensed = 0){
global $config;
$query = "SELECT * FROM `".TABLE_PREFIX."pictures` WHERE `id`=".intval($id);
$result = run_query($query);
if (mysql_num_rows($result) > 0){
$row = mysql_fetch_assoc($result);
foreach($row as $key => $val) if (trim($row[$key]) == '') $row[$key] = ' ';
$table_data = '
| File size |
'.$size.' kbytes |
| Taken on |
'.$row["EXIF_date_taken"].' |
| Camera model |
'.$row["EXIF_camera"].' |
| Shutter speed |
'.$row["EXIF_shutterspeed"].' |
| Focal length |
'.$row["EXIF_focallength"].' |
| Aperture |
'.$row["EXIF_aperture"].' |
';
} else {
$table_data .= '>| Dimensions | '.$width .' x ' .$height.' |
| File size | '.$size.' kbytes |
| Taken on | '.$row["EXIF_date_taken"].' |
| Camera model | '.$row["EXIF_camera"].' |
| Shutter speed | '.$row["EXIF_shutterspeed"].' |
| Focal length | '.$row["EXIF_focallength"].' |
| Aperture | '.$row["EXIF_aperture"].' |
';
}
}
return $table_data;
}
function plogger_display_comments() {
global $config;
if (file_exists(THEME_DIR . '/comments.php')) {
include(THEME_DIR . '/comments.php');
} else {
include($config['basedir'] . '/themes/default/comments.php');
}
}
// generate header produces the Gallery Name, The Jump Menu, and the Breadcrumb trail
// at the top of the image
function generate_header() {
global $config;
$output = ''.stripslashes($config["gallery_name"]).'
';
return $output;
}
function generate_sortby($level,$id){
global $config;
$output = '';
$id = $GLOBALS["plogger_id"];
$fields = array(
'date' => 'Date Submitted',
// 'date_taken' => 'Date Taken',
// 'caption' => 'Caption',
// 'filename' => 'Filename',
'number_of_comments' => 'Number of Comments',
);
if ($level == "album"){
// I think this should be a single form and I really should move the javascript functions
// into a separate file
// I need to merge those 2 forms. and since I'm realoading stuff anyway, I can just
// create correct urls. oh yeah, baby.
$output .= '