Execute($sql_select_log); $numrows_select_log = $rs_select_log->RecordCount(); /* If page found, check for modification time, otherwise insert the new page in the database */ if ($numrows_select_log > 0) { /* Page found in table, ready processing */ /* 2003/08/08 -- 1.xx version, phase out *//* $row_select_log = mysql_fetch_assoc($results_select_log);*/ /* Update count */ /* 2003/08/08 -- 1.xx version, phase out *//* $count = $row_select_log['count'] + 1;*/ $count = ($rs_select_log->fields['count'] + 1); /* 2003/08/08 -- 1.xx version, phase out *//* if ($current_timestamp > $row_select_log['last_update'])*/ if ($current_timestamp > $rs_select_log->fields['last_update']) { /* Current timestamp is greater, update it */ /* 2003/08/08 -- 1.xx version, phase out *//* $version = ($row_select_log['file_version'] + $INCREMENTAL_VERSION);*/ $version = ($rs_select_log->fields['file_version'] + $INCREMENTAL_VERSION); /* 2003/08/08 -- 2.xx version includes autogenerated UPDATE and INSERT sql statements */ $prep_sql_update_log = "SELECT * FROM " . $TABLE . " WHERE file_name = '" . $self . "'"; $prep_rs_update_log = $ADO->Execute($prep_sql_update_log); $prep_rec_update_log = array(); if ($DREAMWEAVER_LCK_ON) { /* Update page with respective existing .LCK files */ if ($lck_file_ptr = @file($lck_file)) { /* .LCK file exists! */ $lck_parts = explode('|', $lck_file_ptr[0]); /* 2003/08/08 -- 1.xx version, phase out *//* $sql_update_log = "UPDATE " . $TABLE . " SET file_version = '" . $version . "', last_update = '" . $current_timestamp . "', last_maintainer = '" . addslashes($lck_parts[0]) . "', last_email = '" . addslashes($lck_parts[2]) . "' WHERE file_name = '" . $self . "'";*/ $prep_rec_update_log['file_version'] = $version; $prep_rec_update_log['last_update'] = $current_timestamp; $prep_rec_update_log['last_maintainer'] = $lck_parts[0]; $prep_rec_update_log['last_email'] = $lck_parts[2]; $check_name = $lck_parts[0]; $check_email = $lck_parts[2]; $stuff['modify_by'] = true; } else { /* .LCK file doesn't exist! */ /* 2003/08/08 -- 1.xx version, phase out *//* $sql_update_log = "UPDATE " . $TABLE . " SET file_version = '" . $version . "', last_update = '" . $current_timestamp . "' WHERE file_name='" . $self . "'";*/ $prep_rec_update_log['file_version'] = $version; $prep_rec_update_log['last_update'] = $current_timestamp; /* 2003/08/08 -- 1.xx version, phase out *//* $check_name = stripslashes($row_select_log['last_maintainer']); $check_email = stripslashes($row_select_log['last_email']);*/ $check_name = $rs_select_log->fields['last_maintainer']; $check_email = $rs_select_log->fields['last_email']; $stuff['modify_by'] = false; } /* 2003/08/08 -- 1.xx version, phase out *//* mysql_query($sql_update_log, $ADO) or die(mysql_error());*/ $sql_update_log = $ADO->GetUpdateSQL($prep_rs_update_log, $prep_rec_update_log); $ADO->Execute($sql_update_log); } else { /* Update page without .LCK files */ /* 2003/08/08 -- 1.xx version, phase out *//* $sql_update_log = "UPDATE " . $TABLE . " SET file_version = '" . $version . "', last_update = '" . $current_timestamp . "' WHERE file_name='" . $self . "'";*/ $prep_rec_update_log['file_version'] = $version; $prep_rec_update_log['last_update'] = $current_timestamp; /* 2003/08/08 -- 1.xx version, phase out *//* mysql_query($sql_update_log, $ADO) or die(mysql_error());*/ $sql_update_log = $ADO->GetUpdateSQL($prep_rs_update_log, $prep_rec_update_log); $ADO->Execute($sql_update_log); } } else { /* Current timestamp is not greater, retrieve file version */ /* 2003/08/08 -- 1.xx version, phase out *//* $version = $row_select_log['file_version']; $check_name = stripslashes($row_select_log['last_maintainer']); $check_email = stripslashes($row_select_log['last_email']);*/ $version = $rs_select_log->fields['file_version']; $check_name = $rs_select_log->fields['last_maintainer']; $check_email = $rs_select_log->fields['last_email']; } } else { /* 2003/08/08 -- 2.xx version includes autogenerated UPDATE and INSERT sql statements */ $prep_sql_insert_log = "SELECT * FROM " . $TABLE . " WHERE file_name = '-1'"; $prep_rs_insert_log = $ADO->Execute($prep_sql_insert_log); $prep_rec_insert_log = array(); /* Page not found in table, insert it */ $version = $INITIAL_VERSION; $count = 1; if ($DREAMWEAVER_LCK_ON) { /* Insert with .LCK files */ if ($lck_file_ptr = @file($lck_file)) { /* .LCK file exists! */ $lck_parts = explode('|', $lck_file_ptr[0]); /* 2003/08/08 -- 1.xx version, phase out *//* $sql_insert_log = "INSERT INTO " . $TABLE . " (file_name, file_version, last_update, last_maintainer, last_email, count) VALUES ('" . $self . "', '" . $version . "', '" . $current_timestamp . "', '" . addslashes($lck_parts[0]) . "', '" . addslashes($lck_parts[2]) . "', '" . $count . "')";*/ $prep_rec_insert_log['file_name'] = $self; $prep_rec_insert_log['file_version'] = $version; $prep_rec_insert_log['last_update'] = $current_timestamp; $prep_rec_insert_log['last_maintainer'] = $lck_parts[0]; $prep_rec_insert_log['last_email'] = $lck_parts[2]; $prep_rec_insert_log['count'] = $count; $check_name = $lck_parts[0]; $check_email = $lck_parts[2]; $stuff['modify_by'] = true; } else { /* .LCK file doesn't exist! */ /* 2003/08/08 -- 1.xx version, phase out *//* $sql_insert_log = "INSERT INTO " . $TABLE . " (file_name, file_version, last_update, last_maintainer, last_email, count) VALUES ('" . $self . "', '" . $version . "', '" . $current_timestamp . "', '', '', '" . $count . "')";*/ $prep_rec_insert_log['file_name'] = $self; $prep_rec_insert_log['file_version'] = $version; $prep_rec_insert_log['last_update'] = $current_timestamp; $prep_rec_insert_log['last_maintainer'] = ''; $prep_rec_insert_log['last_email'] = ''; $prep_rec_insert_log['count'] = $count; $check_name = ''; $check_email = ''; $stuff['modify_by'] = false; } } else { /* Insert without .LCK files */ /* 2003/08/08 -- 1.xx version, phase out *//* $sql_insert_log = "INSERT INTO " . $TABLE . " (file_name, file_version, last_update, last_maintainer, last_email, count) VALUES ('" . $self . "', '" . $version . "', '" . $current_timestamp . "', '', '', '" . $count . "')";*/ $prep_rec_insert_log['file_name'] = $self; $prep_rec_insert_log['file_version'] = $version; $prep_rec_insert_log['last_update'] = $current_timestamp; $prep_rec_insert_log['last_maintainer'] = ''; $prep_rec_insert_log['last_email'] = ''; $prep_rec_insert_log['count'] = $count; } /* 2003/08/08 -- 1.xx version, phase out *//* mysql_query($sql_insert_log, $ADO) or die(mysql_error());*/ $sql_insert_log = $ADO->GetInsertSQL($prep_rs_insert_log, $prep_rec_insert_log); $ADO->Execute($sql_insert_log); } if ($DREAMWEAVER_LCK_ON) { /* Finally, $stuff['modify_by'] determines state of the page */ if ($stuff['modify_by']) { /* File is checked out by user, pass back current check information */ $stuff['check_name'] = $lck_parts[0]; $stuff['check_email'] = $lck_parts[2]; } else { /* File is checked in by user, pass back last checked in information */ $stuff['check_name'] = $check_name; $stuff['check_email'] = $check_email; } } /* Set version ready for return */ $stuff['version'] = $version; /* Retrieve last modified time and format date */ $stuff['mdate'] = date('Y/m/d H:i:s T', filemtime($stuff['file'])); /* Send the page URI without any query strings */ $sort_uri = explode('?', $uri); $stuff['uri'] = $sort_uri[0]; /* Only run counter if it's on */ if ($COUNTER_ON) { /* Only update count if user has never been here */ $page_id = md5($self); if (! $_SESSION['get_pageversion_counted'][$page_id]) { $_SESSION['get_pageversion_counted'][$page_id] = true; /* 2003/08/08 -- 1.xx version, phase out *//* $sql_update_count = "UPDATE " . $TABLE . " SET count = '" . $count . "' WHERE file_name = '" . $self . "'";*/ $prep_sql_update_count = "SELECT * FROM " . $TABLE . " WHERE file_name = '" . $self . "'"; $prep_rs_update_count = $ADO->Execute($prep_sql_update_count); $prep_rec_update_count = array(); $prep_rec_update_count['count'] = $count; /* 2003/08/08 -- 1.xx version, phase out *//* mysql_query($sql_update_count, $ADO) or die(mysql_error());*/ $sql_update_count = $ADO->GetUpdateSQL($prep_rs_update_count, $prep_rec_update_count); $ADO->Execute($sql_update_count); $stuff['count'] = $count; } else { /* 2003/09/25 -- 1.xx version, phase out *//* $stuff['count'] = $row_select_log['count'];*/ $stuff['count'] = $rs_select_log->fields['count']; } } /* Return results */ return $stuff; } ?>