-
Notifications
You must be signed in to change notification settings - Fork 31
/
new-post.php
122 lines (111 loc) · 4.29 KB
/
new-post.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php include "core/init.php";
protect_page();
?>
<!DOCTYPE HTML>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<html class="screen-scroll wf-fftisawebpro-i4-active wf-fftisawebpro-i7-active wf-fftisawebpro-n4-active wf-fftisawebpro-n7-active wf-freightsanspro-n5-active wf-freightsanspro-n7-active wf-active">
<head>
<title>Broomble - New Post</title>
<link href="css/new-post.css" rel="stylesheet" type="text/css" media="screen">
<script src="/medium/js/jquery.min.js"></script>
</head>
<?php $prop = md5(time());?>
<body>
<div class="site-nav-overlay"></div>
<button class="site-nav-logo"><span class="icons icons-logo-m"></span></button>
<div class="container" id="container">
<div class="screen-content" id="prerendered">
<article class="post-article grid-breaking ">
<div class="metabar active">
<section class="metabar-status"><span class="metabar-message metabar-error"></span></section>
<div class="metabar-actions metabar-mode-edit">
<ul class="metabar-actions-btns">
<li>
<button title="Save Draft" class="btn btn-small" data-action="save-draft">Save Draft</button>
</li>
<li>
<button title="Publish" class="btn btn-primary btn-small btn-publish" data-action="publish">Publish</button>
</li>
</ul>
</div>
</div>
<section class="post-page-wrapper post-page-wrapper-contain">
<div class="post-content">
<div class="post-content-inner">
<div class="notes-source">
<header class="post-header post-header-headline">
<h1 class="post-title editable default-value" id="post_title_<?=$prop?>" name="title" itemprop="name" g_editable="true" role="textbox" contenteditable="true" data-placeholder='Type your title'></h1>
<h2 class="post-field subtitle editable default-value" name="subtitle" g_editable="true" role="textbox" contenteditable="true" data-placeholder='Type your subtitle (optional)'></h2>
<p class="post-field content editable default-value" name="subtitle" g_editable="true" role="textbox" contenteditable="true" data-placeholder='Type your post'></p>
</header>
</div>
</div>
<div class="post-follow-ups post-supplemental"></div>
</div>
</div>
</div>
</section>
</article>
</div>
</div>
<link rel="stylesheet" href="/medium/css/medium.editor.css">
<script src="/medium/js/medium.editor.js"></script>
<script>
$( document ).ready(function() {
var editor = new MediumEditor('.editable');
});
$('button').click(function(e) {
var val = $(this).data( "action" );
switch (val) {
case 'save-draft' :
$('button[data-action="save-draft"]').attr("disabled", "disabled");
var post_title = $('#post_title_<?=$prop?>').text();
var post_sub = $('.subtitle').text();
var post_data = $('.content').html();
var post_view = 0;
if(post_title != ""){
$(".metabar-message").css('display','').html('Saving..');
var dataString = 'post_title=' + post_title + '&post_sub=' + post_sub + '&post_data=' + post_data + '&post_view=' + post_view;
alert(dataString);
$.ajax({
type: "POST",
url: "ajax/post_p.php",
data: dataString,
cache: false,
success: function(response){
$(".metabar-message").html('Saved');
window.location = "index.php";
}
});
}else{
$(".metabar-error").text('Error!');
}
break;
case 'publish' :
var post_title = $('#post_title_<?=$prop?>').text();
var post_sub = $('.subtitle').text();
var post_data = $('.content').html();
var post_view = 1;
if(post_title != "" && post_data != ""){
$(".metabar-message").css('display','').html('Publishing..');
var dataString = 'post_title=' + post_title + '&post_sub=' + post_sub + '&post_data=' + post_data + '&post_view=' + post_view;
alert(dataString);
$.ajax({
type: "POST",
url: "ajax/post_p.php",
data: dataString,
cache: false,
success: function(response){
$(".metabar-message").html('Published');
window.location = "index.php";
}
});
}else{
$(".metabar-error").text('Error!');
}
break;
}
});
</script>
</body>
</html>