Browse Source

Content Type

Trying to add content type: image, video, audio, link, and quote. No
styling yet.
pull/189/head
Danang Probo Sayekti 10 years ago
parent
commit
dd6942e439
27 changed files with 3011 additions and 105 deletions
  1. +848
    -22
      system/admin/admin.php
  2. +130
    -0
      system/admin/views/add-audio.html.php
  3. +130
    -0
      system/admin/views/add-image.html.php
  4. +130
    -0
      system/admin/views/add-link.html.php
  5. +1
    -1
      system/admin/views/add-page.html.php
  6. +0
    -7
      system/admin/views/add-post.html.php
  7. +130
    -0
      system/admin/views/add-quote.html.php
  8. +130
    -0
      system/admin/views/add-video.html.php
  9. +9
    -0
      system/admin/views/content-type.html.php
  10. +167
    -0
      system/admin/views/edit-audio.html.php
  11. +167
    -0
      system/admin/views/edit-image.html.php
  12. +167
    -0
      system/admin/views/edit-link.html.php
  13. +13
    -3
      system/admin/views/edit-page.html.php
  14. +3
    -6
      system/admin/views/edit-post.html.php
  15. +167
    -0
      system/admin/views/edit-quote.html.php
  16. +167
    -0
      system/admin/views/edit-video.html.php
  17. +517
    -23
      system/htmly.php
  18. +6
    -4
      system/includes/functions.php
  19. +2
    -2
      themes/clean/css/style.css
  20. +17
    -2
      themes/clean/main.html.php
  21. +25
    -10
      themes/clean/post.html.php
  22. +2
    -2
      themes/default/css/style.css
  23. +17
    -2
      themes/default/main.html.php
  24. +25
    -10
      themes/default/post.html.php
  25. +2
    -2
      themes/logs/css/style.css
  26. +15
    -0
      themes/logs/main.html.php
  27. +24
    -9
      themes/logs/post.html.php

+ 848
- 22
system/admin/admin.php View File

@ -86,7 +86,7 @@ function remove_accent($str)
}
// Edit blog posts
function edit_post($title, $tag, $url, $content, $oldfile, $destination = null, $description = null, $date = null, $img, $vid, $revertPost, $publishDraft)
function edit_post($title, $tag, $url, $content, $oldfile, $destination = null, $description = null, $date = null, $revertPost, $publishDraft)
{
$oldurl = explode('_', $oldfile);
$dir = explode('/', $oldurl[0]);
@ -97,8 +97,6 @@ function edit_post($title, $tag, $url, $content, $oldfile, $destination = null,
}
$post_title = $title;
$post_img = $img;
$post_vid = str_replace(array("http://", "https://", "www.", "youtube", ".com", "/watch?v=", "/embed/"), "", $vid);
$post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag));
$post_tag = rtrim($post_tag, ',');
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
@ -106,18 +104,578 @@ function edit_post($title, $tag, $url, $content, $oldfile, $destination = null,
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_description = "";
}
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description ."\n\n" . $content;
if (!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) {
if (get_magic_quotes_gpc()) {
$post_content = stripslashes($post_content);
}
if(!empty($revertPost) || !empty($publishDraft)) {
$dirBlog = $dir[0] . '/' . $dir[1] . '/blog/';
$dirDraft = $dir[0] . '/' . $dir[1] . '/draft/';
if($dir[2] == 'draft') {
$filename = $dirBlog . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
} else {
$filename = $dirDraft . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
}
if (is_dir($dirBlog)) {
} else {
mkdir($dirBlog, 0775, true);
}
if (is_dir($dirDraft)) {
} else {
mkdir($dirDraft, 0775, true);
}
file_put_contents($filename, print_r($post_content, true));
unlink($oldfile);
$newfile = $olddate . '_' . $post_tag . '_' . $post_url . '.md';
} else {
$newfile = $oldurl[0] . '_' . $post_tag . '_' . $post_url . '.md';
if ($oldfile === $newfile) {
file_put_contents($oldfile, print_r($post_content, true));
} else {
rename($oldfile, $newfile);
file_put_contents($newfile, print_r($post_content, true));
}
}
if(!empty($publishDraft)) {
$dt = $olddate;
$t = str_replace('-', '', $dt);
$time = new DateTime($t);
$timestamp = $time->format("Y-m-d");
} else {
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
$dt = str_replace($replaced, '', $oldurl[0]);
$t = str_replace('-', '', $dt);
$time = new DateTime($t);
$timestamp = $time->format("Y-m-d");
}
// The post date
$postdate = strtotime($timestamp);
// The post URL
$posturl = site_url() . date('Y/m', $postdate) . '/' . $post_url;
rebuilt_cache('all');
clear_post_cache($dt, $post_tag, $post_url, $newfile);
if ($destination == 'post') {
if(!empty($revertPost)) {
$drafturl = site_url() . 'admin/draft';
header("Location: $drafturl");
} else {
header("Location: $posturl");
}
} else {
if(!empty($publishDraft)) {
header("Location: $posturl");
} elseif (!empty($revertPost)) {
$drafturl = site_url() . 'admin/draft';
header("Location: $drafturl");
} else {
$redirect = site_url() . $destination;
header("Location: $redirect");
}
}
}
}
// Edit image posts
function edit_image($title, $tag, $url, $content, $oldfile, $destination = null, $description = null, $date = null, $image, $revertPost, $publishDraft)
{
$oldurl = explode('_', $oldfile);
$dir = explode('/', $oldurl[0]);
$olddate = date('Y-m-d-h-i-s', strtotime($date));
if ($date !== null) {
$oldurl[0] = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/' . $olddate;
}
$post_title = $title;
$post_image = $image;
$post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag));
$post_tag = rtrim($post_tag, ',');
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
if ($description !== null) {
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_description = "";
}
if ($image !== null) {
$post_image = "\n<!--image " . $post_image. " image-->";
} else {
$post_image = "";
}
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description . $post_image ."\n\n" . $content;
if (!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) {
if (get_magic_quotes_gpc()) {
$post_content = stripslashes($post_content);
}
if(!empty($revertPost) || !empty($publishDraft)) {
$dirBlog = $dir[0] . '/' . $dir[1] . '/blog/';
$dirDraft = $dir[0] . '/' . $dir[1] . '/draft/';
if($dir[2] == 'draft') {
$filename = $dirBlog . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
} else {
$filename = $dirDraft . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
}
if (is_dir($dirBlog)) {
} else {
mkdir($dirBlog, 0775, true);
}
if (is_dir($dirDraft)) {
} else {
mkdir($dirDraft, 0775, true);
}
file_put_contents($filename, print_r($post_content, true));
unlink($oldfile);
$newfile = $olddate . '_' . $post_tag . '_' . $post_url . '.md';
} else {
$newfile = $oldurl[0] . '_' . $post_tag . '_' . $post_url . '.md';
if ($oldfile === $newfile) {
file_put_contents($oldfile, print_r($post_content, true));
} else {
rename($oldfile, $newfile);
file_put_contents($newfile, print_r($post_content, true));
}
}
if(!empty($publishDraft)) {
$dt = $olddate;
$t = str_replace('-', '', $dt);
$time = new DateTime($t);
$timestamp = $time->format("Y-m-d");
} else {
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
$dt = str_replace($replaced, '', $oldurl[0]);
$t = str_replace('-', '', $dt);
$time = new DateTime($t);
$timestamp = $time->format("Y-m-d");
}
// The post date
$postdate = strtotime($timestamp);
// The post URL
$posturl = site_url() . date('Y/m', $postdate) . '/' . $post_url;
rebuilt_cache('all');
clear_post_cache($dt, $post_tag, $post_url, $newfile);
if ($destination == 'post') {
if(!empty($revertPost)) {
$drafturl = site_url() . 'admin/draft';
header("Location: $drafturl");
} else {
header("Location: $posturl");
}
} else {
if(!empty($publishDraft)) {
header("Location: $posturl");
} elseif (!empty($revertPost)) {
$drafturl = site_url() . 'admin/draft';
header("Location: $drafturl");
} else {
$redirect = site_url() . $destination;
header("Location: $redirect");
}
}
}
}
// Edit video posts
function edit_video($title, $tag, $url, $content, $oldfile, $destination = null, $description = null, $date = null, $video, $revertPost, $publishDraft)
{
$oldurl = explode('_', $oldfile);
$dir = explode('/', $oldurl[0]);
$olddate = date('Y-m-d-h-i-s', strtotime($date));
if ($date !== null) {
$oldurl[0] = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/' . $olddate;
}
$post_title = $title;
$post_video = $video;
$post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag));
$post_tag = rtrim($post_tag, ',');
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
if ($description !== null) {
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_description = "";
}
if ($video !== null) {
$post_video = "\n<!--video " . $post_video . " video-->";
} else {
$post_video = "";
}
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description . $post_video ."\n\n" . $content;
if (!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) {
if (get_magic_quotes_gpc()) {
$post_content = stripslashes($post_content);
}
if(!empty($revertPost) || !empty($publishDraft)) {
$dirBlog = $dir[0] . '/' . $dir[1] . '/blog/';
$dirDraft = $dir[0] . '/' . $dir[1] . '/draft/';
if($dir[2] == 'draft') {
$filename = $dirBlog . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
} else {
$filename = $dirDraft . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
}
if (is_dir($dirBlog)) {
} else {
mkdir($dirBlog, 0775, true);
}
if (is_dir($dirDraft)) {
} else {
mkdir($dirDraft, 0775, true);
}
file_put_contents($filename, print_r($post_content, true));
unlink($oldfile);
$newfile = $olddate . '_' . $post_tag . '_' . $post_url . '.md';
} else {
$newfile = $oldurl[0] . '_' . $post_tag . '_' . $post_url . '.md';
if ($oldfile === $newfile) {
file_put_contents($oldfile, print_r($post_content, true));
} else {
rename($oldfile, $newfile);
file_put_contents($newfile, print_r($post_content, true));
}
}
if(!empty($publishDraft)) {
$dt = $olddate;
$t = str_replace('-', '', $dt);
$time = new DateTime($t);
$timestamp = $time->format("Y-m-d");
} else {
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
$dt = str_replace($replaced, '', $oldurl[0]);
$t = str_replace('-', '', $dt);
$time = new DateTime($t);
$timestamp = $time->format("Y-m-d");
}
// The post date
$postdate = strtotime($timestamp);
// The post URL
$posturl = site_url() . date('Y/m', $postdate) . '/' . $post_url;
rebuilt_cache('all');
clear_post_cache($dt, $post_tag, $post_url, $newfile);
if ($destination == 'post') {
if(!empty($revertPost)) {
$drafturl = site_url() . 'admin/draft';
header("Location: $drafturl");
} else {
header("Location: $posturl");
}
} else {
if(!empty($publishDraft)) {
header("Location: $posturl");
} elseif (!empty($revertPost)) {
$drafturl = site_url() . 'admin/draft';
header("Location: $drafturl");
} else {
$redirect = site_url() . $destination;
header("Location: $redirect");
}
}
}
}
// Edit image posts
function edit_link($title, $tag, $url, $content, $oldfile, $destination = null, $description = null, $date = null, $link, $revertPost, $publishDraft)
{
$oldurl = explode('_', $oldfile);
$dir = explode('/', $oldurl[0]);
$olddate = date('Y-m-d-h-i-s', strtotime($date));
if ($date !== null) {
$oldurl[0] = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/' . $olddate;
}
$post_title = $title;
$post_link = $link;
$post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag));
$post_tag = rtrim($post_tag, ',');
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
if ($description !== null) {
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_description = "";
}
if ($link !== null) {
$post_link = "\n<!--link" . $post_link. " img-->";
} else {
$post_link = "";
}
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description . $post_link ."\n\n" . $content;
if (!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) {
if (get_magic_quotes_gpc()) {
$post_content = stripslashes($post_content);
}
if(!empty($revertPost) || !empty($publishDraft)) {
$dirBlog = $dir[0] . '/' . $dir[1] . '/blog/';
$dirDraft = $dir[0] . '/' . $dir[1] . '/draft/';
if($dir[2] == 'draft') {
$filename = $dirBlog . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
} else {
$filename = $dirDraft . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
}
if (is_dir($dirBlog)) {
} else {
mkdir($dirBlog, 0775, true);
}
if (is_dir($dirDraft)) {
} else {
mkdir($dirDraft, 0775, true);
}
file_put_contents($filename, print_r($post_content, true));
unlink($oldfile);
$newfile = $olddate . '_' . $post_tag . '_' . $post_url . '.md';
} else {
$newfile = $oldurl[0] . '_' . $post_tag . '_' . $post_url . '.md';
if ($oldfile === $newfile) {
file_put_contents($oldfile, print_r($post_content, true));
} else {
rename($oldfile, $newfile);
file_put_contents($newfile, print_r($post_content, true));
}
}
if(!empty($publishDraft)) {
$dt = $olddate;
$t = str_replace('-', '', $dt);
$time = new DateTime($t);
$timestamp = $time->format("Y-m-d");
} else {
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
$dt = str_replace($replaced, '', $oldurl[0]);
$t = str_replace('-', '', $dt);
$time = new DateTime($t);
$timestamp = $time->format("Y-m-d");
}
// The post date
$postdate = strtotime($timestamp);
// The post URL
$posturl = site_url() . date('Y/m', $postdate) . '/' . $post_url;
rebuilt_cache('all');
clear_post_cache($dt, $post_tag, $post_url, $newfile);
if ($destination == 'post') {
if(!empty($revertPost)) {
$drafturl = site_url() . 'admin/draft';
header("Location: $drafturl");
} else {
header("Location: $posturl");
}
} else {
if(!empty($publishDraft)) {
header("Location: $posturl");
} elseif (!empty($revertPost)) {
$drafturl = site_url() . 'admin/draft';
header("Location: $drafturl");
} else {
$redirect = site_url() . $destination;
header("Location: $redirect");
}
}
}
}
// Edit quote posts
function edit_quote($title, $tag, $url, $content, $oldfile, $destination = null, $description = null, $date = null, $quote, $revertPost, $publishDraft)
{
$oldurl = explode('_', $oldfile);
$dir = explode('/', $oldurl[0]);
$olddate = date('Y-m-d-h-i-s', strtotime($date));
if ($date !== null) {
$oldurl[0] = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/' . $olddate;
}
$post_title = $title;
$post_quote = $quote;
$post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag));
$post_tag = rtrim($post_tag, ',');
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
if ($description !== null) {
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_description = "";
}
if ($quote !== null) {
$post_quote = "\n<!--quote" . $post_quote . " quote-->";
} else {
$post_quote = "";
}
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description . $post_quote ."\n\n" . $content;
if (!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) {
if (get_magic_quotes_gpc()) {
$post_content = stripslashes($post_content);
}
if(!empty($revertPost) || !empty($publishDraft)) {
$dirBlog = $dir[0] . '/' . $dir[1] . '/blog/';
$dirDraft = $dir[0] . '/' . $dir[1] . '/draft/';
if($dir[2] == 'draft') {
$filename = $dirBlog . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
} else {
$filename = $dirDraft . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
}
if (is_dir($dirBlog)) {
} else {
mkdir($dirBlog, 0775, true);
}
if (is_dir($dirDraft)) {
} else {
mkdir($dirDraft, 0775, true);
}
file_put_contents($filename, print_r($post_content, true));
unlink($oldfile);
$newfile = $olddate . '_' . $post_tag . '_' . $post_url . '.md';
} else {
$newfile = $oldurl[0] . '_' . $post_tag . '_' . $post_url . '.md';
if ($oldfile === $newfile) {
file_put_contents($oldfile, print_r($post_content, true));
} else {
rename($oldfile, $newfile);
file_put_contents($newfile, print_r($post_content, true));
}
}
if(!empty($publishDraft)) {
$dt = $olddate;
$t = str_replace('-', '', $dt);
$time = new DateTime($t);
$timestamp = $time->format("Y-m-d");
} else {
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
$dt = str_replace($replaced, '', $oldurl[0]);
$t = str_replace('-', '', $dt);
$time = new DateTime($t);
$timestamp = $time->format("Y-m-d");
}
// The post date
$postdate = strtotime($timestamp);
// The post URL
$posturl = site_url() . date('Y/m', $postdate) . '/' . $post_url;
rebuilt_cache('all');
clear_post_cache($dt, $post_tag, $post_url, $newfile);
if ($destination == 'post') {
if(!empty($revertPost)) {
$drafturl = site_url() . 'admin/draft';
header("Location: $drafturl");
} else {
header("Location: $posturl");
}
} else {
if(!empty($publishDraft)) {
header("Location: $posturl");
} elseif (!empty($revertPost)) {
$drafturl = site_url() . 'admin/draft';
header("Location: $drafturl");
} else {
$redirect = site_url() . $destination;
header("Location: $redirect");
}
}
}
}
// Edit audio posts
function edit_audio($title, $tag, $url, $content, $oldfile, $destination = null, $description = null, $date = null, $audio, $revertPost, $publishDraft)
{
$oldurl = explode('_', $oldfile);
$dir = explode('/', $oldurl[0]);
$olddate = date('Y-m-d-h-i-s', strtotime($date));
if ($date !== null) {
$oldurl[0] = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/' . $olddate;
}
if ($img !== null) {
$post_img = "\n<!--img " . $post_img. " img-->";
$post_title = $title;
$post_audio = $audio;
$post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag));
$post_tag = rtrim($post_tag, ',');
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
if ($description !== null) {
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_img = "";
$post_description = "";
}
if ($vid !== null) {
$post_vid = "\n<!--vid " . $post_vid. " vid-->";
if ($audio !== null) {
$post_audio = "\n<!--audio" . $post_audio . " audio-->";
} else {
$post_vid = "";
}
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description . $post_img . $post_vid ."\n\n" . $content;
$post_audio = "";
}
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description . $post_audio ."\n\n" . $content;
if (!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) {
@ -244,14 +802,231 @@ function edit_page($title, $url, $content, $oldfile, $destination = null, $descr
}
}
// Add blog post
function add_post($title, $tag, $url, $content, $user, $description = null, $img, $vid, $draft)
// Add post
function add_post($title, $tag, $url, $content, $user, $description = null, $draft)
{
$post_date = date('Y-m-d-H-i-s');
$post_title = $title;
$post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag));
$post_tag = rtrim($post_tag, ',');
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
if ($description !== null) {
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_description = "";
}
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description ."\n\n" . $content;
if (!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) {
if (get_magic_quotes_gpc()) {
$post_content = stripslashes($post_content);
}
$filename = $post_date . '_' . $post_tag . '_' . $post_url . '.md';
if (empty($draft)) {
$dir = 'content/' . $user . '/blog/';
} else {
$dir = 'content/' . $user . '/draft/';
}
if (is_dir($dir)) {
file_put_contents($dir . $filename, print_r($post_content, true));
} else {
mkdir($dir, 0775, true);
file_put_contents($dir . $filename, print_r($post_content, true));
}
rebuilt_cache('all');
clear_post_cache($post_date, $post_tag, $post_url, $dir . $filename);
if (empty($draft)) {
$redirect = site_url() . 'admin/mine';
} else {
$redirect = site_url() . 'admin/draft';
}
header("Location: $redirect");
}
}
// Add image
function add_image($title, $tag, $url, $content, $user, $description = null, $image, $draft)
{
$post_date = date('Y-m-d-H-i-s');
$post_title = $title;
$post_image = $image;
$post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag));
$post_tag = rtrim($post_tag, ',');
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
if ($description !== null) {
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_description = "";
}
if ($image !== null) {
$post_image = "\n<!--image " . $post_image. " image-->";
} else {
$post_image = "";
}
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description . $post_image ."\n\n" . $content;
if (!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) {
if (get_magic_quotes_gpc()) {
$post_content = stripslashes($post_content);
}
$filename = $post_date . '_' . $post_tag . '_' . $post_url . '.md';
if (empty($draft)) {
$dir = 'content/' . $user . '/blog/';
} else {
$dir = 'content/' . $user . '/draft/';
}
if (is_dir($dir)) {
file_put_contents($dir . $filename, print_r($post_content, true));
} else {
mkdir($dir, 0775, true);
file_put_contents($dir . $filename, print_r($post_content, true));
}
rebuilt_cache('all');
clear_post_cache($post_date, $post_tag, $post_url, $dir . $filename);
if (empty($draft)) {
$redirect = site_url() . 'admin/mine';
} else {
$redirect = site_url() . 'admin/draft';
}
header("Location: $redirect");
}
}
// Add video
function add_video($title, $tag, $url, $content, $user, $description = null, $video, $draft)
{
$post_date = date('Y-m-d-H-i-s');
$post_title = $title;
$post_video = $video;
$post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag));
$post_tag = rtrim($post_tag, ',');
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
if ($description !== null) {
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_description = "";
}
if ($video !== null) {
$post_video = "\n<!--video " . $post_video . " video-->";
} else {
$post_video = "";
}
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description . $post_video ."\n\n" . $content;
if (!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) {
if (get_magic_quotes_gpc()) {
$post_content = stripslashes($post_content);
}
$filename = $post_date . '_' . $post_tag . '_' . $post_url . '.md';
if (empty($draft)) {
$dir = 'content/' . $user . '/blog/';
} else {
$dir = 'content/' . $user . '/draft/';
}
if (is_dir($dir)) {
file_put_contents($dir . $filename, print_r($post_content, true));
} else {
mkdir($dir, 0775, true);
file_put_contents($dir . $filename, print_r($post_content, true));
}
rebuilt_cache('all');
clear_post_cache($post_date, $post_tag, $post_url, $dir . $filename);
if (empty($draft)) {
$redirect = site_url() . 'admin/mine';
} else {
$redirect = site_url() . 'admin/draft';
}
header("Location: $redirect");
}
}
// Add audio
function add_audio($title, $tag, $url, $content, $user, $description = null, $audio, $draft)
{
$post_date = date('Y-m-d-H-i-s');
$post_title = $title;
$post_audio = $audio;
$post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag));
$post_tag = rtrim($post_tag, ',');
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
if ($description !== null) {
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_description = "";
}
if ($audio !== null) {
$post_audio = "\n<!--audio " . $post_audio . " audio-->";
} else {
$post_audio = "";
}
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description . $post_audio ."\n\n" . $content;
if (!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) {
if (get_magic_quotes_gpc()) {
$post_content = stripslashes($post_content);
}
$filename = $post_date . '_' . $post_tag . '_' . $post_url . '.md';
if (empty($draft)) {
$dir = 'content/' . $user . '/blog/';
} else {
$dir = 'content/' . $user . '/draft/';
}
if (is_dir($dir)) {
file_put_contents($dir . $filename, print_r($post_content, true));
} else {
mkdir($dir, 0775, true);
file_put_contents($dir . $filename, print_r($post_content, true));
}
rebuilt_cache('all');
clear_post_cache($post_date, $post_tag, $post_url, $dir . $filename);
if (empty($draft)) {
$redirect = site_url() . 'admin/mine';
} else {
$redirect = site_url() . 'admin/draft';
}
header("Location: $redirect");
}
}
// Add link
function add_link($title, $tag, $url, $content, $user, $description = null, $link, $draft)
{
$post_date = date('Y-m-d-H-i-s');
$post_title = $title;
$post_img = $img;
$post_vid = str_replace(array("http://", "https://", "www.", "youtube", ".com", "/watch?v=", "/embed/"), "", $vid);
$post_link = $link;
$post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag));
$post_tag = rtrim($post_tag, ',');
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
@ -260,17 +1035,68 @@ function add_post($title, $tag, $url, $content, $user, $description = null, $img
} else {
$post_description = "";
}
if ($img !== null) {
$post_img = "\n<!--img " . $post_img. " img-->";
if ($link !== null) {
$post_link = "\n<!--link " . $post_link . " link-->";
} else {
$post_link = "";
}
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description . $post_link ."\n\n" . $content;
if (!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) {
if (get_magic_quotes_gpc()) {
$post_content = stripslashes($post_content);
}
$filename = $post_date . '_' . $post_tag . '_' . $post_url . '.md';
if (empty($draft)) {
$dir = 'content/' . $user . '/blog/';
} else {
$dir = 'content/' . $user . '/draft/';
}
if (is_dir($dir)) {
file_put_contents($dir . $filename, print_r($post_content, true));
} else {
mkdir($dir, 0775, true);
file_put_contents($dir . $filename, print_r($post_content, true));
}
rebuilt_cache('all');
clear_post_cache($post_date, $post_tag, $post_url, $dir . $filename);
if (empty($draft)) {
$redirect = site_url() . 'admin/mine';
} else {
$redirect = site_url() . 'admin/draft';
}
header("Location: $redirect");
}
}
// Add quote
function add_quote($title, $tag, $url, $content, $user, $description = null, $quote, $draft)
{
$post_date = date('Y-m-d-H-i-s');
$post_title = $title;
$post_quote = $quote;
$post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag));
$post_tag = rtrim($post_tag, ',');
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
if ($description !== null) {
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_img = "";
$post_description = "";
}
if ($vid !== null) {
$post_vid = "\n<!--vid " . $post_vid. " vid-->";
if ($quote !== null) {
$post_quote = "\n<!--quote " . $post_quote . " quote-->";
} else {
$post_vid = "";
$post_quote = "";
}
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description . $post_img . $post_vid ."\n\n" . $content;
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description . $post_quote ."\n\n" . $content;
if (!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) {


+ 130
- 0
system/admin/views/add-audio.html.php View File

@ -0,0 +1,130 @@
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
<?php if (config("jquery") != "enable"):?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<?php endif;?>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
<?php if (isset($error)) { ?>
<div class="error-message"><?php echo $error ?></div>
<?php } ?>
<div class="wmd-panel">
<form method="POST">
Title <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTitle)) {
if (empty($postTitle)) {
echo 'error';
}
} ?>" name="title" value="<?php if (isset($postTitle)) {
echo $postTitle;
} ?>"/><br><br>
Tag <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTag)) {
if (empty($postTag)) {
echo 'error';
}
} ?>" name="tag" value="<?php if (isset($postTag)) {
echo $postTag;
} ?>"/><br><br>
Url (optional)<br><input type="text" class="text" name="url" value="<?php if (isset($postUrl)) {
echo $postUrl;
} ?>"/><br>
<span class="help">If the url leave empty we will use the post title.</span><br><br>
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
echo $p->description;
} ?></textarea>
<br><br>
Featured Audio <span class="required">*</span> (SoundCloud Only)<br><textarea maxlength="200" class="text <?php if (isset($postAudio)) {
if (empty($postAudio)) {
echo 'error';
}
} ?>" name="audio"><?php if (isset($postAudio)) {
echo $postAudio;
} ?></textarea><br><br>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
if (empty($postContent)) {
echo 'error';
}
} ?>" name="content" cols="20" rows="10"><?php if (isset($postContent)) {
echo $postContent;
} ?></textarea><br/>
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
<input type="submit" name="publish" class="submit" value="Publish"/> <input type="submit" name="draft" class="draft" value="Save as draft"/>
</form>
</div>
<div id="insertImageDialog" title="Insert Image">
<h4>URL</h4>
<input type="text" placeholder="Enter image URL" />
<h4>Upload</h4>
<form method="post" action="" enctype="multipart/form-data">
<input type="file" name="file" id="file" />
</form>
<style>
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
.wmd-prompt-background {z-index:10!important;}
</style>
</div>
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
<script type="text/javascript">
(function () {
var converter = new Markdown.Converter();
var editor = new Markdown.Editor(converter);
var $dialog = $('#insertImageDialog').dialog({
autoOpen: false,
closeOnEscape: false,
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
});
var $url = $('input[type=text]', $dialog);
var $file = $('input[type=file]', $dialog);
var base = '<?php echo site_url() ?>';
editor.hooks.set('insertImageDialog', function(callback) {
var dialogInsertClick = function() {
callback($url.val().length > 0 ? $url.val(): null);
dialogClose();
};
var dialogCancelClick = function() {
dialogClose();
callback(null);
};
var dialogClose = function() {
$url.val('');
$file.val('');
$dialog.dialog('close');
};
$dialog.dialog( 'option', 'buttons', {
'Insert': dialogInsertClick,
'Cancel': dialogCancelClick
});
var uploadComplete = function(response) {
if (response.error == '0') {
$url.val(base + response.path);
} else {
alert(response.error);
$file.val('');
}
};
$file.ajaxfileupload({
'action': '<?php echo site_url() ?>upload.php',
'onComplete': uploadComplete,
});
$dialog.dialog('open');
return true; // tell the editor that we'll take care of getting the image url
});
editor.run();
})();
</script>

+ 130
- 0
system/admin/views/add-image.html.php View File

@ -0,0 +1,130 @@
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
<?php if (config("jquery") != "enable"):?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<?php endif;?>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
<?php if (isset($error)) { ?>
<div class="error-message"><?php echo $error ?></div>
<?php } ?>
<div class="wmd-panel">
<form method="POST">
Title <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTitle)) {
if (empty($postTitle)) {
echo 'error';
}
} ?>" name="title" value="<?php if (isset($postTitle)) {
echo $postTitle;
} ?>"/><br><br>
Tag <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTag)) {
if (empty($postTag)) {
echo 'error';
}
} ?>" name="tag" value="<?php if (isset($postTag)) {
echo $postTag;
} ?>"/><br><br>
Url (optional)<br><input type="text" class="text" name="url" value="<?php if (isset($postUrl)) {
echo $postUrl;
} ?>"/><br>
<span class="help">If the url leave empty we will use the post title.</span><br><br>
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
echo $p->description;
} ?></textarea>
<br><br>
Featured Image <span class="required">*</span> <br><textarea maxlength="200" class="text <?php if (isset($postImage)) {
if (empty($postImage)) {
echo 'error';
}
} ?>" name="image"><?php if (isset($postImage)) {
echo $postImage;
} ?></textarea><br><br>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
if (empty($postContent)) {
echo 'error';
}
} ?>" name="content" cols="20" rows="10"><?php if (isset($postContent)) {
echo $postContent;
} ?></textarea><br/>
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
<input type="submit" name="publish" class="submit" value="Publish"/> <input type="submit" name="draft" class="draft" value="Save as draft"/>
</form>
</div>
<div id="insertImageDialog" title="Insert Image">
<h4>URL</h4>
<input type="text" placeholder="Enter image URL" />
<h4>Upload</h4>
<form method="post" action="" enctype="multipart/form-data">
<input type="file" name="file" id="file" />
</form>
<style>
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
.wmd-prompt-background {z-index:10!important;}
</style>
</div>
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
<script type="text/javascript">
(function () {
var converter = new Markdown.Converter();
var editor = new Markdown.Editor(converter);
var $dialog = $('#insertImageDialog').dialog({
autoOpen: false,
closeOnEscape: false,
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
});
var $url = $('input[type=text]', $dialog);
var $file = $('input[type=file]', $dialog);
var base = '<?php echo site_url() ?>';
editor.hooks.set('insertImageDialog', function(callback) {
var dialogInsertClick = function() {
callback($url.val().length > 0 ? $url.val(): null);
dialogClose();
};
var dialogCancelClick = function() {
dialogClose();
callback(null);
};
var dialogClose = function() {
$url.val('');
$file.val('');
$dialog.dialog('close');
};
$dialog.dialog( 'option', 'buttons', {
'Insert': dialogInsertClick,
'Cancel': dialogCancelClick
});
var uploadComplete = function(response) {
if (response.error == '0') {
$url.val(base + response.path);
} else {
alert(response.error);
$file.val('');
}
};
$file.ajaxfileupload({
'action': '<?php echo site_url() ?>upload.php',
'onComplete': uploadComplete,
});
$dialog.dialog('open');
return true; // tell the editor that we'll take care of getting the image url
});
editor.run();
})();
</script>

+ 130
- 0
system/admin/views/add-link.html.php View File

@ -0,0 +1,130 @@
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
<?php if (config("jquery") != "enable"):?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<?php endif;?>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
<?php if (isset($error)) { ?>
<div class="error-message"><?php echo $error ?></div>
<?php } ?>
<div class="wmd-panel">
<form method="POST">
Title <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTitle)) {
if (empty($postTitle)) {
echo 'error';
}
} ?>" name="title" value="<?php if (isset($postTitle)) {
echo $postTitle;
} ?>"/><br><br>
Tag <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTag)) {
if (empty($postTag)) {
echo 'error';
}
} ?>" name="tag" value="<?php if (isset($postTag)) {
echo $postTag;
} ?>"/><br><br>
Url (optional)<br><input type="text" class="text" name="url" value="<?php if (isset($postUrl)) {
echo $postUrl;
} ?>"/><br>
<span class="help">If the url leave empty we will use the post title.</span><br><br>
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
echo $p->description;
} ?></textarea>
<br><br>
Featured Link <span class="required">*</span> <br><textarea maxlength="200" class="text <?php if (isset($postLink)) {
if (empty($postLink)) {
echo 'error';
}
} ?>" name="link" ><?php if (isset($postLink)) {
echo $postLink;
} ?></textarea><br><br>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
if (empty($postContent)) {
echo 'error';
}
} ?>" name="content" cols="20" rows="10"><?php if (isset($postContent)) {
echo $postContent;
} ?></textarea><br/>
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
<input type="submit" name="publish" class="submit" value="Publish"/> <input type="submit" name="draft" class="draft" value="Save as draft"/>
</form>
</div>
<div id="insertImageDialog" title="Insert Image">
<h4>URL</h4>
<input type="text" placeholder="Enter image URL" />
<h4>Upload</h4>
<form method="post" action="" enctype="multipart/form-data">
<input type="file" name="file" id="file" />
</form>
<style>
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
.wmd-prompt-background {z-index:10!important;}
</style>
</div>
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
<script type="text/javascript">
(function () {
var converter = new Markdown.Converter();
var editor = new Markdown.Editor(converter);
var $dialog = $('#insertImageDialog').dialog({
autoOpen: false,
closeOnEscape: false,
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
});
var $url = $('input[type=text]', $dialog);
var $file = $('input[type=file]', $dialog);
var base = '<?php echo site_url() ?>';
editor.hooks.set('insertImageDialog', function(callback) {
var dialogInsertClick = function() {
callback($url.val().length > 0 ? $url.val(): null);
dialogClose();
};
var dialogCancelClick = function() {
dialogClose();
callback(null);
};
var dialogClose = function() {
$url.val('');
$file.val('');
$dialog.dialog('close');
};
$dialog.dialog( 'option', 'buttons', {
'Insert': dialogInsertClick,
'Cancel': dialogCancelClick
});
var uploadComplete = function(response) {
if (response.error == '0') {
$url.val(base + response.path);
} else {
alert(response.error);
$file.val('');
}
};
$file.ajaxfileupload({
'action': '<?php echo site_url() ?>upload.php',
'onComplete': uploadComplete,
});
$dialog.dialog('open');
return true; // tell the editor that we'll take care of getting the image url
});
editor.run();
})();
</script>

+ 1
- 1
system/admin/views/add-page.html.php View File

@ -27,7 +27,7 @@
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
echo $p->description;
} ?></textarea>
<br>
<br><br>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {


+ 0
- 7
system/admin/views/add-post.html.php View File

@ -35,13 +35,6 @@
echo $p->description;
} ?></textarea>
<br><br>
Featured Image (optional)<br><input type="text" class="text" name="img" value="<?php if (isset($postImg)) {
echo $postImg;
} ?>"/><br><br>
Embed Youtube Video (optional)<br><input type="text" class="text" name="vid" value="<?php if (isset($postVid)) {
echo $postVid;
} ?>"/><br><br>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
if (empty($postContent)) {


+ 130
- 0
system/admin/views/add-quote.html.php View File

@ -0,0 +1,130 @@
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
<?php if (config("jquery") != "enable"):?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<?php endif;?>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
<?php if (isset($error)) { ?>
<div class="error-message"><?php echo $error ?></div>
<?php } ?>
<div class="wmd-panel">
<form method="POST">
Title <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTitle)) {
if (empty($postTitle)) {
echo 'error';
}
} ?>" name="title" value="<?php if (isset($postTitle)) {
echo $postTitle;
} ?>"/><br><br>
Tag <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTag)) {
if (empty($postTag)) {
echo 'error';
}
} ?>" name="tag" value="<?php if (isset($postTag)) {
echo $postTag;
} ?>"/><br><br>
Url (optional)<br><input type="text" class="text" name="url" value="<?php if (isset($postUrl)) {
echo $postUrl;
} ?>"/><br>
<span class="help">If the url leave empty we will use the post title.</span><br><br>
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
echo $p->description;
} ?></textarea>
<br><br>
Featured Quote <span class="required">*</span> <br><textarea maxlength="200" class="text <?php if (isset($postQuote)) {
if (empty($postQuote)) {
echo 'error';
}
} ?>" name="quote"><?php if (isset($postQuote)) {
echo $postQuote;
} ?></textarea><br><br>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
if (empty($postContent)) {
echo 'error';
}
} ?>" name="content" cols="20" rows="10"><?php if (isset($postContent)) {
echo $postContent;
} ?></textarea><br/>
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
<input type="submit" name="publish" class="submit" value="Publish"/> <input type="submit" name="draft" class="draft" value="Save as draft"/>
</form>
</div>
<div id="insertImageDialog" title="Insert Image">
<h4>URL</h4>
<input type="text" placeholder="Enter image URL" />
<h4>Upload</h4>
<form method="post" action="" enctype="multipart/form-data">
<input type="file" name="file" id="file" />
</form>
<style>
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
.wmd-prompt-background {z-index:10!important;}
</style>
</div>
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
<script type="text/javascript">
(function () {
var converter = new Markdown.Converter();
var editor = new Markdown.Editor(converter);
var $dialog = $('#insertImageDialog').dialog({
autoOpen: false,
closeOnEscape: false,
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
});
var $url = $('input[type=text]', $dialog);
var $file = $('input[type=file]', $dialog);
var base = '<?php echo site_url() ?>';
editor.hooks.set('insertImageDialog', function(callback) {
var dialogInsertClick = function() {
callback($url.val().length > 0 ? $url.val(): null);
dialogClose();
};
var dialogCancelClick = function() {
dialogClose();
callback(null);
};
var dialogClose = function() {
$url.val('');
$file.val('');
$dialog.dialog('close');
};
$dialog.dialog( 'option', 'buttons', {
'Insert': dialogInsertClick,
'Cancel': dialogCancelClick
});
var uploadComplete = function(response) {
if (response.error == '0') {
$url.val(base + response.path);
} else {
alert(response.error);
$file.val('');
}
};
$file.ajaxfileupload({
'action': '<?php echo site_url() ?>upload.php',
'onComplete': uploadComplete,
});
$dialog.dialog('open');
return true; // tell the editor that we'll take care of getting the image url
});
editor.run();
})();
</script>

+ 130
- 0
system/admin/views/add-video.html.php View File

@ -0,0 +1,130 @@
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
<?php if (config("jquery") != "enable"):?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<?php endif;?>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
<?php if (isset($error)) { ?>
<div class="error-message"><?php echo $error ?></div>
<?php } ?>
<div class="wmd-panel">
<form method="POST">
Title <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTitle)) {
if (empty($postTitle)) {
echo 'error';
}
} ?>" name="title" value="<?php if (isset($postTitle)) {
echo $postTitle;
} ?>"/><br><br>
Tag <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTag)) {
if (empty($postTag)) {
echo 'error';
}
} ?>" name="tag" value="<?php if (isset($postTag)) {
echo $postTag;
} ?>"/><br><br>
Url (optional)<br><input type="text" class="text" name="url" value="<?php if (isset($postUrl)) {
echo $postUrl;
} ?>"/><br>
<span class="help">If the url leave empty we will use the post title.</span><br><br>
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
echo $p->description;
} ?></textarea>
<br><br>
Featured Video <span class="required">*</span> (YouTube Only)<br><textarea maxlength="200" class="text <?php if (isset($postVideo)) {
if (empty($postVideo)) {
echo 'error';
}
} ?>" name="video" ><?php if (isset($postVideo)) {
echo $postVideo;
} ?></textarea><br><br>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
if (empty($postContent)) {
echo 'error';
}
} ?>" name="content" cols="20" rows="10"><?php if (isset($postContent)) {
echo $postContent;
} ?></textarea><br/>
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
<input type="submit" name="publish" class="submit" value="Publish"/> <input type="submit" name="draft" class="draft" value="Save as draft"/>
</form>
</div>
<div id="insertImageDialog" title="Insert Image">
<h4>URL</h4>
<input type="text" placeholder="Enter image URL" />
<h4>Upload</h4>
<form method="post" action="" enctype="multipart/form-data">
<input type="file" name="file" id="file" />
</form>
<style>
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
.wmd-prompt-background {z-index:10!important;}
</style>
</div>
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
<script type="text/javascript">
(function () {
var converter = new Markdown.Converter();
var editor = new Markdown.Editor(converter);
var $dialog = $('#insertImageDialog').dialog({
autoOpen: false,
closeOnEscape: false,
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
});
var $url = $('input[type=text]', $dialog);
var $file = $('input[type=file]', $dialog);
var base = '<?php echo site_url() ?>';
editor.hooks.set('insertImageDialog', function(callback) {
var dialogInsertClick = function() {
callback($url.val().length > 0 ? $url.val(): null);
dialogClose();
};
var dialogCancelClick = function() {
dialogClose();
callback(null);
};
var dialogClose = function() {
$url.val('');
$file.val('');
$dialog.dialog('close');
};
$dialog.dialog( 'option', 'buttons', {
'Insert': dialogInsertClick,
'Cancel': dialogCancelClick
});
var uploadComplete = function(response) {
if (response.error == '0') {
$url.val(base + response.path);
} else {
alert(response.error);
$file.val('');
}
};
$file.ajaxfileupload({
'action': '<?php echo site_url() ?>upload.php',
'onComplete': uploadComplete,
});
$dialog.dialog('open');
return true; // tell the editor that we'll take care of getting the image url
});
editor.run();
})();
</script>

+ 9
- 0
system/admin/views/content-type.html.php View File

@ -0,0 +1,9 @@
<h2>Add content</h2>
<p><a href="<?php echo site_url();?>add/post">Regular post</a><br>Creating regular blog post.</p>
<p><a href="<?php echo site_url();?>add/image">Image post</a><br>Creating blog post with featured image.</p>
<p><a href="<?php echo site_url();?>add/video">Video post</a><br>Creating blog post with featured video.</p>
<p><a href="<?php echo site_url();?>add/audio">Audio post</a><br>Creating blog post with featured audio.</p>
<p><a href="<?php echo site_url();?>add/link">Link post</a><br>Creating blog post with featured link.</p>
<p><a href="<?php echo site_url();?>add/quote">Quote post</a><br>Creating blog post with fetaured quote.</p>
<p><a href="<?php echo site_url();?>add/page">Static page</a><br>Creating static page.</p>

+ 167
- 0
system/admin/views/edit-audio.html.php View File

@ -0,0 +1,167 @@
<?php
if (isset($p->file)) {
$url = $p->file;
} else {
$url = $oldfile;
}
$content = file_get_contents($url);
$oldtitle = get_content_tag('t', $content, 'Untitled');
$olddescription = get_content_tag('d', $content);
$oldaudio = get_content_tag('audio', $content);
$oldcontent = remove_html_comments($content);
$dir = substr($url, 0, strrpos($url, '/'));
$isdraft = explode('/', $dir);
$oldurl = explode('_', $url);
$oldtag = $oldurl[1];
$oldmd = str_replace('.md', '', $oldurl[2]);
if (isset($_GET['destination'])) {
$destination = $_GET['destination'];
} else {
$destination = 'admin';
}
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
$dt = str_replace($replaced, '', $oldurl[0]);
$t = str_replace('-', '', $dt);
$time = new DateTime($t);
$timestamp = $time->format("Y-m-d");
// The post date
$postdate = strtotime($timestamp);
// The post URL
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
?>
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
<?php if (config("jquery") != "enable"):?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<?php endif;?>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
<?php if (isset($error)) { ?>
<div class="error-message"><?php echo $error ?></div>
<?php } ?>
<div class="wmd-panel">
<form method="POST">
Title <span class="required">*</span> <br><input type="text" name="title"
class="text <?php if (isset($postTitle)) {
if (empty($postTitle)) {
echo 'error';
}
} ?>" value="<?php echo $oldtitle ?>"/><br><br>
Tag <span class="required">*</span> <br><input type="text" name="tag" class="text <?php if (isset($postTag)) {
if (empty($postTag)) {
echo 'error';
}
} ?>" value="<?php echo $oldtag ?>"/><br><br>
Url (optional)<br><input type="text" name="url" class="text" value="<?php echo $oldmd ?>"/><br>
<span class="help">If the url leave empty we will use the post title.</span><br><br>
Date Time<br><input type="date" name="date" class="text" value="<?php echo $timestamp; ?>"><br><input
type="time" name="time" class="text" value="<?php echo $time->format('H:i'); ?>"><br><br>
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
echo $p->description;
} else {echo $olddescription;}?></textarea>
<br><br>
Featured Audio <span class="required">*</span> (SoundCloud Only)<br><textarea maxlength="200" class="text <?php if (isset($postAudio)) {
if (empty($postAudio)) {
echo 'error';
}
} ?>" name="audio" ><?php echo $oldaudio ?></textarea><br><br>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
if (empty($postContent)) {
echo 'error';
}
} ?>" name="content" cols="20" rows="10"><?php echo $oldcontent ?></textarea><br>
<input type="hidden" name="is_audio" class="text" value="is_audio"/>
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
<?php if ($isdraft[2] == 'draft') { ?>
<input type="submit" name="publishdraft" class="submit" value="Publish draft"/> <input type="submit" name="updatedraft" class="draft" value="Update draft"/> <a href="<?php echo $delete ?>">Delete</a>
<?php } else { ?>
<input type="submit" name="updatepost" class="submit" value="Update post"/> <input type="submit" name="revertpost" class="revert" value="Revert to draft"/> <a href="<?php echo $delete ?>">Delete</a>
<?php }?>
</form>
</div>
<div id="insertImageDialog" title="Insert Image">
<h4>URL</h4>
<input type="text" placeholder="Enter image URL" />
<h4>Upload</h4>
<form method="post" action="" enctype="multipart/form-data">
<input type="file" name="file" id="file" />
</form>
<style>
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
.wmd-prompt-background {z-index:10!important;}
</style>
</div>
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
<script type="text/javascript">
(function () {
var converter = new Markdown.Converter();
var editor = new Markdown.Editor(converter);
var $dialog = $('#insertImageDialog').dialog({
autoOpen: false,
closeOnEscape: false,
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
});
var $url = $('input[type=text]', $dialog);
var $file = $('input[type=file]', $dialog);
var base = '<?php echo site_url() ?>';
editor.hooks.set('insertImageDialog', function(callback) {
var dialogInsertClick = function() {
callback($url.val().length > 0 ? $url.val(): null);
dialogClose();
};
var dialogCancelClick = function() {
dialogClose();
callback(null);
};
var dialogClose = function() {
$url.val('');
$file.val('');
$dialog.dialog('close');
};
$dialog.dialog( 'option', 'buttons', {
'Insert': dialogInsertClick,
'Cancel': dialogCancelClick
});
var uploadComplete = function(response) {
if (response.error == '0') {
$url.val(base + response.path);
} else {
alert(response.error);
$file.val('');
}
};
$file.ajaxfileupload({
'action': '<?php echo site_url() ?>upload.php',
'onComplete': uploadComplete,
});
$dialog.dialog('open');
return true; // tell the editor that we'll take care of getting the image url
});
editor.run();
})();
</script>

+ 167
- 0
system/admin/views/edit-image.html.php View File

@ -0,0 +1,167 @@
<?php
if (isset($p->file)) {
$url = $p->file;
} else {
$url = $oldfile;
}
$content = file_get_contents($url);
$oldtitle = get_content_tag('t', $content, 'Untitled');
$olddescription = get_content_tag('d', $content);
$oldimage = get_content_tag('image', $content);
$oldcontent = remove_html_comments($content);
$dir = substr($url, 0, strrpos($url, '/'));
$isdraft = explode('/', $dir);
$oldurl = explode('_', $url);
$oldtag = $oldurl[1];
$oldmd = str_replace('.md', '', $oldurl[2]);
if (isset($_GET['destination'])) {
$destination = $_GET['destination'];
} else {
$destination = 'admin';
}
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
$dt = str_replace($replaced, '', $oldurl[0]);
$t = str_replace('-', '', $dt);
$time = new DateTime($t);
$timestamp = $time->format("Y-m-d");
// The post date
$postdate = strtotime($timestamp);
// The post URL
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
?>
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
<?php if (config("jquery") != "enable"):?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<?php endif;?>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
<?php if (isset($error)) { ?>
<div class="error-message"><?php echo $error ?></div>
<?php } ?>
<div class="wmd-panel">
<form method="POST">
Title <span class="required">*</span> <br><input type="text" name="title"
class="text <?php if (isset($postTitle)) {
if (empty($postTitle)) {
echo 'error';
}
} ?>" value="<?php echo $oldtitle ?>"/><br><br>
Tag <span class="required">*</span> <br><input type="text" name="tag" class="text <?php if (isset($postTag)) {
if (empty($postTag)) {
echo 'error';
}
} ?>" value="<?php echo $oldtag ?>"/><br><br>
Url (optional)<br><input type="text" name="url" class="text" value="<?php echo $oldmd ?>"/><br>
<span class="help">If the url leave empty we will use the post title.</span><br><br>
Date Time<br><input type="date" name="date" class="text" value="<?php echo $timestamp; ?>"><br><input
type="time" name="time" class="text" value="<?php echo $time->format('H:i'); ?>"><br><br>
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
echo $p->description;
} else {echo $olddescription;}?></textarea>
<br><br>
Featured Image <span class="required">*</span> <br><textarea maxlength="200" class="text <?php if (isset($postImage)) {
if (empty($postImage)) {
echo 'error';
}
} ?>" name="image" ><?php echo $oldimage ?></textarea><br><br>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
if (empty($postContent)) {
echo 'error';
}
} ?>" name="content" cols="20" rows="10"><?php echo $oldcontent ?></textarea><br>
<input type="hidden" name="is_image" class="text" value="is_image"/>
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
<?php if ($isdraft[2] == 'draft') { ?>
<input type="submit" name="publishdraft" class="submit" value="Publish draft"/> <input type="submit" name="updatedraft" class="draft" value="Update draft"/> <a href="<?php echo $delete ?>">Delete</a>
<?php } else { ?>
<input type="submit" name="updatepost" class="submit" value="Update post"/> <input type="submit" name="revertpost" class="revert" value="Revert to draft"/> <a href="<?php echo $delete ?>">Delete</a>
<?php }?>
</form>
</div>
<div id="insertImageDialog" title="Insert Image">
<h4>URL</h4>
<input type="text" placeholder="Enter image URL" />
<h4>Upload</h4>
<form method="post" action="" enctype="multipart/form-data">
<input type="file" name="file" id="file" />
</form>
<style>
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
.wmd-prompt-background {z-index:10!important;}
</style>
</div>
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
<script type="text/javascript">
(function () {
var converter = new Markdown.Converter();
var editor = new Markdown.Editor(converter);
var $dialog = $('#insertImageDialog').dialog({
autoOpen: false,
closeOnEscape: false,
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
});
var $url = $('input[type=text]', $dialog);
var $file = $('input[type=file]', $dialog);
var base = '<?php echo site_url() ?>';
editor.hooks.set('insertImageDialog', function(callback) {
var dialogInsertClick = function() {
callback($url.val().length > 0 ? $url.val(): null);
dialogClose();
};
var dialogCancelClick = function() {
dialogClose();
callback(null);
};
var dialogClose = function() {
$url.val('');
$file.val('');
$dialog.dialog('close');
};
$dialog.dialog( 'option', 'buttons', {
'Insert': dialogInsertClick,
'Cancel': dialogCancelClick
});
var uploadComplete = function(response) {
if (response.error == '0') {
$url.val(base + response.path);
} else {
alert(response.error);
$file.val('');
}
};
$file.ajaxfileupload({
'action': '<?php echo site_url() ?>upload.php',
'onComplete': uploadComplete,
});
$dialog.dialog('open');
return true; // tell the editor that we'll take care of getting the image url
});
editor.run();
})();
</script>

+ 167
- 0
system/admin/views/edit-link.html.php View File

@ -0,0 +1,167 @@
<?php
if (isset($p->file)) {
$url = $p->file;
} else {
$url = $oldfile;
}
$content = file_get_contents($url);
$oldtitle = get_content_tag('t', $content, 'Untitled');
$olddescription = get_content_tag('d', $content);
$oldlink = get_content_tag('link', $content);
$oldcontent = remove_html_comments($content);
$dir = substr($url, 0, strrpos($url, '/'));
$isdraft = explode('/', $dir);
$oldurl = explode('_', $url);
$oldtag = $oldurl[1];
$oldmd = str_replace('.md', '', $oldurl[2]);
if (isset($_GET['destination'])) {
$destination = $_GET['destination'];
} else {
$destination = 'admin';
}
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
$dt = str_replace($replaced, '', $oldurl[0]);
$t = str_replace('-', '', $dt);
$time = new DateTime($t);
$timestamp = $time->format("Y-m-d");
// The post date
$postdate = strtotime($timestamp);
// The post URL
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
?>
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
<?php if (config("jquery") != "enable"):?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<?php endif;?>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
<?php if (isset($error)) { ?>
<div class="error-message"><?php echo $error ?></div>
<?php } ?>
<div class="wmd-panel">
<form method="POST">
Title <span class="required">*</span> <br><input type="text" name="title"
class="text <?php if (isset($postTitle)) {
if (empty($postTitle)) {
echo 'error';
}
} ?>" value="<?php echo $oldtitle ?>"/><br><br>
Tag <span class="required">*</span> <br><input type="text" name="tag" class="text <?php if (isset($postTag)) {
if (empty($postTag)) {
echo 'error';
}
} ?>" value="<?php echo $oldtag ?>"/><br><br>
Url (optional)<br><input type="text" name="url" class="text" value="<?php echo $oldmd ?>"/><br>
<span class="help">If the url leave empty we will use the post title.</span><br><br>
Date Time<br><input type="date" name="date" class="text" value="<?php echo $timestamp; ?>"><br><input
type="time" name="time" class="text" value="<?php echo $time->format('H:i'); ?>"><br><br>
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
echo $p->description;
} else {echo $olddescription;}?></textarea>
<br><br>
Featured Link <span class="required">*</span> <br><textarea maxlength="200" class="text <?php if (isset($postLink)) {
if (empty($postLink)) {
echo 'error';
}
} ?>" name="link" ><?php echo $oldlink ?></textarea><br><br>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
if (empty($postContent)) {
echo 'error';
}
} ?>" name="content" cols="20" rows="10"><?php echo $oldcontent ?></textarea><br>
<input type="hidden" name="is_link" class="text" value="is_link"/>
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
<?php if ($isdraft[2] == 'draft') { ?>
<input type="submit" name="publishdraft" class="submit" value="Publish draft"/> <input type="submit" name="updatedraft" class="draft" value="Update draft"/> <a href="<?php echo $delete ?>">Delete</a>
<?php } else { ?>
<input type="submit" name="updatepost" class="submit" value="Update post"/> <input type="submit" name="revertpost" class="revert" value="Revert to draft"/> <a href="<?php echo $delete ?>">Delete</a>
<?php }?>
</form>
</div>
<div id="insertImageDialog" title="Insert Image">
<h4>URL</h4>
<input type="text" placeholder="Enter image URL" />
<h4>Upload</h4>
<form method="post" action="" enctype="multipart/form-data">
<input type="file" name="file" id="file" />
</form>
<style>
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
.wmd-prompt-background {z-index:10!important;}
</style>
</div>
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
<script type="text/javascript">
(function () {
var converter = new Markdown.Converter();
var editor = new Markdown.Editor(converter);
var $dialog = $('#insertImageDialog').dialog({
autoOpen: false,
closeOnEscape: false,
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
});
var $url = $('input[type=text]', $dialog);
var $file = $('input[type=file]', $dialog);
var base = '<?php echo site_url() ?>';
editor.hooks.set('insertImageDialog', function(callback) {
var dialogInsertClick = function() {
callback($url.val().length > 0 ? $url.val(): null);
dialogClose();
};
var dialogCancelClick = function() {
dialogClose();
callback(null);
};
var dialogClose = function() {
$url.val('');
$file.val('');
$dialog.dialog('close');
};
$dialog.dialog( 'option', 'buttons', {
'Insert': dialogInsertClick,
'Cancel': dialogCancelClick
});
var uploadComplete = function(response) {
if (response.error == '0') {
$url.val(base + response.path);
} else {
alert(response.error);
$file.val('');
}
};
$file.ajaxfileupload({
'action': '<?php echo site_url() ?>upload.php',
'onComplete': uploadComplete,
});
$dialog.dialog('open');
return true; // tell the editor that we'll take care of getting the image url
});
editor.run();
})();
</script>

+ 13
- 3
system/admin/views/edit-page.html.php View File

@ -7,6 +7,7 @@ if (isset($p->file)) {
}
$content = file_get_contents($url);
$oldtitle = get_content_tag('t', $content, 'Untitled');
$olddescription = get_content_tag('d', $content);
$oldcontent = remove_html_comments($content);
if (isset($_GET['destination'])) {
@ -18,7 +19,17 @@ $dir = substr($url, 0, strrpos($url, '/'));
$oldurl = str_replace($dir . '/', '', $url);
$oldmd = str_replace('.md', '', $oldurl);
$delete = $p->url . '/delete?destination=' . $destination;
if (isset($p->url)) {
$delete = $p->url . '/delete?destination=' . $destination;
}
else {
if(empty($sub)) {
$delete = site_url() . $oldmd . '/delete?destination=' . $destination;
}
else {
$delete = site_url() . $static .'/'. $sub . '/delete?destination=' . $destination;
}
}
?>
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
@ -46,9 +57,8 @@ $delete = $p->url . '/delete?destination=' . $destination;
<span class="help">If the url leave empty we will use the page title.</span><br><br>
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
echo $p->description;
} ?></textarea>
} else {echo $olddescription;}?></textarea>
<br><br>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
if (empty($postContent)) {


+ 3
- 6
system/admin/views/edit-post.html.php View File

@ -7,8 +7,7 @@ if (isset($p->file)) {
$content = file_get_contents($url);
$oldtitle = get_content_tag('t', $content, 'Untitled');
$oldimg = get_content_tag('img', $content);
$oldvid = get_content_tag('vid', $content);
$olddescription = get_content_tag('d', $content);
$oldcontent = remove_html_comments($content);
$dir = substr($url, 0, strrpos($url, '/'));
@ -68,17 +67,15 @@ $delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destinat
type="time" name="time" class="text" value="<?php echo $time->format('H:i'); ?>"><br><br>
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
echo $p->description;
} ?></textarea>
} else { echo $olddescription;} ?></textarea>
<br><br>
Featured Image (optional)<br><input type="text" class="text" name="img" value="<?php echo $oldimg ?>"/><br><br>
Embed Youtube Video (optional)<br><input type="text" class="text" name="vid" value="<?php echo $oldvid ?>"/><br><br>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
if (empty($postContent)) {
echo 'error';
}
} ?>" name="content" cols="20" rows="10"><?php echo $oldcontent ?></textarea><br>
<input type="hidden" name="is_post" class="text" value="is_post"/>
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
<?php if ($isdraft[2] == 'draft') { ?>


+ 167
- 0
system/admin/views/edit-quote.html.php View File

@ -0,0 +1,167 @@
<?php
if (isset($p->file)) {
$url = $p->file;
} else {
$url = $oldfile;
}
$content = file_get_contents($url);
$oldtitle = get_content_tag('t', $content, 'Untitled');
$olddescription = get_content_tag('d', $content);
$oldquote = get_content_tag('quote', $content);
$oldcontent = remove_html_comments($content);
$dir = substr($url, 0, strrpos($url, '/'));
$isdraft = explode('/', $dir);
$oldurl = explode('_', $url);
$oldtag = $oldurl[1];
$oldmd = str_replace('.md', '', $oldurl[2]);
if (isset($_GET['destination'])) {
$destination = $_GET['destination'];
} else {
$destination = 'admin';
}
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
$dt = str_replace($replaced, '', $oldurl[0]);
$t = str_replace('-', '', $dt);
$time = new DateTime($t);
$timestamp = $time->format("Y-m-d");
// The post date
$postdate = strtotime($timestamp);
// The post URL
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
?>
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
<?php if (config("jquery") != "enable"):?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<?php endif;?>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
<?php if (isset($error)) { ?>
<div class="error-message"><?php echo $error ?></div>
<?php } ?>
<div class="wmd-panel">
<form method="POST">
Title <span class="required">*</span> <br><input type="text" name="title"
class="text <?php if (isset($postTitle)) {
if (empty($postTitle)) {
echo 'error';
}
} ?>" value="<?php echo $oldtitle ?>"/><br><br>
Tag <span class="required">*</span> <br><input type="text" name="tag" class="text <?php if (isset($postTag)) {
if (empty($postTag)) {
echo 'error';
}
} ?>" value="<?php echo $oldtag ?>"/><br><br>
Url (optional)<br><input type="text" name="url" class="text" value="<?php echo $oldmd ?>"/><br>
<span class="help">If the url leave empty we will use the post title.</span><br><br>
Date Time<br><input type="date" name="date" class="text" value="<?php echo $timestamp; ?>"><br><input
type="time" name="time" class="text" value="<?php echo $time->format('H:i'); ?>"><br><br>
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
echo $p->description;
} else {echo $olddescription;}?></textarea>
<br><br>
Featured Quote <span class="required">*</span> <br><textarea maxlength="200" class="text <?php if (isset($postQuote)) {
if (empty($postQuote)) {
echo 'error';
}
} ?>" name="quote"><?php echo $oldquote ?></textarea><br><br>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
if (empty($postContent)) {
echo 'error';
}
} ?>" name="content" cols="20" rows="10"><?php echo $oldcontent ?></textarea><br>
<input type="hidden" name="is_quote" class="text" value="is_quote"/>
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
<?php if ($isdraft[2] == 'draft') { ?>
<input type="submit" name="publishdraft" class="submit" value="Publish draft"/> <input type="submit" name="updatedraft" class="draft" value="Update draft"/> <a href="<?php echo $delete ?>">Delete</a>
<?php } else { ?>
<input type="submit" name="updatepost" class="submit" value="Update post"/> <input type="submit" name="revertpost" class="revert" value="Revert to draft"/> <a href="<?php echo $delete ?>">Delete</a>
<?php }?>
</form>
</div>
<div id="insertImageDialog" title="Insert Image">
<h4>URL</h4>
<input type="text" placeholder="Enter image URL" />
<h4>Upload</h4>
<form method="post" action="" enctype="multipart/form-data">
<input type="file" name="file" id="file" />
</form>
<style>
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
.wmd-prompt-background {z-index:10!important;}
</style>
</div>
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
<script type="text/javascript">
(function () {
var converter = new Markdown.Converter();
var editor = new Markdown.Editor(converter);
var $dialog = $('#insertImageDialog').dialog({
autoOpen: false,
closeOnEscape: false,
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
});
var $url = $('input[type=text]', $dialog);
var $file = $('input[type=file]', $dialog);
var base = '<?php echo site_url() ?>';
editor.hooks.set('insertImageDialog', function(callback) {
var dialogInsertClick = function() {
callback($url.val().length > 0 ? $url.val(): null);
dialogClose();
};
var dialogCancelClick = function() {
dialogClose();
callback(null);
};
var dialogClose = function() {
$url.val('');
$file.val('');
$dialog.dialog('close');
};
$dialog.dialog( 'option', 'buttons', {
'Insert': dialogInsertClick,
'Cancel': dialogCancelClick
});
var uploadComplete = function(response) {
if (response.error == '0') {
$url.val(base + response.path);
} else {
alert(response.error);
$file.val('');
}
};
$file.ajaxfileupload({
'action': '<?php echo site_url() ?>upload.php',
'onComplete': uploadComplete,
});
$dialog.dialog('open');
return true; // tell the editor that we'll take care of getting the image url
});
editor.run();
})();
</script>

+ 167
- 0
system/admin/views/edit-video.html.php View File

@ -0,0 +1,167 @@
<?php
if (isset($p->file)) {
$url = $p->file;
} else {
$url = $oldfile;
}
$content = file_get_contents($url);
$oldtitle = get_content_tag('t', $content, 'Untitled');
$olddescription = get_content_tag('d', $content);
$oldvideo = get_content_tag('video', $content);
$oldcontent = remove_html_comments($content);
$dir = substr($url, 0, strrpos($url, '/'));
$isdraft = explode('/', $dir);
$oldurl = explode('_', $url);
$oldtag = $oldurl[1];
$oldmd = str_replace('.md', '', $oldurl[2]);
if (isset($_GET['destination'])) {
$destination = $_GET['destination'];
} else {
$destination = 'admin';
}
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
$dt = str_replace($replaced, '', $oldurl[0]);
$t = str_replace('-', '', $dt);
$time = new DateTime($t);
$timestamp = $time->format("Y-m-d");
// The post date
$postdate = strtotime($timestamp);
// The post URL
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
?>
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
<?php if (config("jquery") != "enable"):?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<?php endif;?>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
<?php if (isset($error)) { ?>
<div class="error-message"><?php echo $error ?></div>
<?php } ?>
<div class="wmd-panel">
<form method="POST">
Title <span class="required">*</span> <br><input type="text" name="title"
class="text <?php if (isset($postTitle)) {
if (empty($postTitle)) {
echo 'error';
}
} ?>" value="<?php echo $oldtitle ?>"/><br><br>
Tag <span class="required">*</span> <br><input type="text" name="tag" class="text <?php if (isset($postTag)) {
if (empty($postTag)) {
echo 'error';
}
} ?>" value="<?php echo $oldtag ?>"/><br><br>
Url (optional)<br><input type="text" name="url" class="text" value="<?php echo $oldmd ?>"/><br>
<span class="help">If the url leave empty we will use the post title.</span><br><br>
Date Time<br><input type="date" name="date" class="text" value="<?php echo $timestamp; ?>"><br><input
type="time" name="time" class="text" value="<?php echo $time->format('H:i'); ?>"><br><br>
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
echo $p->description;
} else {echo $olddescription;}?></textarea>
<br><br>
Featured Video <span class="required">*</span> (YouTube Only)<br><textarea maxlength="200" class="text <?php if (isset($postVideo)) {
if (empty($postVideo)) {
echo 'error';
}
} ?>" name="video" ><?php echo $oldvideo ?></textarea><br><br>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
if (empty($postContent)) {
echo 'error';
}
} ?>" name="content" cols="20" rows="10"><?php echo $oldcontent ?></textarea><br>
<input type="hidden" name="is_video" class="text" value="is_video"/>
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
<?php if ($isdraft[2] == 'draft') { ?>
<input type="submit" name="publishdraft" class="submit" value="Publish draft"/> <input type="submit" name="updatedraft" class="draft" value="Update draft"/> <a href="<?php echo $delete ?>">Delete</a>
<?php } else { ?>
<input type="submit" name="updatepost" class="submit" value="Update post"/> <input type="submit" name="revertpost" class="revert" value="Revert to draft"/> <a href="<?php echo $delete ?>">Delete</a>
<?php }?>
</form>
</div>
<div id="insertImageDialog" title="Insert Image">
<h4>URL</h4>
<input type="text" placeholder="Enter image URL" />
<h4>Upload</h4>
<form method="post" action="" enctype="multipart/form-data">
<input type="file" name="file" id="file" />
</form>
<style>
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
.wmd-prompt-background {z-index:10!important;}
</style>
</div>
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
<script type="text/javascript">
(function () {
var converter = new Markdown.Converter();
var editor = new Markdown.Editor(converter);
var $dialog = $('#insertImageDialog').dialog({
autoOpen: false,
closeOnEscape: false,
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
});
var $url = $('input[type=text]', $dialog);
var $file = $('input[type=file]', $dialog);
var base = '<?php echo site_url() ?>';
editor.hooks.set('insertImageDialog', function(callback) {
var dialogInsertClick = function() {
callback($url.val().length > 0 ? $url.val(): null);
dialogClose();
};
var dialogCancelClick = function() {
dialogClose();
callback(null);
};
var dialogClose = function() {
$url.val('');
$file.val('');
$dialog.dialog('close');
};
$dialog.dialog( 'option', 'buttons', {
'Insert': dialogInsertClick,
'Cancel': dialogCancelClick
});
var uploadComplete = function(response) {
if (response.error == '0') {
$url.val(base + response.path);
} else {
alert(response.error);
$file.val('');
}
};
$file.ajaxfileupload({
'action': '<?php echo site_url() ?>upload.php',
'onComplete': uploadComplete,
});
$dialog.dialog('open');
return true; // tell the editor that we'll take care of getting the image url
});
editor.run();
})();
</script>

+ 517
- 23
system/htmly.php View File

@ -251,8 +251,6 @@ post('/add/post', function () {
$proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
$title = from($_REQUEST, 'title');
$img = from($_REQUEST, 'img');
$vid = from($_REQUEST, 'vid');
$tag = from($_REQUEST, 'tag');
$url = from($_REQUEST, 'url');
$content = from($_REQUEST, 'content');
@ -261,10 +259,10 @@ post('/add/post', function () {
$draft = from($_REQUEST, 'draft');
if ($proper && !empty($title) && !empty($tag) && !empty($content)) {
if (!empty($url)) {
add_post($title, $tag, $url, $content, $user, $description, $img, $vid, $draft);
add_post($title, $tag, $url, $content, $user, $description, $draft);
} else {
$url = $title;
add_post($title, $tag, $url, $content, $user, $description, $img, $vid, $draft);
add_post($title, $tag, $url, $content, $user, $description, $draft);
}
} else {
$message['error'] = '';
@ -287,8 +285,6 @@ post('/add/post', function () {
'canonical' => site_url(),
'error' => '<ul>' . $message['error'] . '</ul>',
'postTitle' => $title,
'postImg' => $img,
'postVid' => $vid,
'postTag' => $tag,
'postUrl' => $url,
'postContent' => $content,
@ -298,6 +294,376 @@ post('/add/post', function () {
}
});
// Show the "Add image" page
get('/add/image', function () {
if (login()) {
config('views.root', 'system/admin/views');
render('add-image', array(
'title' => 'Add image - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'bodyclass' => 'addimage',
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Add image'
));
} else {
$login = site_url() . 'login';
header("location: $login");
}
});
// Submitted add image data
post('/add/image', function () {
$proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
$title = from($_REQUEST, 'title');
$image = from($_REQUEST, 'image');
$tag = from($_REQUEST, 'tag');
$url = from($_REQUEST, 'url');
$content = from($_REQUEST, 'content');
$description = from($_REQUEST, 'description');
$user = $_SESSION[config("site.url")]['user'];
$draft = from($_REQUEST, 'draft');
if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($image)) {
if (!empty($url)) {
add_image($title, $tag, $url, $content, $user, $description, $image, $draft);
} else {
$url = $title;
add_image($title, $tag, $url, $content, $user, $description, $image, $draft);
}
} else {
$message['error'] = '';
if (empty($title)) {
$message['error'] .= '<li>Title field is required.</li>';
}
if (empty($tag)) {
$message['error'] .= '<li>Tag field is required.</li>';
}
if (empty($content)) {
$message['error'] .= '<li>Content field is required.</li>';
}
if (empty($image)) {
$message['error'] .= '<li>Image field is required.</li>';
}
if (!$proper) {
$message['error'] .= '<li>CSRF Token not correct.</li>';
}
config('views.root', 'system/admin/views');
render('add-post', array(
'title' => 'Add post- ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'error' => '<ul>' . $message['error'] . '</ul>',
'postTitle' => $title,
'postImage' => $image,
'postTag' => $tag,
'postUrl' => $url,
'postContent' => $content,
'bodyclass' => 'addpost',
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Add post'
));
}
});
// Show the "Add video" page
get('/add/video', function () {
if (login()) {
config('views.root', 'system/admin/views');
render('add-video', array(
'title' => 'Add video - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'bodyclass' => 'addvideo',
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Add video'
));
} else {
$login = site_url() . 'login';
header("location: $login");
}
});
// Submitted add video data
post('/add/video', function () {
$proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
$title = from($_REQUEST, 'title');
$video = from($_REQUEST, 'video');
$tag = from($_REQUEST, 'tag');
$url = from($_REQUEST, 'url');
$content = from($_REQUEST, 'content');
$description = from($_REQUEST, 'description');
$user = $_SESSION[config("site.url")]['user'];
$draft = from($_REQUEST, 'draft');
if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($video)) {
if (!empty($url)) {
add_video($title, $tag, $url, $content, $user, $description, $video, $draft);
} else {
$url = $title;
add_video($title, $tag, $url, $content, $user, $description, $video, $draft);
}
} else {
$message['error'] = '';
if (empty($title)) {
$message['error'] .= '<li>Title field is required.</li>';
}
if (empty($tag)) {
$message['error'] .= '<li>Tag field is required.</li>';
}
if (empty($content)) {
$message['error'] .= '<li>Content field is required.</li>';
}
if (empty($video)) {
$message['error'] .= '<li>Video field is required.</li>';
}
if (!$proper) {
$message['error'] .= '<li>CSRF Token not correct.</li>';
}
config('views.root', 'system/admin/views');
render('add-video', array(
'title' => 'Add post- ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'error' => '<ul>' . $message['error'] . '</ul>',
'postTitle' => $title,
'postVideo' => $video,
'postTag' => $tag,
'postUrl' => $url,
'postContent' => $content,
'bodyclass' => 'addvideo',
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Add video'
));
}
});
// Show the "Add link" page
get('/add/link', function () {
if (login()) {
config('views.root', 'system/admin/views');
render('add-link', array(
'title' => 'Add video - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'bodyclass' => 'addlink',
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Add link'
));
} else {
$login = site_url() . 'login';
header("location: $login");
}
});
// Submitted add link data
post('/add/link', function () {
$proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
$title = from($_REQUEST, 'title');
$link = from($_REQUEST, 'link');
$tag = from($_REQUEST, 'tag');
$url = from($_REQUEST, 'url');
$content = from($_REQUEST, 'content');
$description = from($_REQUEST, 'description');
$user = $_SESSION[config("site.url")]['user'];
$draft = from($_REQUEST, 'draft');
if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($link)) {
if (!empty($url)) {
add_link($title, $tag, $url, $content, $user, $description, $link, $draft);
} else {
$url = $title;
add_link($title, $tag, $url, $content, $user, $description, $link, $draft);
}
} else {
$message['error'] = '';
if (empty($title)) {
$message['error'] .= '<li>Title field is required.</li>';
}
if (empty($tag)) {
$message['error'] .= '<li>Tag field is required.</li>';
}
if (empty($content)) {
$message['error'] .= '<li>Content field is required.</li>';
}
if (empty($link)) {
$message['error'] .= '<li>Link field is required.</li>';
}
if (!$proper) {
$message['error'] .= '<li>CSRF Token not correct.</li>';
}
config('views.root', 'system/admin/views');
render('add-link', array(
'title' => 'Add link- ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'error' => '<ul>' . $message['error'] . '</ul>',
'postTitle' => $title,
'postLink' => $link,
'postTag' => $tag,
'postUrl' => $url,
'postContent' => $content,
'bodyclass' => 'addlink',
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Add link'
));
}
});
// Show the "Add quote" page
get('/add/quote', function () {
if (login()) {
config('views.root', 'system/admin/views');
render('add-quote', array(
'title' => 'Add quote - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'bodyclass' => 'addquote',
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Add quote'
));
} else {
$login = site_url() . 'login';
header("location: $login");
}
});
// Submitted add quote data
post('/add/quote', function () {
$proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
$title = from($_REQUEST, 'title');
$quote = from($_REQUEST, 'quote');
$tag = from($_REQUEST, 'tag');
$url = from($_REQUEST, 'url');
$content = from($_REQUEST, 'content');
$description = from($_REQUEST, 'description');
$user = $_SESSION[config("site.url")]['user'];
$draft = from($_REQUEST, 'draft');
if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($quote)) {
if (!empty($url)) {
add_quote($title, $tag, $url, $content, $user, $description, $quote, $draft);
} else {
$url = $title;
add_quote($title, $tag, $url, $content, $user, $description, $quote, $draft);
}
} else {
$message['error'] = '';
if (empty($title)) {
$message['error'] .= '<li>Title field is required.</li>';
}
if (empty($tag)) {
$message['error'] .= '<li>Tag field is required.</li>';
}
if (empty($content)) {
$message['error'] .= '<li>Content field is required.</li>';
}
if (empty($quote)) {
$message['error'] .= '<li>Quote field is required.</li>';
}
if (!$proper) {
$message['error'] .= '<li>CSRF Token not correct.</li>';
}
config('views.root', 'system/admin/views');
render('add-quote', array(
'title' => 'Add quote - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'error' => '<ul>' . $message['error'] . '</ul>',
'postTitle' => $title,
'postQuote' => $quote,
'postTag' => $tag,
'postUrl' => $url,
'postContent' => $content,
'bodyclass' => 'addquote',
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Add Quote'
));
}
});
// Show the "Add audio" page
get('/add/audio', function () {
if (login()) {
config('views.root', 'system/admin/views');
render('add-audio', array(
'title' => 'Add audio - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'bodyclass' => 'addaudio',
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Add audio'
));
} else {
$login = site_url() . 'login';
header("location: $login");
}
});
// Submitted add quote data
post('/add/audio', function () {
$proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
$title = from($_REQUEST, 'title');
$audio = from($_REQUEST, 'audio');
$tag = from($_REQUEST, 'tag');
$url = from($_REQUEST, 'url');
$content = from($_REQUEST, 'content');
$description = from($_REQUEST, 'description');
$user = $_SESSION[config("site.url")]['user'];
$draft = from($_REQUEST, 'draft');
if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($audio)) {
if (!empty($url)) {
add_audio($title, $tag, $url, $content, $user, $description, $audio, $draft);
} else {
$url = $title;
add_audio($title, $tag, $url, $content, $user, $description, $audio, $draft);
}
} else {
$message['error'] = '';
if (empty($title)) {
$message['error'] .= '<li>Title field is required.</li>';
}
if (empty($tag)) {
$message['error'] .= '<li>Tag field is required.</li>';
}
if (empty($content)) {
$message['error'] .= '<li>Content field is required.</li>';
}
if (empty($audio)) {
$message['error'] .= '<li>Audio field is required.</li>';
}
if (!$proper) {
$message['error'] .= '<li>CSRF Token not correct.</li>';
}
config('views.root', 'system/admin/views');
render('add-audio', array(
'title' => 'Add audio - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'error' => '<ul>' . $message['error'] . '</ul>',
'postTitle' => $title,
'postAudio' => $audio,
'postTag' => $tag,
'postUrl' => $url,
'postContent' => $content,
'bodyclass' => 'addaudio',
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Add audio'
));
}
});
// Show the static add page
get('/add/page', function () {
@ -546,6 +912,24 @@ get('/admin/draft', function () {
}
});
// Show admin/content
get('/admin/content', function () {
if (login()) {
config('views.root', 'system/admin/views');
render('content-type', array(
'title' => 'Add content - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'bodyclass' => 'contenttype',
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Add content'
));
} else {
$login = site_url() . 'login';
header("location: $login");
}
die;
});
// Show import page
get('/admin/import', function () {
if (login()) {
@ -1309,6 +1693,8 @@ post('/:static/:sub/edit', function ($static, $sub) {
'postTitle' => $title,
'postUrl' => $url,
'postContent' => $content,
'static' => $static,
'sub' => $sub,
'bodyclass' => 'editpage',
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Edit page'
));
@ -1407,6 +1793,20 @@ get('/:year/:month/:name', function ($year, $month, $name) {
} else {
$next = array();
}
if (isset($current->image)) {
$var = 'imagePost';
} elseif (isset($current->link)) {
$var = 'linkPost';
} elseif (isset($current->quote)) {
$var = 'quotePost';
} elseif (isset($current->audio)) {
$var = 'audioPost';
} elseif (isset($current->video)) {
$var = 'videoPost'; }
else {
$var = 'blogPost';
}
render('post', array(
'title' => $current->title . ' - ' . blog_title(),
@ -1418,7 +1818,7 @@ get('/:year/:month/:name', function ($year, $month, $name) {
'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title,
'prev' => has_prev($prev),
'next' => has_next($next),
'type' => 'blogPost',
'type' => $var,
'is_post' => is_post(true),
));
@ -1443,19 +1843,33 @@ get('/:year/:month/:name/edit', function ($year, $month, $name) {
}
$current = $post['current'];
if (isset($current->image)) {
$var = 'edit-image';
} elseif (isset($current->link)) {
$var = 'edit-link';
} elseif (isset($current->quote)) {
$var = 'edit-quote';
} elseif (isset($current->audio)) {
$var = 'edit-audio';
} elseif (isset($current->video)) {
$var = 'edit-video'; }
else {
$var = 'edit-post';
}
if ($user === $current->author || $role === 'admin') {
render('edit-post', array(
'title' => 'Edit post - ' . blog_title(),
render($var, array(
'title' => $var .' '. blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'p' => $current,
'bodyclass' => 'editpost',
'bodyclass' => 'editcontent',
'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title
));
} else {
render('denied', array(
'title' => 'Edit post - ' . blog_title(),
'title' => $var .' '. blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'p' => $current,
@ -1475,8 +1889,17 @@ post('/:year/:month/:name/edit', function () {
$proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
$title = from($_REQUEST, 'title');
$img = from($_REQUEST, 'img');
$vid = from($_REQUEST, 'vid');
$is_post = from($_REQUEST, 'is_post');
$image = from($_REQUEST, 'image');
$is_image = from($_REQUEST, 'is_image');
$video = from($_REQUEST, 'video');
$is_video = from($_REQUEST, 'is_video');
$link = from($_REQUEST, 'link');
$is_link = from($_REQUEST, 'is_link');
$audio = from($_REQUEST, 'audio');
$is_audio = from($_REQUEST, 'is_audio');
$quote = from($_REQUEST, 'quote');
$is_quote = from($_REQUEST, 'is_quote');
$tag = from($_REQUEST, 'tag');
$url = from($_REQUEST, 'url');
$content = from($_REQUEST, 'content');
@ -1491,12 +1914,57 @@ post('/:year/:month/:name/edit', function () {
if ($date !== null && $time !== null) {
$dateTime = $date . ' ' . $time;
}
if ($proper && !empty($title) && !empty($tag) && !empty($content)) {
if (!empty($is_image)) {
$var = 'edit-image';
} elseif (!empty($is_video)) {
$var = 'edit-video';
} elseif (!empty($is_link)) {
$var = 'edit-link';
} elseif (!empty($is_quote)) {
$var = 'edit-quote';
} elseif (!empty($is_audio)) {
$var = 'edit-audio';
} elseif (!empty($is_post)) {
$var = 'edit-post';
}
if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($image)) {
if (empty($url)) {
$url = $title;
}
edit_image($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $image, $revertPost, $publishDraft);
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($video)) {
if (empty($url)) {
$url = $title;
}
edit_post($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $img, $vid, $revertPost, $publishDraft);
edit_video($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $video, $revertPost, $publishDraft);
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($link)) {
if (empty($url)) {
$url = $title;
}
edit_link($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $link, $revertPost, $publishDraft);
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($quote)) {
if (empty($url)) {
$url = $title;
}
edit_quote($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $quote, $revertPost, $publishDraft);
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($audio)) {
if (empty($url)) {
$url = $title;
}
edit_audio($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $audio, $revertPost, $publishDraft);
} else if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($is_post)) {
if (empty($url)) {
$url = $title;
}
edit_post($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $revertPost, $publishDraft);
} else {
$message['error'] = '';
if (empty($title)) {
@ -1511,22 +1979,48 @@ post('/:year/:month/:name/edit', function () {
if (!$proper) {
$message['error'] .= '<li>CSRF Token not correct.</li>';
}
if (!empty($is_image)) {
if (empty($image)) {
$message['error'] .= '<li>Image field is required.</li>';
}
} elseif (!empty($is_video)) {
if (empty($video)) {
$message['error'] .= '<li>Video field is required.</li>';
}
} elseif (!empty($is_link)) {
if (empty($link)) {
$message['error'] .= '<li>Link field is required.</li>';
}
} elseif (!empty($is_quote)) {
if (empty($quote)) {
$message['error'] .= '<li>Quote field is required.</li>';
}
} elseif (!empty($is_audio)) {
if (empty($audio)) {
$message['error'] .= '<li>Audio field is required.</li>';
}
}
config('views.root', 'system/admin/views');
render('edit-post', array(
'title' => 'Edit post - ' . blog_title(),
render($var, array(
'title' => 'Edit content - ' . blog_title(),
'description' => blog_description(),
'canonical' => site_url(),
'error' => '<ul>' . $message['error'] . '</ul>',
'oldfile' => $oldfile,
'postTitle' => $title,
'postImg' => $img,
'postVid' => $vid,
'postImage' => $image,
'postVideo' => $video,
'postLink' => $link,
'postQuote' => $quote,
'postAudio' => $audio,
'postTag' => $tag,
'postUrl' => $url,
'postContent' => $content,
'bodyclass' => 'editpost',
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Edit post'
'bodyclass' => 'editcontent',
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Edit content'
));
}
});


+ 6
- 4
system/includes/functions.php View File

@ -266,8 +266,11 @@ function get_posts($posts, $page = 1, $perpage = 0)
// Extract the title and body
$post->title = get_content_tag('t', $content, 'Untitled: ' . date('l jS \of F Y', $post->date));
$post->image = get_content_tag('img', $content);
$post->video = get_content_tag('vid', $content);
$post->image = get_content_tag('image', $content);
$post->video = str_replace(array("http://", "https://", "www.", "youtube", ".com", "/watch?v=", "/embed/"), "", get_content_tag('video', $content));
$post->link = get_content_tag('link', $content);
$post->quote = get_content_tag('quote', $content);
$post->audio = get_content_tag('audio', $content);
// Get the contents and convert it to HTML
$post->body = MarkdownExtra::defaultTransform(remove_html_comments($content));
@ -1878,8 +1881,7 @@ EOF;
}
echo '<li><a href="' . $base . 'admin/mine">Mine</a></li>';
echo '<li><a href="' . $base . 'admin/draft">Draft</a></li>';
echo '<li><a href="' . $base . 'add/post">Add post</a></li>';
echo '<li><a href="' . $base . 'add/page">Add page</a></li>';
echo '<li><a href="' . $base . 'admin/content">Add content</a></li>';
echo '<li><a href="' . $base . 'edit/profile">Edit profile</a></li>';
echo '<li><a href="' . $base . 'admin/import">Import</a></li>';
echo '<li><a href="' . $base . 'admin/backup">Backup</a></li>';


+ 2
- 2
themes/clean/css/style.css View File

@ -872,7 +872,7 @@ aside .copyright p {
@media all and (max-width: 560px) {
.featured-video {
.featured-video, .featured-audio {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
@ -880,7 +880,7 @@ aside .copyright p {
overflow: hidden;
}
.featured-video iframe, .featured-video object, .featured-video embed {
.featured-video iframe, .featured-video object, .featured-video embed, .featured-audio iframe, .featured-audio object, .featured-audio embed {
height: 100%;
left: 0;
position: absolute;


+ 17
- 2
themes/clean/main.html.php View File

@ -24,14 +24,29 @@
<a href="<?php echo $p->url ?>#comments"><span><fb:comments-count href=<?php echo $p->url ?>></fb:comments-count> Comments</span></a>
<?php } ?>
</div>
<?php if (!empty($p->image)) { ?>
<?php if (!empty($p->image)) { ?>
<div class="featured-image">
<a href="<?php echo $p->url ?>"><img src="<?php echo $p->image; ?>" alt="<?php echo $p->title ?>"/></a>
</div>
<?php } ?>
<?php if (!empty($p->video)) { ?>
<div class="featured-video">
<iframe src="https://www.youtube.com/embed/<?php echo $p->video; ?>" width="560" height="315" frameborder="0" allowfullscreen></iframe>
<iframe src="https://www.youtube.com/embed/<?php echo $p->video; ?>" width="560" height="315" frameborder="0" allowfullscreen></iframe>
</div>
<?php } ?>
<?php if (!empty($p->audio)) { ?>
<div class="featured-audio">
<iframe width="560" height="315" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=<?php echo $p->audio;?>&amp;auto_play=false&amp;visual=true"></iframe>
</div>
<?php } ?>
<?php if (!empty($p->quote)) { ?>
<div class="featured-quote">
<blockquote><?php echo $p->quote ?></blockquote>
</div>
<?php } ?>
<?php if (!empty($p->link)) { ?>
<div class="featured-quote">
<a href="<?php echo $p->link ?>"><?php echo $p->link ?></a>
</div>
<?php } ?>
<div class="teaser-body" itemprop="articleBody">


+ 25
- 10
themes/clean/post.html.php View File

@ -13,16 +13,31 @@
<span itemprop="author"><a href="<?php echo $p->authorUrl ?>"><?php echo $p->author ?></a></span> -
<span><a href="<?php echo $p->url ?>" rel="permalink">Permalink</a></span>
</div>
<?php if (!empty($p->image)) { ?>
<div class="featured-image">
<a href="<?php echo $p->url ?>"><img src="<?php echo $p->image; ?>" alt="<?php echo $p->title ?>"/></a>
</div>
<?php } ?>
<?php if (!empty($p->video)) { ?>
<div class="featured-video">
<iframe src="https://www.youtube.com/embed/<?php echo $p->video; ?>" width="560" height="315" frameborder="0" allowfullscreen></iframe>
</div>
<?php } ?>
<?php if (!empty($p->image)) { ?>
<div class="featured-image">
<a href="<?php echo $p->url ?>"><img src="<?php echo $p->image; ?>" alt="<?php echo $p->title ?>"/></a>
</div>
<?php } ?>
<?php if (!empty($p->video)) { ?>
<div class="featured-video">
<iframe src="https://www.youtube.com/embed/<?php echo $p->video; ?>" width="560" height="315" frameborder="0" allowfullscreen></iframe>
</div>
<?php } ?>
<?php if (!empty($p->audio)) { ?>
<div class="featured-audio">
<iframe width="560" height="315" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=<?php echo $p->audio;?>&amp;auto_play=false&amp;visual=true"></iframe>
</div>
<?php } ?>
<?php if (!empty($p->quote)) { ?>
<div class="featured-quote">
<blockquote><?php echo $p->quote ?></blockquote>
</div>
<?php } ?>
<?php if (!empty($p->link)) { ?>
<div class="featured-quote">
<a href="<?php echo $p->link ?>"><?php echo $p->link ?></a>
</div>
<?php } ?>
<div class="post-body" itemprop="articleBody">
<?php echo $p->body; ?>
</div>


+ 2
- 2
themes/default/css/style.css View File

@ -959,7 +959,7 @@ h1.title-post a:hover, h2.title-index a:hover {
@media all and (max-width: 560px) {
.featured-video {
.featured-video, .featured-audio {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
@ -967,7 +967,7 @@ h1.title-post a:hover, h2.title-index a:hover {
overflow: hidden;
}
.featured-video iframe, .featured-video object, .featured-video embed {
.featured-video iframe, .featured-video object, .featured-video embed, .featured-audio iframe, .featured-audio object, .featured-audio embed {
height: 100%;
left: 0;
position: absolute;


+ 17
- 2
themes/default/main.html.php View File

@ -24,14 +24,29 @@
<a href="<?php echo $p->url ?>#comments"><span><fb:comments-count href=<?php echo $p->url ?>></fb:comments-count> Comments</span></a>
<?php } ?>
</div>
<?php if (!empty($p->image)) { ?>
<?php if (!empty($p->image)) { ?>
<div class="featured-image">
<a href="<?php echo $p->url ?>"><img src="<?php echo $p->image; ?>" alt="<?php echo $p->title ?>"/></a>
</div>
<?php } ?>
<?php if (!empty($p->video)) { ?>
<div class="featured-video">
<iframe src="https://www.youtube.com/embed/<?php echo $p->video; ?>" width="560" height="315" frameborder="0" allowfullscreen></iframe>
<iframe src="https://www.youtube.com/embed/<?php echo $p->video; ?>" width="560" height="315" frameborder="0" allowfullscreen></iframe>
</div>
<?php } ?>
<?php if (!empty($p->audio)) { ?>
<div class="featured-audio">
<iframe width="560" height="315" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=<?php echo $p->audio;?>&amp;auto_play=false&amp;visual=true"></iframe>
</div>
<?php } ?>
<?php if (!empty($p->quote)) { ?>
<div class="featured-quote">
<blockquote><?php echo $p->quote ?></blockquote>
</div>
<?php } ?>
<?php if (!empty($p->link)) { ?>
<div class="featured-quote">
<a href="<?php echo $p->link ?>"><?php echo $p->link ?></a>
</div>
<?php } ?>
<div class="teaser-body" itemprop="articleBody">


+ 25
- 10
themes/default/post.html.php View File

@ -13,16 +13,31 @@
<span itemprop="author"><a href="<?php echo $p->authorUrl ?>"><?php echo $p->author ?></a></span> -
<span><a href="<?php echo $p->url ?>" rel="permalink">Permalink</a></span>
</div>
<?php if (!empty($p->image)) { ?>
<div class="featured-image">
<a href="<?php echo $p->url ?>"><img src="<?php echo $p->image; ?>" alt="<?php echo $p->title ?>"/></a>
</div>
<?php } ?>
<?php if (!empty($p->video)) { ?>
<div class="featured-video">
<iframe src="https://www.youtube.com/embed/<?php echo $p->video; ?>" width="560" height="315" frameborder="0" allowfullscreen></iframe>
</div>
<?php } ?>
<?php if (!empty($p->image)) { ?>
<div class="featured-image">
<a href="<?php echo $p->url ?>"><img src="<?php echo $p->image; ?>" alt="<?php echo $p->title ?>"/></a>
</div>
<?php } ?>
<?php if (!empty($p->video)) { ?>
<div class="featured-video">
<iframe src="https://www.youtube.com/embed/<?php echo $p->video; ?>" width="560" height="315" frameborder="0" allowfullscreen></iframe>
</div>
<?php } ?>
<?php if (!empty($p->audio)) { ?>
<div class="featured-audio">
<iframe width="560" height="315" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=<?php echo $p->audio;?>&amp;auto_play=false&amp;visual=true"></iframe>
</div>
<?php } ?>
<?php if (!empty($p->quote)) { ?>
<div class="featured-quote">
<blockquote><?php echo $p->quote ?></blockquote>
</div>
<?php } ?>
<?php if (!empty($p->link)) { ?>
<div class="featured-quote">
<a href="<?php echo $p->link ?>"><?php echo $p->link ?></a>
</div>
<?php } ?>
<div class="post-body" itemprop="articleBody">
<?php echo $p->body; ?>
</div>


+ 2
- 2
themes/logs/css/style.css View File

@ -889,7 +889,7 @@ table.post-list td a {
@media all and (max-width: 560px) {
.featured-video {
.featured-video, .featured-audio {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
@ -897,7 +897,7 @@ table.post-list td a {
overflow: hidden;
}
.featured-video iframe, .featured-video object, .featured-video embed {
.featured-video iframe, .featured-video object, .featured-video embed, .featured-audio iframe, .featured-audio object, .featured-audio embed {
height: 100%;
left: 0;
position: absolute;


+ 15
- 0
themes/logs/main.html.php View File

@ -34,6 +34,21 @@
<iframe src="https://www.youtube.com/embed/<?php echo $p->video; ?>" width="560" height="315" frameborder="0" allowfullscreen></iframe>
</div>
<?php } ?>
<?php if (!empty($p->audio)) { ?>
<div class="featured-audio">
<iframe width="560" height="315" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=<?php echo $p->audio;?>&amp;auto_play=false&amp;visual=true"></iframe>
</div>
<?php } ?>
<?php if (!empty($p->quote)) { ?>
<div class="featured-quote">
<blockquote><?php echo $p->quote ?></blockquote>
</div>
<?php } ?>
<?php if (!empty($p->link)) { ?>
<div class="featured-quote">
<a href="<?php echo $p->link ?>"><?php echo $p->link ?></a>
</div>
<?php } ?>
<div class="teaser-body" itemprop="articleBody">
<?php echo get_thumbnail($p->body) ?>
<p><?php echo get_teaser($p->body) ?>


+ 24
- 9
themes/logs/post.html.php View File

@ -14,15 +14,30 @@
<span><a href="<?php echo $p->url ?>" rel="permalink">Permalink</a></span>
</div>
<?php if (!empty($p->image)) { ?>
<div class="featured-image">
<a href="<?php echo $p->url ?>"><img src="<?php echo $p->image; ?>" alt="<?php echo $p->title ?>"/></a>
</div>
<?php } ?>
<?php if (!empty($p->video)) { ?>
<div class="featured-video">
<iframe src="https://www.youtube.com/embed/<?php echo $p->video; ?>" width="560" height="315" frameborder="0" allowfullscreen></iframe>
</div>
<?php } ?>
<div class="featured-image">
<a href="<?php echo $p->url ?>"><img src="<?php echo $p->image; ?>" alt="<?php echo $p->title ?>"/></a>
</div>
<?php } ?>
<?php if (!empty($p->video)) { ?>
<div class="featured-video">
<iframe src="https://www.youtube.com/embed/<?php echo $p->video; ?>" width="560" height="315" frameborder="0" allowfullscreen></iframe>
</div>
<?php } ?>
<?php if (!empty($p->audio)) { ?>
<div class="featured-audio">
<iframe width="560" height="315" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=<?php echo $p->audio;?>&amp;auto_play=false&amp;visual=true"></iframe>
</div>
<?php } ?>
<?php if (!empty($p->quote)) { ?>
<div class="featured-quote">
<blockquote><?php echo $p->quote ?></blockquote>
</div>
<?php } ?>
<?php if (!empty($p->link)) { ?>
<div class="featured-quote">
<a href="<?php echo $p->link ?>"><?php echo $p->link ?></a>
</div>
<?php } ?>
<div class="post-body" itemprop="articleBody">
<?php echo $p->body; ?>
</div>


Loading…
Cancel
Save