function oos_remove($source) { global $messageStack, $oos_remove_error; if (isset($oos_remove_error)) $oos_remove_error = false; if (is_dir($source)) { $dir = dir($source); while ($file = $dir->read()) { if ( ($file != '.') && ($file != '..') ) { if (is_writeable($source . '/' . $file)) { oos_remove($source . '/' . $file); } else { $messageStack->add(sprintf(ERROR_FILE_NOT_REMOVEABLE, $source . '/' . $file), 'error'); $oos_remove_error = true; } } } $dir->close(); if (is_writeable($source)) { rmdir($source); } else { $messageStack->add(sprintf(ERROR_DIRECTORY_NOT_REMOVEABLE, $source), 'error'); $oos_remove_error = true; } } else { if (is_writeable($source)) { unlink($source); } else { $messageStack->add(sprintf(ERROR_FILE_NOT_REMOVEABLE, $source), 'error'); $oos_remove_error = true; } } }
} if (!ereg('^' . OOS_FILE_MANAGER_ROOT_PATH, $_SESSION['current_path'])) { $_SESSION['current_path'] = OOS_FILE_MANAGER_ROOT_PATH; } $action = isset($_GET['action']) ? $_GET['action'] : ''; if (!empty($action)) { switch ($action) { case 'reset': unset($_SESSION['current_path']); oos_redirect_admin(oos_href_link_admin($aFilename['file_manager'])); break; case 'deleteconfirm': if (strstr($_GET['info'], '..')) { oos_redirect_admin(oos_href_link_admin($aFilename['file_manager'])); } oos_remove($_SESSION['current_path'] . '/' . $_GET['info']); if (!$oos_remove_error) { oos_redirect_admin(oos_href_link_admin($aFilename['file_manager'])); } break; case 'insert': if (mkdir($_SESSION['current_path'] . '/' . $_POST['folder_name'], 0777)) { oos_redirect_admin(oos_href_link_admin($aFilename['file_manager'], 'info=' . urlencode($_POST['folder_name']))); } break; case 'save': if ($fp = fopen($_SESSION['current_path'] . '/' . $_POST['filename'], 'w+')) { fputs($fp, stripslashes($_POST['file_contents'])); fclose($fp); oos_redirect_admin(oos_href_link_admin($aFilename['file_manager'], 'info=' . urlencode($_POST['filename']))); }
if (file_exists(OOS_FEEDS_EXPORT_PATH . $file_google)) { unlink(OOS_FEEDS_EXPORT_PATH . $file_google); } $fp = fopen(OOS_FEEDS_EXPORT_PATH . $file_google, "w"); $fout = fwrite($fp, $output); fclose($fp); if (!$dryrun) { $result = ftp_file($ftp_server, $ftp_user_name, $ftp_password, OOS_FEEDS_EXPORT_PATH . $file_google, $ftp_directory, $ftp_destination_file); } $messageStack->add(SUCCESS_EXPORT_DATABASE_SAVED, 'success'); break; case 'deleteconfirm': if (strstr($_GET['file'], '..')) { oos_redirect_admin(oos_href_link_admin($aFilename['export_googlebase'])); } oos_remove(OOS_FEEDS_EXPORT_PATH . '/' . $_GET['file']); if (!$oos_remove_error) { $messageStack->add_session(SUCCESS_EXPORT_DELETED, 'success'); oos_redirect_admin(oos_href_link_admin($aFilename['export_googlebase'])); } break; } } // check if the backup directory exists $dir_ok = false; if (is_dir(oos_get_local_path(OOS_FEEDS_EXPORT_PATH))) { if (is_writeable(oos_get_local_path(OOS_FEEDS_EXPORT_PATH))) { $dir_ok = true; } else { $messageStack->add(ERROR_EXPORT_DIRECTORY_NOT_WRITEABLE, 'error'); }
$buffer = fread($fp, filesize(OOS_PSM_PATH . $_GET['file'])); fclose($fp); header('Content-type: application/x-octet-stream'); header('Content-disposition: attachment; filename=' . $_GET['file']); echo $buffer; exit; } } else { $messageStack->add(ERROR_DOWNLOAD_LINK_NOT_ACCEPTABLE, 'error'); } break; case 'deleteconfirm': if (strstr($_GET['file'], '..')) oos_redirect_admin(oos_href_link_admin($aFilename['export_preissuchmaschine'])); oos_remove(OOS_PSM_PATH . $_GET['file']); if (!$oos_remove_error) { $messageStack->add_session(SUCCESS_PSM_DELETED, 'success'); oos_redirect_admin(oos_href_link_admin($aFilename['export_preissuchmaschine'])); } break; } } // check if the preissuchmaschine directory exists $dir_ok = false; if (is_dir(oos_get_local_path(OOS_PSM_PATH))) { $dir_ok = true; if (!is_writeable(oos_get_local_path(OOS_PSM_PATH))) $messageStack->add(ERROR_PSM_DIRECTORY_NOT_WRITEABLE, 'error'); } else { $messageStack->add(ERROR_PSM_DIRECTORY_DOES_NOT_EXIST, 'error');