fff = new \Modules\FilesInFolders(
$f3->get('current_page_folder')
);
}
function menu() {
return 'clear cache';
}
function receive_edit() {
$f3 = \Base::instance();
$f3->reroute("?admin=1");
}
function index() {
$f3 = \Base::instance();
$mods = [];
if ($edit_type = $f3->get("GET.edit")) {
$this->classes[] = 'visible';
switch ($edit_type) {
case 'txt':
$file = $f3->get("GET.file");
$mods[] = $this->text_editor($file);
break;
}
}
$mods[] = $this->list_content_folder();
return implode("",$mods);
//return $this->clear_cache();
}
function clear_cache() {
$CI = new \Modules\CachedImage("rsc/img/default.png");
$cache_dir = $CI->cache_dir;
$ls = scandir($cache_dir);
$count = 0;
foreach($ls as $file) {
if(!strncmp(".",$file,1)) continue;
unlink($cache_dir."".$file);
$count++;
}
return "erased $count files
";
}
function get_type($file) {
if (is_dir($file)) {
return 'dir';
} else if (is_file($file)) {
$ex = array_pop(explode(".",$file));
foreach ($this->fff->EXT as $type => $array) {
if (in_array(strtolower($ex),$array)) {
return $type;
}
}
return 'unkown';
}
}
function text_editor($file) {
if (is_file($file)) {
return sprintf('