error);
session_start();
function validateQueryString ( $queryString , $min=1,
$max=32 ) {
$pattern=" /^([a-zA-Z0-9_]{".$min.",".$max."}=[a-zA-Z0-9]{".$min.",".$max."}&?)+$/";
if ( !preg_match ( $pattern , urldecode($queryString) ) ) {
return false;
}
return true;
}
?>
Photo Login
Login Required
0) && ctype_digit($_REQUEST["debug"]) && isset($username)) {
$debug = $_REQUEST["debug"];
if ($debug & $debug_trace) { printf(" debug: debug: %s; ", $debug); }
}
if (isset($_REQUEST["edit"]) && (strlen($_REQUEST["edit"]) > 0) && ctype_digit($_REQUEST["edit"]) && isset($username)) {
$edit = $_REQUEST["edit"];
if ($debug & $debug_trace) { printf(" debug: edit: %s; ", $edit); }
}
if (isset($_REQUEST["picsperrow"]) && (strlen($_REQUEST["picsperrow"]) > 0) && ctype_digit($_REQUEST["picsperrow"]) && ($_REQUEST["picsperrow"] > 0)) {
$picsperrow = $_REQUEST["picsperrow"];
if ($debug & $debug_trace) { printf(" debug: picsperrow: %s; ", $picsperrow); }
}
if (isset($_REQUEST["auto"]) && (strlen($_REQUEST["auto"]) > 0) && ctype_digit($_REQUEST["auto"])) {
$auto = $_REQUEST["auto"];
if ($debug & $debug_trace) { printf(" debug: auto: %s; ", $auto); }
}
if (isset($_REQUEST["series_id"]) && (strlen($_REQUEST["series_id"]) > 0) && ctype_digit($_REQUEST["series_id"])) {
if (!($series_id == $_REQUEST["series_id"])) {$album_id = 0; $page_id = 0; $pic_id = 0;}
$series_id = $_REQUEST["series_id"];
if ($debug & $debug_trace) { printf(" debug: series_id: %s; ", $series_id); }
} else if ($series_id == 0 && $edit == 0) {
$series_id = 1;
}
if (isset($_REQUEST["series_sort"]) && (strlen($_REQUEST["series_sort"]) > 0) && ctype_digit($_REQUEST["series_sort"]) && ($_REQUEST["series_sort"] > 0)) {
$series_sort = $_REQUEST["series_sort"];
if ($debug & $debug_trace) { printf(" debug: series_sort: %s; ", $series_sort); }
} else {
$series_sort = 0;
}
if (isset($_REQUEST["series_title"]) && (strlen($_REQUEST["series_title"]) > 0)) {
$series_title = get_magic_quotes_gpc() ? $_REQUEST["series_title"] : addslashes($_REQUEST["series_title"]);
if ($debug & $debug_trace) { printf(" debug: series_title: %s; ", $series_title); }
} else {
$series_title = '';
}
if (isset($_REQUEST["series_security"]) && (strlen($_REQUEST["series_security"]) > 0)) {
$series_security = get_magic_quotes_gpc() ? $_REQUEST["series_security"] : addslashes($_REQUEST["series_security"]);
if ($debug & $debug_trace) { printf(" debug: series_security: %s; ", $series_security); }
} else {
$series_security = '';
}
if (isset($_REQUEST["album_id"]) && (strlen($_REQUEST["album_id"]) > 0) && ctype_digit($_REQUEST["album_id"])) {
if (!($album_id == $_REQUEST["album_id"])) {$page_id = 0; $pic_id = 0;}
$album_id = $_REQUEST["album_id"];
if ($debug & $debug_trace) { printf(" debug: album_id: %s; ", $album_id); }
}
if (isset($_REQUEST["album_sort"]) && (strlen($_REQUEST["album_sort"]) > 0) && ctype_digit($_REQUEST["album_sort"]) && ($_REQUEST["album_sort"] > 0)) {
$album_sort = $_REQUEST["album_sort"];
if ($debug & $debug_trace) { printf(" debug: album_sort: %s; ", $album_sort); }
} else {
$album_sort = 0;
}
if (isset($_REQUEST["album_path"]) && (strlen($_REQUEST["album_path"]) > 0)) {
$album_path = get_magic_quotes_gpc() ? $_REQUEST["album_path"] : addslashes($_REQUEST["album_path"]);
if ($debug & $debug_trace) { printf(" debug: album_path: %s; ", $album_path); }
} else {
$album_path = '';
}
if (isset($_REQUEST["album_title"]) && (strlen($_REQUEST["album_title"]) > 0)) {
$album_title = get_magic_quotes_gpc() ? $_REQUEST["album_title"] : addslashes($_REQUEST["album_title"]);
if ($debug & $debug_trace) { printf(" debug: album_title: %s; ", $album_title); }
} else {
$album_title = '';
}
if (isset($_REQUEST["album_desc"]) && (strlen($_REQUEST["album_desc"]) > 0)) {
$album_desc = get_magic_quotes_gpc() ? $_REQUEST["album_desc"] : addslashes($_REQUEST["album_desc"]);
if ($debug & $debug_trace) { printf(" debug: album_desc: %s; ", $album_desc); }
} else {
$album_desc = '';
}
if (isset($_REQUEST["album_text"]) && (strlen($_REQUEST["album_text"]) > 0)) {
$album_text = get_magic_quotes_gpc() ? $_REQUEST["album_text"] : addslashes($_REQUEST["album_text"]);
if ($debug & $debug_trace) { printf(" debug: album_text: %s; ", $album_text); }
} else {
$album_text = '';
}
if (isset($_REQUEST["page_id"]) && (strlen($_REQUEST["page_id"]) > 0) && ctype_digit($_REQUEST["page_id"])) {
if (!($page_id == $_REQUEST["page_id"])) {$pic_id = 0;}
$page_id = $_REQUEST["page_id"];
if ($debug & $debug_trace) { printf(" debug: page_id: %s; ", $page_id); }
}
if (isset($_REQUEST["page_sort"]) && (strlen($_REQUEST["page_sort"]) > 0) && ctype_digit($_REQUEST["page_sort"]) && ($_REQUEST["page_sort"] > 0)) {
$page_sort = $_REQUEST["page_sort"];
if ($debug & $debug_trace) { printf(" page_sort: page_sort: %s; ", $page_sort); }
} else {
$page_sort = 0;
}
if (isset($_REQUEST["page_path"]) && (strlen($_REQUEST["page_path"]) > 0)) {
$page_path = get_magic_quotes_gpc() ? $_REQUEST["page_path"] : addslashes($_REQUEST["page_path"]);
if ($debug & $debug_trace) { printf(" debug: page_path: %s; ", $page_path); }
} else {
$page_path = '';
}
if (isset($_REQUEST["page_title"]) && (strlen($_REQUEST["page_title"]) > 0)) {
$page_title = get_magic_quotes_gpc() ? $_REQUEST["page_title"] : addslashes($_REQUEST["page_title"]);
if ($debug & $debug_trace) { printf(" debug: page_title: %s; ", $page_title); }
} else {
$page_title = '';
}
if (isset($_REQUEST["page_archive"]) && (strlen($_REQUEST["page_archive"]) > 0)) {
$page_archive = get_magic_quotes_gpc() ? $_REQUEST["page_archive"] : addslashes($_REQUEST["page_archive"]);
if ($debug & $debug_trace) { printf(" debug: page_archive: %s; ", $page_archive); }
} else {
$page_archive = '';
}
if (isset($_REQUEST["page_desc"]) && (strlen($_REQUEST["page_desc"]) > 0)) {
$page_desc = get_magic_quotes_gpc() ? $_REQUEST["page_desc"] : addslashes($_REQUEST["page_desc"]);
if ($debug & $debug_trace) { printf(" debug: page_desc: %s; ", $page_desc); }
} else {
$page_desc = '';
}
if (isset($_REQUEST["page_text"]) && (strlen($_REQUEST["page_text"]) > 0)) {
$page_text = get_magic_quotes_gpc() ? $_REQUEST["page_text"] : addslashes($_REQUEST["page_text"]);
if ($debug & $debug_trace) { printf(" debug: page_text: %s; ", $page_text); }
} else {
$page_text = '';
}
if (isset($_REQUEST["pic_id"]) && (strlen($_REQUEST["pic_id"]) > 0) && ctype_digit($_REQUEST["pic_id"]) && ($_REQUEST["pic_id"] >= 0)) {
$pic_id = $_REQUEST["pic_id"];
if ($debug & $debug_trace) { printf(" debug: pic_id: %s; ", $pic_id); }
}
if (isset($_REQUEST["pic_sort"]) && (strlen($_REQUEST["pic_sort"]) > 0) && ctype_digit($_REQUEST["pic_sort"]) && ($_REQUEST["pic_sort"] > 0)) {
$pic_sort = $_REQUEST["pic_sort"];
if ($debug & $debug_trace) { printf(" debug: pic_sort: %s; ", $pic_sort); }
} else {
$pic_sort = 0;
}
if (isset($_REQUEST["pic_cols"]) && (strlen($_REQUEST["pic_cols"]) > 0) && ctype_digit($_REQUEST["pic_cols"]) && ($_REQUEST["pic_cols"] > 0)) {
$pic_cols = $_REQUEST["pic_cols"];
if ($debug & $debug_trace) { printf(" debug: pic_cols: %s; ", $pic_cols); }
} else {
$pic_cols = 0;
}
if (isset($_REQUEST["pic_title"]) && (strlen($_REQUEST["pic_title"]) > 0)) {
$pic_title = get_magic_quotes_gpc() ? $_REQUEST["pic_title"] : addslashes($_REQUEST["pic_title"]);
if ($debug & $debug_trace) { printf(" debug: pic_title: %s; ", $pic_title); }
} else {
$pic_title = '';
}
if (isset($_REQUEST["pic_filename"]) && (strlen($_REQUEST["pic_filename"]) > 0)) {
$pic_filename = get_magic_quotes_gpc() ? $_REQUEST["pic_filename"] : addslashes($_REQUEST["pic_filename"]);
if ($debug & $debug_trace) { printf(" debug: pic_filename: %s; ", $pic_filename); }
} else {
$pic_filename = '';
}
if (isset($_REQUEST["pic_desc"]) && (strlen($_REQUEST["pic_desc"]) > 0)) {
$pic_desc = get_magic_quotes_gpc() ? $_REQUEST["pic_desc"] : addslashes($_REQUEST["pic_desc"]);
if ($debug & $debug_trace) { printf(" debug: pic_desc: %s; ", $pic_desc); }
} else {
$pic_desc = '';
}
if (isset($_REQUEST["pic_text"]) && (strlen($_REQUEST["pic_text"]) > 0)) {
$pic_text = get_magic_quotes_gpc() ? $_REQUEST["pic_text"] : addslashes($_REQUEST["pic_text"]);
if ($debug & $debug_trace) { printf(" debug: pic_text: %s; ", $pic_text); }
} else {
$pic_text = '';
}
if (isset($_REQUEST["starting_year"]) && (strlen($_REQUEST["starting_year"]) > 0) && ctype_digit($_REQUEST["starting_year"])) {
if (($_REQUEST["starting_year"] >= $first_year) && ($_REQUEST["starting_year"] <= $last_year)) {
$starting_year = $_REQUEST["starting_year"];
} else {
$starting_year = $first_year;
}
if ($debug & $debug_trace) { printf(" debug: starting_year: %s; ", $starting_year); }
}
if (isset($_REQUEST["ending_year"]) && (strlen($_REQUEST["ending_year"]) > 0) && ctype_digit($_REQUEST["ending_year"])) {
if (($_REQUEST["ending_year"] >= $first_year) && ($_REQUEST["ending_year"] <= $last_year)) {
$ending_year = $_REQUEST["ending_year"];
} else {
$ending_year = $last_year;
}
if ($debug & $debug_trace) { printf(" debug: ending_year: %s; ", $ending_year); }
}
if ($ending_year < $starting_year) {
$ending_year = $starting_year;
if ($debug & $debug_trace) { printf(" debug: ending_year adjusted to: %s; ", $ending_year); }
}
if (isset($_REQUEST["subject"]) && (strlen($_REQUEST["subject"]) > 0)) {
$subject = get_magic_quotes_gpc() ? $_REQUEST["subject"] : addslashes($_REQUEST["subject"]);
if ($debug & $debug_trace) { printf(" debug: subject: %s; ", $subject); }
}
if (isset($_REQUEST["custom_size"]) && ($_REQUEST["custom_size"] == "images")) {
$custom_size = "images";
if ($debug & $debug_trace) { printf(" debug: custom_size: %s; ", $custom_size); }
} else {
$custom_size = 'thumbnails';
}
if (isset($_REQUEST["custom_percent"]) && (strlen($_REQUEST["custom_percent"]) > 0) && ctype_digit($_REQUEST["custom_percent"]) && ($_REQUEST["custom_percent"] >= 1) && ($_REQUEST["custom_percent"] <= 100)) {
$custom_percent = $_REQUEST["custom_percent"];
if ($debug & $debug_trace) { printf(" debug: custom_percent: %s; ", $custom_percent); }
} else {
// $custom_percent = 100;
}
if ($debug & $debug_trace) { printf("Debug: debug set to: %s for %s, %s; ", $debug, $thispage, $username); }
if ($debug & $debug_info) { phpinfo(); }
if ($debug & $debug_trace) { printf("Debug: parms set to: Series: %s, Album: %s, Page: %s, Pic: %s ", $series_id, $album_id, $page_id, $pic_id); }
if ($debug & $debug_trace) { printf("Debug: series contents: %s ", $series_contents); }
if ($debug & $debug_trace) { printf("Debug: album contents: %s ", $album_contents); }
if ($debug & $debug_trace) { printf("Debug: page contents: %s ", $page_contents); }
if ($debug & $debug_trace) { $output = shell_exec('pwd'); echo " pwd = $output "; }
if ($debug & $debug_trace) { if (file_exists("Bill's CD/Photos")) {echo "it's there. ";} else {echo "it's not there ";}
; }
flush();
?>
debug: insert series "); }
// ------------------------------------------------------------------------------------------------
// it's an ADD Series
if (!$series_id == 0) {
echo "sorry, somehow this came in as a request to create a new series, but included an series ID.";
exit;
}
$sql = "insert into series";
$sql .= " (series_title, series_sort, series_security)";
$sql .= " values ('" . $series_title . "', ". $series_sort . ", '" . $series_security . "')";
if ($debug & $debug_trace) { printf(" debug: insert series query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
$series_id = mysql_insert_id();
if ($debug & $debug_trace) { printf(" debug: New series_id: %s; ", $series_id); }
} else if (isset($_REQUEST["seriesedit"]) && ($_REQUEST["seriesedit"] == "Change")) {
// ------------------------------------------------------------------------------------------------
// it's an Update Series
if ($series_id == 0) {
echo "sorry, somehow this came in as a request to change an series, but did not include an series ID.";
exit;
}
$sql = "update series ";
$sql .= " set series_title = '" . $series_title . "'";
$sql .= " , series_sort = " . $series_sort;
$sql .= " , series_security = '" . $series_security . "'";
$sql .= " where series_id = " . $series_id;
if ($debug & $debug_trace) { printf("debug: update series query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
} else if (isset($_REQUEST["seriesedit"]) && ($_REQUEST["seriesedit"] == "Delete")) {
// ------------------------------------------------------------------------------------------------
// it's an Delete Series
if ($series_id == 0) {
echo "sorry, somehow this came in as a request to delete an series, but did not include an series ID.";
exit;
}
$sql = "select album_id";
$sql .= " from series_contents";
$sql .= " where series_id = " . $series_id;
if ($debug & $debug_trace) { printf("debug: delete series preflight query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
if ($result->num_rows > 0) {
echo "can't delete an Series until it is empty.";
exit;
}
$sql = "delete from series";
$sql .= " where series_id = " . $series_id;
if ($debug & $debug_trace) { printf("debug: delete series query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
$series_id = 0;
} else if (isset($_REQUEST["albumedit"]) && ($_REQUEST["albumedit"] == "Create")) {
if ($debug & $debug_trace) { printf(" debug: insert album "); }
// ------------------------------------------------------------------------------------------------
// it's an ADD Album
if ($album_id <> 0) {
echo "sorry, somehow this came in as a request to create a new album, but included an album ID.";
exit;
}
$sql = "insert into albums";
$sql .= " (album_path, album_title, album_sort, album_desc, album_text)";
$sql .= " values ('" . $album_path . "', '" . $album_title . "', ". $album_sort . ", '" . $album_desc . "', '" . $album_text . "')";
if ($debug & $debug_trace) { printf(" debug: insert album query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
$album_id = mysql_insert_id();
if ($debug & $debug_trace) { printf(" debug: New album_id: %s; ", $album_id); }
$sql = "insert into series_contents";
$sql .= " (album_id, series_id)";
$sql .= " values (" . $album_id . ", " . $series_id . ")";
if ($debug & $debug_trace) { printf(" debug: insert album query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
if ($debug & $debug_trace) { printf(" debug: New series_contents: %s; ", $album_id); }
} else if (isset($_REQUEST["albumedit"]) && ($_REQUEST["albumedit"] == "Change")) {
if ($debug & $debug_trace) { printf("debug: update album "); }
// ------------------------------------------------------------------------------------------------
// it's an Update Album
if ($album_id == 0) {
echo "sorry, somehow this came in as a request to change a album, but did not include an album ID.";
exit;
}
$sql = "update albums ";
$sql .= " set album_path = '" . $album_path . "'";
$sql .= " , album_title = '" . $album_title . "'";
$sql .= " , album_sort = " . $album_sort;
$sql .= " , album_desc = '" . $album_desc . "'";
$sql .= " , album_text = '" . $album_text . "'";
$sql .= " where album_id = " . $album_id;
if ($debug & $debug_trace) { printf("debug: update album query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
$sql = "update series_contents ";
$sql .= " set album_id = '" . $album_id . "'";
$sql .= " , series_id = '" . $series_id . "'";
$sql .= " where album_id = " . $album_id;
if ($debug & $debug_trace) { printf("debug: update series_contents query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
} else if (isset($_REQUEST["albumedit"]) && ($_REQUEST["albumedit"] == "Delete")) {
// ------------------------------------------------------------------------------------------------
// it's an Delete Album
if ($album_id == 0) {
echo "sorry, somehow this came in as a request to delete an album, but did not include an album ID.";
exit;
}
$sql = "select page_id";
$sql .= " from album_contents";
$sql .= " where album_id = " . $album_id;
if ($debug & $debug_trace) { printf("debug: delete album preflight query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
if ($result->num_rows > 0) {
echo "can't delete an Album until it is empty.";
exit;
}
$sql = "delete from albums, series_contents";
$sql .= " using albums, series_contents";
$sql .= " where albums.album_id = series_contents.album_id and albums.album_id = " . $album_id;
if ($debug & $debug_trace) { printf("debug: delete album query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
$album_id = 0;
} else if (isset($_REQUEST["pageedit"]) && ($_REQUEST["pageedit"] == "Create")) {
if ($debug & $debug_trace) { printf(" debug: insert page "); }
// ------------------------------------------------------------------------------------------------
// it's an ADD page
if ($page_id <> 0) {
echo "sorry, somehow this came in as a request to create a new page, but included an page ID.";
exit;
}
$sql = "insert into pages";
$sql .= " (page_path, page_title, page_sort, page_desc, page_text)";
$sql .= " values ('" . $page_path . "', '" . $page_title . "', ". $page_sort . ", '" . $page_desc . "', '" . $page_text . "')";
if ($debug & $debug_trace) { printf(" debug: insert page query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
$page_id = mysql_insert_id();
if ($debug & $debug_trace) { printf(" debug: New page_id: %s; ", $page_id); }
$sql = "insert into album_contents";
$sql .= " (page_id, album_id)";
$sql .= " values (" . $page_id . ", " . $album_id . ")";
if ($debug & $debug_trace) { printf(" debug: insert album_contents query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
} else if (isset($_REQUEST["pageedit"]) && ($_REQUEST["pageedit"] == "Change")) {
if ($debug & $debug_trace) { printf("debug: update page "); }
// ------------------------------------------------------------------------------------------------
// it's an Update page
if ($page_id == 0) {
echo "sorry, somehow this came in as a request to change a page, but did not include an page ID.";
exit;
}
$sql = "update pages ";
$sql .= " set page_path = '" . $page_path . "'";
$sql .= " , page_title = '" . $page_title . "'";
$sql .= " , page_sort = " . $page_sort;
$sql .= " , page_archive = '" . $page_archive . "'";
$sql .= " , page_desc = '" . $page_desc . "'";
$sql .= " , page_text = '" . $page_text . "'";
$sql .= " where page_id = " . $page_id;
if ($debug & $debug_trace) { printf("debug: update page query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
$sql = "update album_contents ";
$sql .= " set page_id = '" . $page_id . "'";
$sql .= " , album_id = '" . $album_id . "'";
$sql .= " where page_id = " . $page_id;
if ($debug & $debug_trace) { printf("debug: update album_contents query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
} else if (isset($_REQUEST["pageedit"]) && ($_REQUEST["pageedit"] == "Delete")) {
// ------------------------------------------------------------------------------------------------
// it's an Delete Page
if ($page_id == 0) {
echo "sorry, somehow this came in as a request to delete an page, but did not include an page ID.";
exit;
}
$sql = "select pic_id";
$sql .= " from page_contents";
$sql .= " where page_id = " . $page_id;
if ($debug & $debug_trace) { printf("debug: delete page preflight query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
if ($result->num_rows > 0) {
echo "can't delete an Page until it is empty.";
exit;
}
$sql = "delete from pages, album_contents";
$sql .= " using pages, album_contents";
$sql .= " where pages.page_id = album_contents.page_id and pages.page_id = " . $page_id;
if ($debug & $debug_trace) { printf("debug: delete page query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
$page_id = 0;
} else if (isset($_REQUEST["pageedit"]) && ($_REQUEST["pageedit"] == "Import")) {
// ------------------------------------------------------------------------------------------------
// it's an Import request
if ($page_id == 0) {
echo "sorry, somehow this came in as a request to delete an page, but did not include an page ID.";
exit;
}
$sql = "select album_path, page_path from pages";
$sql .= " left join album_contents on pages.page_id = album_contents.page_id";
$sql .= " left join albums on album_contents.album_id = albums.album_id";
$sql .= " where pages.page_id = " . $page_id;
if ($debug & $debug_trace) { printf("debug: import page pre-query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
$row_page = mysqli_fetch_assoc($result);
if ($debug & $debug_trace) { printf("debug: going after directory: %s%s; ", $row_page['album_path'], $row_page['page_path']); }
$thedirectory = html_entity_decode(urldecode($row_page['album_path'] . $row_page['page_path']));
if (is_dir($thedirectory)) {
if ($dh = opendir($thedirectory)) {
while (($file = readdir($dh)) !== false) {
if (substr($file,strlen($file)-4) == ".jpg") {
$pic_title = str_replace("_", " ", substr($file,0,strlen($file)-4));
$pic_date = substr($pic_title,7,strpos(substr($pic_title,7), " "));
$pic_sort = $pic_date . substr("00000000",0,8-strlen($pic_date)) . substr($pic_title,1,5);
$sql = "insert into pictures (pic_filename, pic_title, pic_sort)";
$sql .= " values ('" . $file . "', '" . $pic_title . "', '" . $pic_sort . "')";
if ($debug & $debug_trace) { printf("debug: import page picture insert: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
$pic_id = mysql_insert_id();
$sql = "insert into page_contents (page_id, pic_id)";
$sql .= " values (" . $page_id . ", " . $pic_id . ")";
if ($debug & $debug_trace) { printf("debug: import page page_contents insert: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
}
}
closedir($dh);
$pic_id = 0;
}
} else {
echo $thedirectory . " is not a directory.";
exit;
}
header("Location: ". $thispage);
} else if (isset($_REQUEST["pageedit"]) && ($_REQUEST["pageedit"] == "reBuild")) {
// ------------------------------------------------------------------------------------------------
// it's an reBuild request
if ($page_id == 0) {
echo "sorry, somehow this came in as a request to rebuild a page, but did not include an page ID.";
exit;
}
$sql = "select album_path, page_path from pages";
$sql .= " left join album_contents on pages.page_id = album_contents.page_id";
$sql .= " left join albums on album_contents.album_id = albums.album_id";
$sql .= " where pages.page_id = " . $page_id;
if ($debug & $debug_trace) { printf("debug: import page pre-query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
$row_page = mysqli_fetch_assoc($result);
if ($debug & $debug_trace) { printf("debug: going after directory: %s%s; ", $row_page['album_path'], $row_page['page_path']); }
$thedirectory = html_entity_decode(urldecode($row_page['album_path'] . $row_page['page_path']));
if (is_dir($thedirectory)) {
if (!file_exists($thedirectory . "images")) {mkdir(thedirectory . "images",0755);}
if (!file_exists($thedirectory . "thumbnails")) {mkdir(thedirectory . "thumbnails",0755);}
// convert file (x as file specification) using batch file specification : batch settings file to folder file specification : destination folder
} else {
echo $thedirectory . " is not a directory.";
exit;
}
header("Location: ". $thispage);
} else if (isset($_REQUEST["picedit"]) && ($_REQUEST["picedit"] == "Change")) {
if ($debug & $debug_trace) { printf("debug: update pic "); }
// ------------------------------------------------------------------------------------------------
// it's an Update picture
if ($pic_id == 0) {
echo "sorry, somehow this came in as a request to change a picture, but did not include an picture ID.";
exit;
}
$sql = "update pictures ";
$sql .= " set pic_title = '" . $pic_title . "'";
$sql .= " , pic_filename = '" . $pic_filename . "'";
$sql .= " , pic_sort = " . $pic_sort;
$sql .= " , pic_cols = " . $pic_cols;
$sql .= " , pic_desc = '" . $pic_desc . "'";
$sql .= " , pic_text = '" . $pic_text . "'";
$sql .= " where pic_id = " . $pic_id;
if ($debug & $debug_trace) { printf("debug: update pic query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
$sql = "update page_contents ";
$sql .= " set pic_id = '" . $pic_id . "'";
$sql .= " , page_id = '" . $page_id . "'";
$sql .= " where pic_id = " . $pic_id;
if ($debug & $debug_trace) { printf("debug: update page_contents query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
} else if (isset($_REQUEST["picedit"]) && ($_REQUEST["picedit"] == "Delete")) {
if ($debug & $debug_trace) { printf("debug: Delete pic "); }
// ------------------------------------------------------------------------------------------------
// it's an Delete picture
if ($pic_id == 0) {
echo "sorry, somehow this came in as a request to Delete a picture, but did not include an picture ID.";
exit;
}
$sql = "delete from pictures ";
$sql .= " where pic_id = " . $pic_id;
if ($debug & $debug_trace) { printf("debug: delete pic query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
$sql = "delete from page_contents ";
$sql .= " where pic_id = " . $pic_id;
if ($debug & $debug_trace) { printf("debug: delete page_contents query: %s; ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
$pic_id = 0;
} else if (isset($_REQUEST["Zip"])) {
if ($debug & $debug_trace) { printf("debug: Download Zip of BaP "); }
// ------------------------------------------------------------------------------------------------
// it's a zip download request
// ------------------------------------------------------------------------------------------------
$sql = "select pic_filename, substr(pic_title,8,6) as pic_year, page_path, album_path from pictures";
$sql .= " left join page_contents on pictures.pic_id = page_contents.pic_id";
$sql .= " left join album_contents on page_contents.page_id = album_contents.page_id";
$sql .= " left join series_contents on album_contents.album_id = series_contents.album_id";
$sql .= " left join pages on page_contents.page_id = pages.page_id";
$sql .= " left join albums on album_contents.album_id = albums.album_id";
$sql .= " where pictures.pic_id in (" . $page_contents . ")";
$sql .= " order by pic_year, pictures.pic_id";
$sql .= ";";
if ($debug & $debug_trace) { printf("debug: download a Build a page query: %s; ", $sql); }
$BaP = $db_conn->query($sql) or die($db_conn->error);
if ($debug & $debug_trace) { printf("debug: download a build a page returned %s pictures; ", $BaP->num_rows); }
$zip_command = 'zip -j -q -';
while (($BaP) && ($row_page = mysqli_fetch_assoc($BaP)) && ($row_page)) {
$zip_command .= ' "' . html_entity_decode(urldecode($row_page['album_path'] . $row_page['page_path'] . '/' . $row_page['pic_filename'])) . '"';
}
if ($debug & $debug_trace) { printf("debug: zip command: %s; ", $zip_command); exit;}
flush();
header("Content-type: " . 'application/zip');
header('Content-Disposition: inline; filename="' . 'Photo_archive.zip' . '"');
passthru($zip_command);
exit;
} else if (isset($_REQUEST["Build"])) {
if ($debug & $debug_trace) { printf("debug: Build a Page "); }
// ------------------------------------------------------------------------------------------------
// it's an Build a Page request
// ------------------------------------------------------------------------------------------------
$sql = "select pictures.pic_id, pic_title, pic_desc, pic_text, pic_filename, page_contents.page_id, album_contents.album_id, series_contents.series_id, substr(pic_title,8,6) as pic_year, page_path, album_path from pictures ";
$sql .= " left join page_contents on pictures.pic_id = page_contents.pic_id";
$sql .= " left join album_contents on page_contents.page_id = album_contents.page_id";
$sql .= " left join series_contents on album_contents.album_id = series_contents.album_id";
$sql .= " left join pages on page_contents.page_id = pages.page_id";
$sql .= " left join albums on album_contents.album_id = albums.album_id";
$sql .= " where";
if ($edit == 0) {
$sql .= " series_id = " . $series_id . " and";
}
$sql .= " ((substr(pic_title,8,4) >= " . $starting_year;
$sql .= " and substr(pic_title,8,4) <= " . $ending_year . ") or ";
$sql .= " (substr(album_title,1,4) >= " . $starting_year;
$sql .= " and substr(album_title,1,4) <= " . $ending_year . "))";
if ($subject <> $default_key) {
$sql .= " and (pic_title like '%" . $subject . "%' ";
$sql .= " or pic_desc like '%" . $subject . "%' ";
$sql .= " or pic_text like '%" . $subject . "%' )";
}
$sql .= " order by pic_year, pic_id";
$sql .= ";";
if ($debug & $debug_trace) { printf("debug: build a page query: %s; ", $sql); }
$BaP = $db_conn->query($sql) or die($db_conn->error);
if ($debug & $debug_trace) { printf("debug: build a page returned %s pictures; ", $BaP->num_rows); }
$page_contents = $page_id;
while (($BaP) && ($row_page = mysqli_fetch_assoc($BaP)) && ($row_page)) {
$page_contents .= ',' . $row_page['pic_id'];
}
}
?>
0) {
$sql = "select page_contents.page_id, album_contents.album_id, series_contents.series_id";
$sql .= " from page_contents";
$sql .= " left join album_contents on page_contents.page_id = album_contents.page_id";
$sql .= " left join series_contents on album_contents.album_id = series_contents.album_id";
$sql .= " where page_contents.pic_id = " . $pic_id;
if ($debug & $debug_trace) { printf("Debug: pic_id alignment Query: %s ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
if ($result->num_rows == 0) {
echo "Internal Error - non-existent picture discovered during alignment";
exit;
} else if ($result->num_rows == 1) {
$row_index = mysqli_fetch_assoc($result);
$page_id = $row_index['page_id'];
$album_id = $row_index['album_id'];
$series_id = $row_index['series_id'];
} else {
if ($debug & $debug_trace) { printf("Debug: pic_id %s appears on more than one page. ", $pic_id); }
}
} else if ($page_id > 0) {
$sql = "select album_contents.album_id, series_contents.series_id";
$sql .= " from album_contents";
$sql .= " left join series_contents on album_contents.album_id = series_contents.album_id";
$sql .= " where album_contents.page_id = " . $page_id;
if ($debug & $debug_trace) { printf("Debug: page_id alignment Query: %s ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
if ($result->num_rows == 0) {
echo "Internal Error - non-existent page discovered during alignment";
exit;
} else if ($result->num_rows == 1){
$row_index = mysqli_fetch_assoc($result);
$album_id = $row_index['album_id'];
$series_id = $row_index['series_id'];
} else {
if ($debug & $debug_trace) { printf("Debug: page_id %s appears on more than one album. ", $page_id); }
}
} else if ($album_id > 0) {
$sql = "select series_contents.series_id";
$sql .= " from series_contents";
$sql .= " where series_contents.album_id = " . $album_id;
if ($debug & $debug_trace) { printf("Debug: album_id alignment Query: %s ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
if ($result->num_rows == 0) {
echo "Internal Error - non-existent album discovered during alignment";
exit;
} else if ($result->num_rows == 1){
$row_index = mysqli_fetch_assoc($result);
$series_id = $row_index['series_id'];
} else {
if ($debug & $debug_trace) { printf("Debug: album_id %s appears on more than one series. ", $album_id); }
}
}
if ($debug & $debug_trace) { printf("Debug: parms after forms set to: Series: %s, Album: %s, Page: %s, Pic: %s ", $series_id, $album_id, $page_id, $pic_id); }
flush();
?>
", $sql); }
$series = $db_conn->query($sql) or die($db_conn->error);
$num_series = $series->num_rows;
// ------------------------------------------------------------------------------------------------
// Albums in current Series for menu bar, Series and edit page
$sql = "select *";
$sql .= " from albums";
$sql .= " inner join series_contents on albums.album_id = series_contents.album_id";
$sql .= " where series_contents.series_id = " . $series_id;
$sql .= " order by albums.album_sort";
if ($debug & $debug_trace) { printf("Debug: Album Query: %s ", $sql); }
$albums = $db_conn->query($sql) or die($db_conn->error);
$num_albums = $albums->num_rows;
if ($debug & $debug_trace) { printf("Debug: Album Query resulted in %s rows ", $albums->num_rows); }
// ------------------------------------------------------------------------------------------------
// Pages in current - used by menu bar and edit picture
$sql = "select pages.page_id, page_path, page_sort, page_title, page_desc, page_text, album_contents.album_id, album_title";
$sql .= " from pages";
$sql .= " left join album_contents on pages.page_id = album_contents.page_id";
$sql .= " left join albums on album_contents.album_id = albums.album_id";
$sql .= " left join series_contents on albums.album_id = series_contents.album_id";
$sql .= " left join series on series_contents.series_id = series.series_id";
$sql .= " where series_contents.series_id = " . $series_id;
$sql .= " order by series.series_sort, albums.album_sort, pages.page_sort";
if ($debug & $debug_trace) { printf("Debug: ppage_id Query: %s ", $sql); }
$pages = $db_conn->query($sql) or die($db_conn->error);
$num_pages = $pages->num_rows;
// ------------------------------------------------------------------------------------------------
// View specific Queries
// ------------------------------------------------------------------------------------------------
if ($series_id == 0) {
// ------------------------------------------------------------------------------------------------
// Series Edit Series Edit Series Edit Series Edit Series Edit Series Edit Series Edit
// no special queries required
// If there is only 1 series, no need to display an index, so let's get to it
if ($series->num_rows == 1 and $edit == 0) {
$row_index = mysqli_fetch_assoc($series);
$series_id = $row_index['series_id'];
}
}
if ($series_id > 0 && $album_id == 0) {
// ------------------------------------------------------------------------------------------------
// Series Series Series Series Series Series Series Series Series Series Series Series Series Series Series Series
// Current Series
$sql = "select *";
$sql .= " from series";
$sql .= " where series.series_id = " . $series_id;
$sql .= " order by series.series_sort";
if ($debug & $debug_trace) { printf("Debug: series Query: %s ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
$theseries = mysqli_fetch_assoc($result);
$series_title = $theseries['series_title'];
if ($debug & $debug_trace) { printf("Debug: Selected Series is: %s ", $series_title); }
// We don't have a parent, so we have to figure it out for ourselves
// but the general series queries has what we need
mysqli_data_seek($series, $series->num_rows-1); $row_index = mysqli_fetch_assoc($series); $last_series = $row_index['series_id'];
mysqli_data_seek($series, 0);$row_index = mysqli_fetch_assoc($series); $first_series = $row_index['series_id'];
$prev_series = $first_series;
$next_series = $last_series;
while (($row_index) && ($row_index['series_id'] <> $series_id)) {
$prev_series = $row_index['series_id'];
$row_index = mysqli_fetch_assoc($series);
}
if ($row_index) { $row_index = mysqli_fetch_assoc($series); }
if ($row_index) { $next_series = $row_index['series_id']; }
$up = sprintf(" ", $thispage);
// ------------------------------------------------------------------------------------------------
// Now we should build series_contents for the albums display so the menu buttons will work
mysqli_data_seek($albums, 0);
$series_contents = $series_id;
while ($albums && ($row_index = mysqli_fetch_assoc($albums)) && $row_index) {
$series_contents .= ',' . $row_index['album_id'];
}
// If there is only 1 album, no need to display an index, so let's get to it
if ($albums->num_rows == 1 and $edit == 0) {
$row_index = mysqli_fetch_assoc($albums);
$album_id = $row_index['album_id'];
}
}
if ($series_id > 0 && $album_id > 0 && $page_id == 0) {
// ------------------------------------------------------------------------------------------------
// Album Album Album Album Album Album Album Album Album Album Album Album Album Album Album Album Album Album Album
// Current Album
$sql = "select *";
$sql .= " from albums";
$sql .= " where albums.album_id = " . $album_id;
$sql .= " order by albums.album_sort";
if ($debug & $debug_trace) { printf("Debug: Album_id Query: %s ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
$thealbum = mysqli_fetch_assoc($result);
$album_title = $thealbum['album_title'];
$album_desc = $thealbum['album_desc'];
$album_text = $thealbum['album_text'];
if ($debug & $debug_trace) { printf("Debug: Selected Album is: %s ", $album_title); }
// the pages on the album
$sql = "select *";
$sql .= " from pages";
$sql .= " inner join album_contents on pages.page_id = album_contents.page_id";
$sql .= " where album_contents.album_id = " . $album_id;
$sql .= " order by pages.page_sort";
if ($debug & $debug_trace) { printf("Debug: Page Query: %s ", $sql); }
$album_pages = $db_conn->query($sql) or die($db_conn->error);
if ($debug & $debug_trace) { printf("Debug: Page Query resulted in %s rows ", $album_pages->num_rows); }
// Menu Bar button refer to the album, so we have to figure out what those should be
if ($series_contents && $series_contents_array = explode(",",$series_contents) && $series_contents_array[0] == $series_id) {
$series_offset = array_search($album_id,$series_contents_array);
$first_album = $series_contents_array[1];
$prev_album = $series_offset == 1 ? $album_id : $series_contents_array[$series_offset-1];
$next_album = $series_offset == count($series_contents_array)-1 ? $album_id : $series_contents_array[$series_offset+1];
$last_album = $series_contents_array[count($series_contents_array)-1];
} else { // we get to do it the hard way
$sql = "select albums.album_id";
$sql .= " from albums";
$sql .= " left join series_contents on albums.album_id = series_contents.album_id";
$sql .= " where series_contents.series_id = " . $series_id;
$sql .= " order by Albums.album_sort";
if ($debug & $debug_trace) { printf("Debug: Album Index Query: %s ", $sql); }
$index = $db_conn->query($sql) or die($db_conn->error);
if ($debug & $debug_trace) { printf("Debug: Page Index Query resulted in %s rows ", $index->num_rows); }
mysqli_data_seek($index, $index->num_rows-1); $row_index = mysqli_fetch_assoc($index); $last_album = $row_index['album_id'];
mysqli_data_seek($index, 0); $row_index = mysqli_fetch_assoc($index); $first_album = $row_index['album_id'];
$up = sprintf(" ", $thispage,$series_id);
$prev_album = $first_album;
$next_album = $last_album;
while (($row_index) && ($row_index['album_id'] <> $album_id)) {
$prev_album = $row_index['album_id'];
$row_index = mysqli_fetch_assoc($index);
}
if ($row_index) { $row_index = mysqli_fetch_assoc($index); }
if ($row_index) { $next_album = $row_index['album_id']; }
}
// Let's make it easy on the next guy while we're here
$album_contents = $album_id;
if ($album_pages->num_rows > 0) {
mysqli_data_seek($album_pages, 0);
while ($pages && ($row_index = mysqli_fetch_assoc($album_pages)) && $row_index) {$album_contents .= "," . $row_index['page_id'];}
if ($debug & $debug_trace) { printf("Debug: album_contents updated to: %s ", $album_contents); }
}
if ($pages->num_rows == 1 && $edit == 0) { $thepage = mysqli_fetch_assoc($pages); $page_id = $thepage['page_id']; }
}
if ($series_id > 0 && $album_id > 0 && $page_id > 0 && $pic_id == 0 && !isset($_REQUEST["Build"])) {
// ------------------------------------------------------------------------------------------------
// page page page page page page page page page page page page page page page page page page page
// current page
$sql = "select pages.page_id, pages.page_title, pages.page_desc, pages.page_text, pages.page_path, pages.page_archive, pages.page_sort";
$sql .= " , album_contents.album_id, albums.album_path";
$sql .= " from pages";
$sql .= " left join album_contents on pages.page_id = album_contents.page_id";
$sql .= " left join albums on album_contents.album_id = albums.album_id";
$sql .= " where pages.page_id = " . $page_id;
if ($debug & $debug_trace) { printf("Debug: Page_id Query: %s ", $sql); }
$result = $db_conn->query($sql) or die($db_conn->error);
$thepage = mysqli_fetch_assoc($result);
if ($debug & $debug_trace) { printf("Debug: Selected Page is: %s ", $thepage['page_title']); }
// we need info on all the pictures so we can display the index
$sql = "select pictures.pic_id, pictures.pic_filename, pictures.pic_title, pictures.pic_cols, pictures.pic_desc";
$sql .= ", albums.album_path, pages.page_path";
$sql .= " from pictures";
$sql .= " inner join page_contents on pictures.pic_id = page_contents.pic_id";
$sql .= " inner join pages on pages.page_id = page_contents.page_id";
$sql .= " inner join album_contents on page_contents.page_id = album_contents.page_id";
$sql .= " inner join albums on album_contents.album_id = albums.album_id";
$sql .= " where page_contents.page_id = " . $page_id;
$sql .= " order by pictures.pic_sort";
if ($debug & $debug_trace) { printf("Debug: pictures Query: %s ", $sql); }
$pictures = $db_conn->query($sql) or die($db_conn->error);
if ($debug & $debug_trace) { printf("Debug: pictures Query resulted in %s rows ", $pictures->num_rows); }
// Menu Bar buttons refer to the page, so we have to figure out what those should be
if ($album_contents && ($album_contents_array = explode(",",$album_contents)) && ($album_contents_array[0] == $album_id)) {
$album_offset = array_search($page_id,$album_contents_array);
$first_page = $album_contents_array[1];
$prev_page = $album_offset == 1 ? $page_id : $album_contents_array[$album_offset-1];
$next_page = $album_offset == count($album_contents_array)-1 ? $page_id : $album_contents_array[$album_offset+1];
$last_page = $album_contents_array[count($album_contents_array)-1];
} else { // we get to do it the hard way
$sql = "select album_contents.page_id";
$sql .= " from album_contents";
$sql .= " left join pages on album_contents.page_id = pages.page_id";
$sql .= " where album_contents.album_id = " . $album_id;
$sql .= " order by pages.page_sort";
if ($debug & $debug_trace) { printf("Debug: Page Index Query: %s ", $sql); }
$index = $db_conn->query($sql) or die($db_conn->error);
if ($debug & $debug_trace) { printf("Debug: Page Index Query resulted in %s rows ", $index->num_rows); }
mysqli_data_seek($index, $index->num_rows-1); $row_index = mysqli_fetch_assoc($index); $last_page = $row_index['page_id'];
mysqli_data_seek($index, 0); $row_index = mysqli_fetch_assoc($index); $first_page = $row_index['page_id'];
$prev_page = $first_page;
$next_page = $last_page;
while (($row_index) && ($row_index['page_id'] <> $page_id)) {
$prev_page = $row_index['page_id'];
$row_index = mysqli_fetch_assoc($index);
}
if ($row_index) { $row_index = mysqli_fetch_assoc($index); }
if ($row_index) { $next_page = $row_index['page_id']; }
}
// Let's make it easy on the next guy while we're here
$page_contents = $page_id;
if ($pictures->num_rows > 0) {
mysqli_data_seek($pictures, 0);
while ($pages && ($row_index = mysqli_fetch_assoc($pictures)) && $row_index) {$page_contents .= "," . $row_index['pic_id'];}
if ($debug & $debug_trace) { printf("Debug: page_contents updated to: %s ", $page_contents); }
}
if ($pictures->num_rows == 1) { $thepic = mysqli_fetch_assoc($pictures); $pic_id = $thepic['pic_id']; }
$up = sprintf(" ", $thispage, $series_id, $album_id);
}
if ($pic_id > 0) {
// ------------------------------------------------------------------------------------------------
// picture picture picture picture picture picture picture picture picture picture picture picture
$sql = "select pictures.pic_id, pictures.pic_title, pictures.pic_desc, pictures.pic_text, pictures.pic_filename, pictures.pic_sort, pictures.pic_cols";
$sql .= ", page_contents.page_id, pages.page_path, album_contents.album_id, albums.album_path, series_contents.series_id";
$sql .= " from pictures";
$sql .= " inner join page_contents on pictures.pic_id = page_contents.pic_id";
$sql .= " inner join pages on page_contents.page_id = pages.page_id";
$sql .= " inner join album_contents on page_contents.page_id = album_contents.page_id";
$sql .= " inner join albums on album_contents.album_id = albums.album_id";
$sql .= " inner join series_contents on albums.album_id = series_contents.album_id";
$sql .= " where pictures.pic_id = " . $pic_id;
if ($debug & $debug_trace) { printf("Debug: picture Query: %s ", $sql); }
$picture = $db_conn->query($sql) or die($db_conn->error);
$thepicture = mysqli_fetch_assoc($picture);
// ------------------------------------------------------------------------------------------------
// the Menu bar buttons (first, prev, next and last) refer to pictures, we built an array for the page
$page_contents_array = explode(",",$page_contents);
$page_offset = array_search($pic_id,$page_contents_array);
$first_pic = $page_contents_array[1];
$prev_pic = $page_offset == 1 ? $pic_id : $page_contents_array[$page_offset-1];
$next_pic = $page_offset == count($page_contents_array)-1 ? $pic_id : $page_contents_array[$page_offset+1];
$last_pic = $page_contents_array[count($page_contents_array)-1];
$up = sprintf(" ", $thispage, $series_id, $album_id, $page_id);
}
// ------------------------------------------------------------------------------------------------
// save the stuff we care about
// ------------------------------------------------------------------------------------------------
$_SESSION['debug'] = $debug;
$_SESSION['edit'] = $edit;
$_SESSION['picsperrow'] = $picsperrow;
$_SESSION['custom_size'] = $custom_size;
$_SESSION['subject'] = $subject;
$_SESSION['starting_year'] = $starting_year;
$_SESSION['ending_year'] = $ending_year;
$_SESSION['auto'] = $auto;
$_SESSION['series_id'] = $series_id;
$_SESSION['album_id'] = $album_id;
$_SESSION['page_id'] = $page_id;
$_SESSION['pic_id'] = $pic_id;
$_SESSION['series_contents'] = $series_contents;
$_SESSION['album_contents'] = $album_contents;
$_SESSION['page_contents'] = $page_contents;
session_write_close();
if ($debug & $debug_trace) { printf("Debug: Queries complete, here's what we've got:%s ",print_r($_SESSION,TRUE)); }
flush();
?>
0) {
if ($thepicture['pic_title'] > " ") {
echo $thepicture['pic_title'];
} else {
echo $thepicture['pic_filename'];
}
} else if (isset($_REQUEST['Build'])) {
echo 'Custom Page';
} else if ($page_id <> 0) {
echo $thepage['page_title'];
} else if ($album_id <> 0) {
echo $album_title;
} else {
echo "Bill's Blurry Pictures";
}?>
0) {
$page_contents_array = explode(",",$page_contents);
$page_offset = array_search($pic_id,$page_contents_array);
$parm = $page_offset == count($page_contents_array)-1 ? "auto=0" : "pic_id=" . $page_contents_array[$page_offset+1] ;
printf(' ',$auto, $thispage, $parm);
} ?>
0) {
if ($thepicture['pic_desc'] > " ") {
echo '' . $thepicture['pic_desc'] . ' ';
} else if ($thepicture['pic_title'] > " ") {
echo '' . $thepicture['pic_title'] . ' ';
} else if ($thepicture['pic_filename'] > " ") {
echo '' . $thepicture['pic_filename'] . ' ';
}
if ($debug & $debug_trace) { printf("Debug: pic_desc: %s ", $row_pic['pic_desc']); }
} else if (isset($_REQUEST["Build"])) {
echo 'Custom Page ';
} else if ($page_id <> 0) {
echo '' . $thepage['page_desc'] . ' ';
} else if ($album_id <> 0) {
echo '' . $album_desc . ' ';
} else {
if ($series_id > 0) {
$page_name .= ' * ' . $series_title . ' *';
} else {
$page_name .= ' * Series Edit *';
}
if ($album_id == 0) {include "Heading.inc";}
}?>
num_rows > 0) { ?>
Title
Security
%s", $thispage, $row_series['series_id'], $row_series['series_title']); ?>
num_rows > 0) { ?>
Title
Description
%s", $thispage, $row_albums['series_id'], $row_albums['album_id'], $row_albums['album_title']); ?>
num_rows > 0) { ?>
Title
Description
%s", $thispage, $series_id, $row_pages['album_id'], $row_pages['page_id'], $row_pages['page_title']); ?>
Edit Album ()
Series:
Select One:
>
Add New Page
num_rows > 0) { ?>
%s (%s) ", $picsperrow-1, $thepage['page_text'], $pictures->num_rows);
// } else {
// printf("%s (%s) ", $picsperrow, $thepage['page_text'], $pictures->num_rows);
// } ?>
num_rows > 0) { ?>
", $row_pics['pic_id']); }
if ($row_pics['pic_cols'] > 1) {
$pic_cols = $row_pics['pic_cols'];
$column += $row_pics['pic_cols'];
} else {
$pic_cols = 1;
$column += 1;
}
if ($next_pic['pic_id']) {
if ($next_pic['pic_cols'] > 1) {
$next_cols = $next_pic['pic_cols'];
} else {
$next_cols = 1;
}
} else {
$next_cols = $picsperrow;
}
// new row?
if ($column > $picsperrow) {
if ($pic_cols > 1) {
$column = $pic_cols;
} else {
$column = 1;
}
echo " ";
}
// end of row? if yes, span to the end
if ($column + $next_cols > $picsperrow) {
$pic_cols += $picsperrow - $column;
$column = $picsperrow;
}
echo " 1) { printf(" colspan='%s'",$pic_cols); }
echo "> ";
$thedirectory = urldecode($row_pics['album_path'] . $row_pics['page_path']);
if ($custom_size == "images") {
$subdir = "/images";
$sizeparm = "width='$custom_percent%%'";
} else {
$subdir = "/thumbnails";
$sizeparm = "height='67'";
}
if ($debug & $debug_trace) { printf("debug: looking in: %s; ", $thedirectory . $subdir); }
if (!file_exists($thedirectory . $subdir)) {$subdir = '';}
if (!($subdir == '')) {$sizeparm = '';}
printf("
%s ",
$thispage, $row_pics['pic_id'],
$row_pics['album_path'] . $row_pics['page_path'] . $subdir, $row_pics['pic_filename'], $row_pics['pic_desc'],
$sizeparm, $row_pics['pic_title']); ?>
Edit Page ()
Album:
Select One:
>
Custom Page Starting Year: %s Ending Year: %s Title contains: %s (%s) ", $picsperrow-1, $starting_year, $ending_year, $subject, $BaP->num_rows);
?>
num_rows == 0) {echo ' Sorry, no pictures selected. '; }
else {?>
", $row_pics['pic_id']); }
if ($row_pics['pic_cols'] > 1) {
$pic_cols = $row_pics['pic_cols'];
$column += $row_pics['pic_cols'];
} else {
$pic_cols = 1;
$column += 1;
}
if ($next_pic['pic_id']) {
if ($next_pic['pic_cols'] > 1) {
$next_cols = $next_pic['pic_cols'];
} else {
$next_cols = 1;
}
} else {
$next_cols = $picsperrow;
}
// new row?
if ($column > $picsperrow) {
if ($pic_cols > 1) {
$column = $pic_cols;
} else {
$column = 1;
}
echo " ";
}
// end of row? if yes, span to the end
if ($column + $next_cols > $picsperrow) {
$pic_cols += $picsperrow - $column;
$column = $picsperrow;
}
echo " 1) { printf(" colspan='%s'",$pic_cols); }
echo "> ";
$thedirectory = urldecode($row_pics['album_path'] . $row_pics['page_path']);
if ($custom_size == "images") {
$subdir = "/images";
$sizeparm = "width='$custom_percent%%'";
} else {
$subdir = "/thumbnails";
$sizeparm = "height='67'";
}
if ($debug & $debug_trace) { printf("debug: looking in: %s; ", $thedirectory . $subdir); }
if (!file_exists($thedirectory . $subdir)) {$subdir = '';}
if (!($subdir == '')) {$sizeparm = '';}
printf("
%s ",
$thispage, $row_pics['pic_id'],
$row_pics['album_path'] . $row_pics['page_path'] . $subdir, $row_pics['pic_filename'], $row_pics['pic_desc'],
$sizeparm, $row_pics['pic_title']);
?>
", $thedirectory . $subdir); }
printf(" %s%s
",
$thepicture['album_path'], $thepicture['page_path'], $thepicture['pic_filename'], $thepicture['album_path'], $thepicture['page_path'], $subdir, $thepicture['pic_filename'], $thepicture['pic_desc'], $sizeparm, $thepicture['pic_filename'], nl2br($thepicture['pic_text'])); ?>
Page:
Select One:
>