if (!$filetypes->get_type($extension)) { $filetypes->add_type($extension, $_FILES['file']['type'][$i]); } $name = $_FILES['file']['name'][$i]; $x = 0; while ($cms->file_exists($folder_id, $name)) { $x++; $name = strip_extension($_FILES['file']['name'][$i]) . ' (' . $x . ').' . get_extension($_FILES['file']['name'][$i]); } $fp = fopen($_FILES['file']['tmp_name'][$i], 'r'); $content = addslashes(fread($fp, $_FILES['file']['size'][$i])); fclose($fp); if (eregi('htm', get_extension($name))) { $content = $cms->get_body($content); } $file_id = $cms->add_file($folder_id, $name, $content); unlink($_FILES['file']['tmp_name'][$i]); } } } } break; case 'add_folder': if ($_SERVER['REQUEST_METHOD'] == 'POST') { $name = smart_addslashes(trim($_POST['name'])); if ($name == '') { $feedback = '<p class="Error">' . $error_missing_field; } elseif ($cms->folder_exists($folder_id, $name)) { $feedback = '<p class="Error">Mapnaam bestaat al</p>'; } elseif (!$cms->add_folder($folder_id, $name, $_POST['priority'], isset($_POST['disabled']))) { $feedback = '<p class="Error">' . $strSaveError . '</p>';
exit; } if ($task == 'save') { if ($file_id > 0) { //fix for inserted iframes $content = preg_replace("'<iframe([^>]*)/>'si", "<iframe\$1></iframe>", $_POST['content']); $cms->update_file($file_id, smart_addslashes($_POST['name']), smart_addslashes($content), smart_addslashes($_POST['title']), smart_addslashes($_POST['description']), smart_addslashes($_POST['keywords']), $_POST['priority'], $_POST['hot_item']); } else { $name = smart_addslashes(trim($_POST['name'])); if ($name == '') { $feedback = '<p class="Error">' . $error_missing_field . '</p>'; } else { $filename = $name . '.html'; if ($cms->file_exists($folder_id, $filename)) { $feedback = '<p class="Error">' . $fbNameExists . '</p>'; } elseif (!($file_id = $cms->add_file($folder_id, $filename, smart_addslashes($_POST['content']), '', '', '', $_POST['priority']))) { $feedback = '<p class="Error">' . $strSaveError . '</p>'; } } } } if ($file_id > 0) { $file = $cms->get_file($file_id); $content = $file['content']; $name = $file['name']; $title = $file['title']; $description = $file['description']; $keywords = $file['keywords']; $priority = $file['priority']; $hot_item = $file['hot_item']; } else {