Skip to content

Instantly share code, notes, and snippets.

@Petah
Last active August 29, 2015 13:57
Show Gist options
  • Save Petah/9650636 to your computer and use it in GitHub Desktop.
Save Petah/9650636 to your computer and use it in GitHub Desktop.
Raptor behind authorisation
<?php require_once 'path/to/bootstrap.php'; ?>
<html>
<body>
<div class="editable" data-id="body">
<?= get_content('body'); ?>
</div>
<?php if (user_can_edit()): ?>
<script src="raptor.js"></script>
<script>
$('.editable').raptor({
...
});
</script>
<?php endif; ?>
</body>
</html>
<?php
require_once 'path/to/bootstrap.php';
if (!user_can_edit()) {
echo "You are not authorised to edit content.";
exit;
}
// save content here...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment