|
|
@ -876,141 +876,6 @@ function get_feed($feed_url, $credit) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Get recent posts by user
|
|
|
|
|
|
function get_user_posts() |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
if (isset($_SESSION[config("site.url")]['user'])) { |
|
|
|
|
|
$posts = get_profile_posts($_SESSION[config("site.url")]['user'], 1, 5); |
|
|
|
|
|
if (!empty($posts)) { |
|
|
|
|
|
echo '<table class="table post-list">'; |
|
|
|
|
|
echo '<tr class="head"><th>' . i18n('Title') . '</th><th>' . i18n('Published') . '</th>'; |
|
|
|
|
|
if (config("views.counter") == "true") |
|
|
|
|
|
echo '<th>'.i18n('Views').'</th>'; |
|
|
|
|
|
echo '<th>' . i18n('Category') . '</th><th>' . i18n('Tags') . '</th><th>' . i18n('Operations') . '</th></tr>'; |
|
|
|
|
|
$i = 0; |
|
|
|
|
|
$len = count($posts); |
|
|
|
|
|
foreach ($posts as $p) { |
|
|
|
|
|
if ($i == 0) { |
|
|
|
|
|
$class = 'item first'; |
|
|
|
|
|
} elseif ($i == $len - 1) { |
|
|
|
|
|
$class = 'item last'; |
|
|
|
|
|
} else { |
|
|
|
|
|
$class = 'item'; |
|
|
|
|
|
} |
|
|
|
|
|
$i++; |
|
|
|
|
|
echo '<tr class="' . $class . '">'; |
|
|
|
|
|
echo '<td><a target="_blank" href="' . $p->url . '">' . $p->title . '</a></td>'; |
|
|
|
|
|
echo '<td>' . format_date($p->date) . '</td>'; |
|
|
|
|
|
if (config("views.counter") == "true") |
|
|
|
|
|
echo '<td>' . $p->views . '</td>'; |
|
|
|
|
|
echo '<td><a href="' . str_replace('category', 'admin/categories', $p->categoryUrl) . '">'. strip_tags($p->category) .'</a></td>'; |
|
|
|
|
|
echo '<td>' . $p->tag . '</td>'; |
|
|
|
|
|
echo '<td><a class="btn btn-primary btn-xs" href="' . $p->url . '/edit?destination=admin">' . i18n('Edit') . '</a> <a class="btn btn-danger btn-xs" href="' . $p->url . '/delete?destination=admin">' . i18n('Delete') . '</a></td>'; |
|
|
|
|
|
echo '</tr>'; |
|
|
|
|
|
} |
|
|
|
|
|
echo '</table>'; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Get all static pages
|
|
|
|
|
|
function get_user_pages() |
|
|
|
|
|
{ |
|
|
|
|
|
if (isset($_SESSION[config("site.url")]['user'])) { |
|
|
|
|
|
$posts = get_static_post(null); |
|
|
|
|
|
if (!empty($posts)) { |
|
|
|
|
|
krsort($posts); |
|
|
|
|
|
echo '<table class="table post-list">'; |
|
|
|
|
|
echo '<tr class="head"><th>' . i18n('Title') . '</th>'; |
|
|
|
|
|
if (config("views.counter") == "true") |
|
|
|
|
|
echo '<th>'.i18n('Views').'</th>'; |
|
|
|
|
|
echo '<th>' . i18n('Operations') . '</th></tr>'; |
|
|
|
|
|
$i = 0; |
|
|
|
|
|
$len = count($posts); |
|
|
|
|
|
foreach ($posts as $p) { |
|
|
|
|
|
if ($i == 0) { |
|
|
|
|
|
$class = 'item first'; |
|
|
|
|
|
} elseif ($i == $len - 1) { |
|
|
|
|
|
$class = 'item last'; |
|
|
|
|
|
} else { |
|
|
|
|
|
$class = 'item'; |
|
|
|
|
|
} |
|
|
|
|
|
$i++; |
|
|
|
|
|
|
|
|
|
|
|
echo '<tr class="' . $class . '">'; |
|
|
|
|
|
echo '<td><a target="_blank" href="' . $p->url . '">' . $p->title . '</a></td>'; |
|
|
|
|
|
if (config("views.counter") == "true") |
|
|
|
|
|
echo '<td>' . $p->views . '</td>'; |
|
|
|
|
|
echo '<td><a class="btn btn-primary btn-xs" href="' . $p->url . '/add?destination=admin/pages">' . i18n('Add_sub') . '</a> <a class="btn btn-primary btn-xs" href="' . $p->url . '/edit?destination=admin/pages">' . i18n('Edit') . '</a> <a class="btn btn-danger btn-xs" href="' . $p->url . '/delete?destination=admin/pages">' . i18n('Delete') . '</a></td>'; |
|
|
|
|
|
echo '</tr>'; |
|
|
|
|
|
|
|
|
|
|
|
$shortUrl = substr($p->url, strrpos($p->url, "/") + 1); |
|
|
|
|
|
$subPages = get_static_sub_post($shortUrl, null); |
|
|
|
|
|
|
|
|
|
|
|
foreach ($subPages as $sp) { |
|
|
|
|
|
echo '<tr class="' . $class . '">'; |
|
|
|
|
|
echo '<td> <span style="margin-left:30px;">» <a target="_blank" href="' . $sp->url . '">' . $sp->title . '</a></span></td>'; |
|
|
|
|
|
if (config("views.counter") == "true") |
|
|
|
|
|
echo '<td>' . $sp->views . '</td>'; |
|
|
|
|
|
echo '<td><a class="btn btn-primary btn-xs" href="' . $sp->url . '/edit?destination=admin/pages">' . i18n('Edit') . '</a> <a class="btn btn-danger btn-xs" href="' . $sp->url . '/delete?destination=admin/pages">' . i18n('Delete') . '</a></td>'; |
|
|
|
|
|
echo '</tr>'; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
echo '</table>'; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Get all available zip files
|
|
|
|
|
|
function get_backup_files() |
|
|
|
|
|
{ |
|
|
|
|
|
if (isset($_SESSION[config("site.url")]['user'])) { |
|
|
|
|
|
$files = get_zip_files(); |
|
|
|
|
|
if (!empty($files)) { |
|
|
|
|
|
krsort($files); |
|
|
|
|
|
echo '<table class="table backup-list">'; |
|
|
|
|
|
echo '<tr class="head"><th>' . i18n('Filename') . '</th><th>'.i18n('Date').'</th><th>' . i18n('Operations') . '</th></tr>'; |
|
|
|
|
|
$i = 0; |
|
|
|
|
|
$len = count($files); |
|
|
|
|
|
foreach ($files as $file) { |
|
|
|
|
|
|
|
|
|
|
|
if ($i == 0) { |
|
|
|
|
|
$class = 'item first'; |
|
|
|
|
|
} elseif ($i == $len - 1) { |
|
|
|
|
|
$class = 'item last'; |
|
|
|
|
|
} else { |
|
|
|
|
|
$class = 'item'; |
|
|
|
|
|
} |
|
|
|
|
|
$i++; |
|
|
|
|
|
|
|
|
|
|
|
// Extract the date
|
|
|
|
|
|
$arr = explode('_', $file); |
|
|
|
|
|
|
|
|
|
|
|
// Replaced string
|
|
|
|
|
|
$replaced = substr($arr[0], 0, strrpos($arr[0], '/')) . '/'; |
|
|
|
|
|
|
|
|
|
|
|
$name = str_replace($replaced, '', $file); |
|
|
|
|
|
|
|
|
|
|
|
$date = str_replace('.zip', '', $arr[1]); |
|
|
|
|
|
$t = str_replace('-', '', $date); |
|
|
|
|
|
$time = new DateTime($t); |
|
|
|
|
|
$timestamp = $time->format("D, d F Y, H:i:s"); |
|
|
|
|
|
|
|
|
|
|
|
$url = site_url() . $file; |
|
|
|
|
|
echo '<tr class="' . $class . '">'; |
|
|
|
|
|
echo '<td>' . $name . '</td>'; |
|
|
|
|
|
echo '<td>' . $timestamp . '</td>'; |
|
|
|
|
|
echo '<td><a class="btn btn-primary btn-xs" target="_blank" href="' . $url . '">Download</a> <form method="GET"><input type="hidden" name="file" value="' . $name . '"/><input type="submit" class="btn btn-danger btn-xs" name="submit" value="Delete"/></form></td>'; |
|
|
|
|
|
echo '</tr>'; |
|
|
|
|
|
} |
|
|
|
|
|
echo '</table>'; |
|
|
|
|
|
} else { |
|
|
|
|
|
echo i18n('No_available_backup'); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function clear_post_cache($post_date, $post_tag, $post_url, $filename, $category, $type) |
|
|
function clear_post_cache($post_date, $post_tag, $post_url, $filename, $category, $type) |
|
|
{ |
|
|
{ |
|
|
$b = str_replace('/', '#', site_path() . '/'); |
|
|
$b = str_replace('/', '#', site_path() . '/'); |
|
|
|