2015-05-05 01:00:01 +00:00
|
|
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
|
|
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
|
|
|
|
// Request $_POST
|
|
|
|
// type: page or post.
|
|
|
|
// text: Slug to valid.
|
|
|
|
// parent: Page parent, if you are checking a slug for a page.
|
|
|
|
|
|
|
|
// Response JSON
|
2016-02-09 20:02:51 -03:00
|
|
|
// slug: valid slug text
|
2015-05-05 01:00:01 +00:00
|
|
|
|
|
|
|
$text = isset($_POST['text']) ? $_POST['text'] : '';
|
|
|
|
$parent = isset($_POST['parent']) ? $_POST['parent'] : NO_PARENT_CHAR;
|
|
|
|
$key = isset($_POST['key']) ? $_POST['key'] : '';
|
|
|
|
|
|
|
|
if( $_POST['type']==='page' ) {
|
|
|
|
$slug = $dbPages->generateKey($text, $parent, true, $key);
|
|
|
|
}
|
|
|
|
elseif( $_POST['type']==='post' ) {
|
|
|
|
$slug = $dbPosts->generateKey($text, $key);
|
|
|
|
}
|
|
|
|
|
2016-09-25 23:30:06 -03:00
|
|
|
exit(json_encode(array(
|
|
|
|
'status'=>1,
|
|
|
|
'slug'=>$slug
|
|
|
|
)));
|
2015-05-05 01:00:01 +00:00
|
|
|
|
2016-01-20 22:46:13 -03:00
|
|
|
?>
|