<?php if (!defined('BASEPATH')) { exit('No direct script access allowed'); } require_once ENGINE_DIR . 'additions/auth-session.php'; if (!mso_auth('<p class="t-center mar20"><a href="?login" class="button">Login</a></p>')) { return; } ?> <div class="mar20"> <?php $directory = BASE_DIR . 'lpf-content/'; $directory = str_replace('\\', '/', $directory); $r = new RecursiveDirectoryIterator($directory); $files = _getFiles($r, 0, $directory); $content_file = ''; $file_path = ''; $select = '<option value="" selected>-</option>'; foreach ($files as $file) { if (strpos($file, 'optgroup') === false) { $select .= '<option value="' . base64_encode($file) . '">' . $file . '</option>'; } else { $select .= $file; } } ?> <p class="mar30-t">Select file <select id="select_file" class="w-auto"><?php echo $select;
if (!defined('BASEPATH')) { exit('No direct script access allowed'); } require_once ENGINE_DIR . 'additions/auth-session.php'; if (isset($_POST['content']) and isset($_POST['file_path']) and $_POST['file_path']) { if (!mso_auth('')) { return; } $file = base64_decode($_POST['file_path']); $file = str_replace('~', '-', $file); $file = str_replace('\\', '-', $file); $file = BASE_DIR . 'lpf-content/' . $file; if (file_exists($file)) { file_put_contents($file, $_POST['content']); echo '<span class="mar10-l t-green t130">✔</span> Saved'; } else { echo '<span class="mar10-l t-red t130">✖</span> File not found'; } } elseif (isset($_POST['load']) and isset($_POST['file']) and $post = $_POST['file']) { if (!mso_auth('')) { return; } $file = base64_decode($post); $file = str_replace('~', '-', $file); $file = str_replace('\\', '-', $file); $file = BASE_DIR . 'lpf-content/' . $file; if (file_exists($file)) { echo file_get_contents($file); } } # end of file