Skip to content

Instantly share code, notes, and snippets.

@newism
Created September 22, 2009 13:19
Show Gist options
  • Save newism/191058 to your computer and use it in GitHub Desktop.
Save newism/191058 to your computer and use it in GitHub Desktop.
function update_last_revision($entry_id)
{
global $DB, $IN;
$weblog_id = $IN->GBL('weblog_id');
$query = $DB->query("SELECT
enable_versioning,
enable_qucksave_versioning
FROM exp_weblogs
WHERE weblog_id = '".$weblog_id
);
$enable_versioning = $query->row['enable_versioning'];
$enable_qucksave_versioning = $query->row['enable_qucksave_versioning'];
if ( ! isset($_POST['versioning_enabled']))
$enable_versioning = 'n';
if (isset($_POST['save']) AND $enable_qucksave_versioning == 'n')
$enable_versioning = 'n';
if ($enable_versioning == 'y')
$DB->query("UPDATE `exp_entry_versioning`
SET `version_data` = '".addslashes(serialize($_POST))."'
WHERE `entry_id` = {$entry_id}
ORDER BY `version_id` DESC
LIMIT 1");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment