/** * [upload multi file] * @param $source [Đường dẫn nơi chứa file upload] * @param $folder [Tên thư mục sẽ tạo khi upload] */ function upload_multi_file($source, $folder) { $flag = true; if (isset($_FILES['images']['name']) && $_FILES['images']['name'] != null) { // Check folder // Create folder if (!is_dir($source . $folder)) { mkdir($source . $folder, 0770); } else { delete_folder($source . $folder); mkdir($source . $folder, 0770); } // Check type file image foreach ($_FILES['images']['type'] as $key => $value) { $type = substr($value, 6); if ($type == "png" || $type == "jpeg" || $type == "jpg") { //Loop through each file for ($i = 0; $i < count($_FILES['images']['name']); $i++) { $tmpPath = $_FILES['images']['tmp_name'][$i]; $images = $_FILES['images']['name'][$i]; if ($tmpPath != null) { $path = $source . $folder . "/"; move_uploaded_file($tmpPath, $path . $images); } } } else { $flag = false; die("Type {$type} not support !!!"); } } } else { $flag = false; } return $flag; }
/** * Delete multi folder * @param array $data [các folder cần xóa] * @param string $path [dường dẫn tới nơi chứa folder cần xóa] */ function delete_multi_folder($data = array(), $path) { if ($data) { foreach ($data as $value) { delete_folder($path . $value); } } }
function delete($folderID) { $result = false; if ($folderID != "") { include '../access.php'; $access = checkAccess('n', 't'); if ($access) { $user = new User(); $username = $user->getUsername(); include "../includes/bookmarks.php"; if (f_belongs_to($folderID, $username, "../")) { $resultArr = delete_folder($folderID, $username, "../"); $result = $resultArr['success']; } } } return $result; }
showMedia($dirPath); break; case "newdir": if (ini_get('safe_mode') == "On") { mosRedirect("index2.php?option=com_media&listdir=" . $_POST['dirPath'], T_("Directory creation not allowed while running in SAFE MODE as this can cause problems.")); } else { create_folder($foldername, $dirPath); } showMedia($dirPath); break; case "delete": delete_file($delFile, $listdir); showMedia($listdir); break; case "deletefolder": delete_folder($delFolder, $listdir); showMedia($listdir); break; case "list": listImages($listdir); break; default: showMedia($listdir); break; } function delete_file($delfile, $listdir) { global $mosConfig_absolute_path; $del_image = $mosConfig_absolute_path . "/images/stories" . $listdir . "/" . $delfile; unlink($del_image); }
function delete_folder($folder) { $dir = @opendir($folder); while ($item = readdir($dir)) { if (is_dir("{$folder}/{$item}")) { if ($item != '.' && $item != '..') { delete_folder("{$folder}/{$item}"); } } else { @unlink("{$folder}/{$item}"); } } closedir($dir); @rmdir($folder); }
/** * Delete or create a filder * * @param boolean $set <b>true</b> Create a folder * <b>false</b> Delete the folder */ public function updateFolder($set) { if ($this->hasFolder() && !$set) { delete_folder($this->hasFolder(), true); } if (!$this->hasFolder() && $set) { create_folder(_("Dateiordner der Gruppe:") . ' ' . $this->name, _("Ablage für Ordner und Dokumente dieser Gruppe"), $this->id, 15); } }
delete_file("application/models/stock_model.php"); delete_file("application/modules_core/admin/views/admin_login.php"); delete_file("application/modules_core/admin/views/admin_signin_fail.php"); delete_file("application/modules_core/admin/views/welcome.php"); delete_file("application/modules_core/appointment/views/addfromfollowup.php"); delete_file("application/modules_core/appointment/views/editAvailableApp.php"); delete_file("application/modules_core/appointment/views/edit.php"); delete_file("application/modules_core/appointment/views/add.php"); delete_file("application/modules_core/appointment/views/addApp.php"); delete_file("application/modules_core/appointment/views/CancelAppointment.php"); delete_file("application/modules_core/contact/controllers/contact.php"); delete_folder("application/modules_core/contact/controllers"); delete_file("application/modules_core/contact/views/add.php"); delete_file("application/modules_core/contact/views/browse.php"); delete_file("application/modules_core/contact/views/edit.php"); delete_folder("application/modules_core/contact/views"); execute_sql_file("sql/013.sql", $dbprefix, $con); $current_version = '0.1.3'; } if ($current_version == '0.1.3') { display_information("Upgrading from 0.1.3 to 0.1.4"); execute_sql_file("sql/014.sql", $dbprefix, $con); //Delete not required files delete_file("application/modules_core/patient/views/add_patient.php"); delete_file("application/modules_core/patient/views/add_patient_old.php"); delete_file("application/modules_core/patient/views/edit.php"); delete_file("application/modules_core/patient/views/visit_view.php"); delete_file("application/modules_core/payment/views/advance_payment.php"); $current_version = '0.1.4'; } if ($current_version == '0.1.4') {
$response = array('error' => 0, 'folder_id' => $folder_id, 'folders' => $folders); } else { $response = array('error' => 1, 'error_message' => $folder_id); } echo $json_encoder->encode($response); exit; } // delete folder if ($site->user->user_id && $site->fdat['op'] == 'delete_folder' && (int) $site->fdat['folder_id']) { verify_form_token(); include_once $class_path . 'adminpage.inc.php'; include_once $class_path . 'custom.inc.php'; include_once $class_path . 'lgpl/Services_JSON.class.php'; $json_encoder = new Services_JSON(); $folder_id = (int) $site->fdat['folder_id']; $delete_message = delete_folder($folder_id); if ($delete_message === true) { $response = array('error' => 0); } else { $response = array('error' => 1, 'error_message' => $delete_message); } echo $json_encoder->encode($response); exit; } // edit folder if ($site->user->user_id && $site->fdat['op'] == 'edit_folder' && (int) $site->fdat['folder_id'] && $site->fdat['name']) { verify_form_token(); include_once $class_path . 'adminpage.inc.php'; include_once $class_path . 'custom.inc.php'; include_once $class_path . 'lgpl/Services_JSON.class.php'; $json_encoder = new Services_JSON();
<?php /** * * delete folder page, the site deletes a folder * * @author Patrick Lockley * @version 1.0 * @copyright Copyright (c) 2008,2009 University of Nottingham * @package */ require_once '../../../config.php'; include "../folder_library.php"; delete_folder(mysql_real_escape_string($_POST['folder_id']));
exit; } if (isset($_GET["file-info"])) { file_info(); exit; } if (isset($_GET["download-file"])) { download_file(); exit; } if (isset($_GET["create-folder"])) { create_folder(); exit; } if (isset($_GET["delete-folder"])) { delete_folder(); exit; } if (isset($_GET["share-folder"])) { share_folder(); exit; } if (isset($_GET["unshare-rsync"])) { rsync_unshare(); exit; } if (isset($_GET["upload-file"])) { upload_file_popup(); exit; } if (isset($_GET["form-upload"])) {
} if(isset($_GET["chgperms-js"])){chgperms_js();exit;} if(isset($_POST["chgperms-file"])){chgperms_file();exit;} if(isset($_GET["remove-file-js"])){remove_file_js();exit;} if(isset($_POST["remove-file"])){remove_file();exit;} if(isset($_GET["popup"])){popup();exit;} if(isset($_GET["browse-folder"])){browse_folder();exit;} if(isset($_GET["folder-infos"])){folder_infos();exit;} if(isset($_GET["top-bar"])){top_bar();exit;} if(isset($_GET["file-info"])){file_info();exit;} if(isset($_GET["download-file"])){download_file();exit;} if(isset($_GET["create-folder"])){create_folder();exit;} if(isset($_GET["delete-folder"])){delete_folder();exit;} if(isset($_GET["share-folder"])){share_folder();exit;} if(isset($_GET["unshare-rsync"])){rsync_unshare();exit;} if(isset($_GET["upload-file"])){upload_file_popup();exit;} if(isset($_GET["form-upload"])){upload_file_iframe();exit;} if( isset($_GET['TargetpathUploaded']) ){upload_form_perform();exit();} if(isset($_GET["loupe-js"])){loupe_js();exit;} if(isset($_GET["loupe-popup"])){loupe_popup();exit;} js(); function IsPriv(){ if(!is_object($GLOBALS["USERMENUS"])){$users=new usersMenus();$GLOBALS["USERMENUS"]=$users;}else{$users=$GLOBALS["USERMENUS"];} $users=new usersMenus();
<?php /** * Licensed to The Apereo Foundation under one or more contributor license * agreements. See the NOTICE file distributed with this work for * additional information regarding copyright ownership. * The Apereo Foundation licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * * delete folder page, the site deletes a folder * * @author Patrick Lockley * @version 1.0 * @package */ require_once '../../../config.php'; include "../folder_library.php"; delete_folder($_POST['folder_id']);
function delete_folder($path) { if (!is_dir($path)) { return false; } foreach (scandir($path) as $item) { if ($item != '.' && $item != '..') { if (is_file($path . '/' . $item)) { unlink($path . '/' . $item); } elseif (is_dir($path . '/' . $item)) { delete_folder($path . '/' . $item); } } } if (is_dir($path)) { rmdir($path); } if (is_dir($path)) { return false; } else { return true; } }
// this is the status flag I use to check if the actions where sucessful if (isset($_GET['getTreeXML'])) { echo get_tree_xml(); return; } if (isset($_GET['createdir'])) { // creates a directory $status = create_dir($dir, $enable_folder_creation, $fix_utf8); } else { if (isset($_GET['renamedir'])) { // Rename a directory $status = rename_dir($dir, $enable_folder_rename, $fix_utf8); } else { if (isset($_GET['deletedir'])) { // the check if the file can be deleted is done before - if it is not possible we never get here! $status = delete_folder($dir, $enable_folder_deletion, $fix_utf8); } } } // needed for browsing - we check if a [..] is possible - it is never allowed to go higher as the defined root! $show_root = isset($_SESSION["TFU_ROOT_DIR"]) ? $dir != $_SESSION["TFU_ROOT_DIR"] : false; if (isset($_GET['changedir'])) { // Change a directory $dir = change_folder($dir, $show_root, $enable_folder_browsing, $exclude_directories); } // needed for browsing - we check again because folder could have changed! $show_root = isset($_SESSION["TFU_ROOT_DIR"]) ? $dir != $_SESSION["TFU_ROOT_DIR"] : false; // Read all files and folders $size = read_dir($dir, $myFiles, $myDirs, $fix_utf8, $exclude_directories, $sort_files_by_date); // Sort files and folders sort_data($myFiles, $myDirs, $sort_files_by_date);
//wurde Code fuer Loeschen von Ordnern ubermittelt (=id+"_d_"), wird entsprechende Funktion aufgerufen if ($open_cmd == 'd') { if ( ($count = doc_count($open_id)) ){ $question = createQuestion(sprintf(_('Der ausgewählte Ordner enthält %s Datei(en). Wollen Sie den Ordner wirklich löschen?'), $count), array('open' => $open_id.'_rd_')); } else { delete_folder($open_id, true); $open_id = $folder_tree->getParents($open_id); $open_id = $open_id[0]; $folder_tree->init(); } } //Loeschen von Ordnern im wirklich-ernst Mode if ($open_cmd == 'rd') { delete_folder($open_id, true); $open_id = $folder_tree->getParents($open_id); $open_id = $open_id[0]; $folder_tree->init(); } //wurde Code fuer Loeschen von Dateien ubermittelt (=id+"_fd_"), wird erstmal nachgefragt if ($open_cmd == 'fd') { $query = "SELECT filename, {$_fullname_sql['full']} AS fullname, username FROM dokumente LEFT JOIN auth_user_md5 USING (user_id) LEFT JOIN user_info USING (user_id) WHERE dokument_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($open_id)); $result = $statement->fetch();
function delete_folder($tmp_path) { if (!is_writeable($tmp_path) && is_dir($tmp_path)) { chmod($tmp_path, 0777); } $handle = opendir($tmp_path); while ($tmp = readdir($handle)) { if ($tmp != '..' && $tmp != '.' && $tmp != '') { if (is_writeable($tmp_path . DS . $tmp) && is_file($tmp_path . DS . $tmp)) { unlink($tmp_path . DS . $tmp); } elseif (!is_writeable($tmp_path . DS . $tmp) && is_file($tmp_path . DS . $tmp)) { chmod($tmp_path . DS . $tmp, 0666); unlink($tmp_path . DS . $tmp); } if (is_writeable($tmp_path . DS . $tmp) && is_dir($tmp_path . DS . $tmp)) { delete_folder($tmp_path . DS . $tmp); } elseif (!is_writeable($tmp_path . DS . $tmp) && is_dir($tmp_path . DS . $tmp)) { chmod($tmp_path . DS . $tmp, 0777); delete_folder($tmp_path . DS . $tmp); } } } closedir($handle); rmdir($tmp_path); if (!is_dir($tmp_path)) { return true; } else { return false; } }
public function deletePhotos($object, $id) { global $db; $tmp_path = PHOTOS_PATH . $object . '/' . $id; if (!is_writeable($tmp_path) && is_dir($tmp_path)) { chmod($tmp_path, 0777); } $handle = opendir($tmp_path); while ($tmp = readdir($handle)) { if ($tmp != '..' && $tmp != '.' && $tmp != '') { if (is_writeable($tmp_path . '/' . $tmp) && is_file($tmp_path . '/' . $tmp)) { unlink($tmp_path . '/' . $tmp); } elseif (!is_writeable($tmp_path . '/' . $tmp) && is_file($tmp_path . '/' . $tmp)) { chmod($tmp_path . '/' . $tmp, 0666); unlink($tmp_path . '/' . $tmp); } if (is_writeable($tmp_path . '/' . $tmp) && is_dir($tmp_path . '/' . $tmp)) { delete_folder($tmp_path . '/' . $tmp); } elseif (!is_writeable($tmp_path . '/' . $tmp) && is_dir($tmp_path . '/' . $tmp)) { chmod($tmp_path . '/' . $tmp, 0777); delete_folder($tmp_path . '/' . $tmp); } } } closedir($handle); rmdir($tmp_path); $db->query("DELETE FROM photo WHERE object_id={$id} AND kind_id=" . $object); if (!is_dir($tmp_path)) { return true; } else { return false; } }
/** * [_upload description] * @param string $folder [Tên thư mục sẽ tạo upload] * @return [type] [description] */ private function _upload($folder = "") { $flag = true; if (isset($_FILES['image']['name']) && $_FILES['image']['name'] != null) { // Check folder // Create folder if (!is_dir("uploads/slider/" . $folder)) { mkdir("uploads/slider/" . $folder, 0770); } else { delete_folder("uploads/slider/" . $folder); mkdir("uploads/slider/" . $folder, 0770); } $path = "uploads/slider/" . $folder . "/"; $image = $_FILES['image']['name']; $tmp_name = $_FILES['image']['tmp_name']; // Check type file image $type = substr($_FILES['image']['type'], 6); if ($type == "png" || $type == "jpeg" || $type == "jpg") { move_uploaded_file($tmp_name, $path . $image); } else { $flag = false; $this->view->errorImage = "Type file not support !!!"; } } else { $flag = false; } return $flag; }
showMedia($dirPath); break; case 'newdir': if (ini_get('safe_mode') == 'On') { mosRedirect("index2.php?option=com_media&listdir=" . $_POST['dirPath'], "Directory creation not allowed while running in SAFE MODE as this can cause problems."); } else { create_folder($dirPath); } showMedia($dirPath); break; case 'delete': delete_file($listdir); showMedia($listdir); break; case 'deletefolder': delete_folder($listdir); showMedia($listdir); break; case 'list': listImages($listdir); break; case 'cancel': mosRedirect('index2.php'); break; default: showMedia($listdir); break; } /** * Deletes a file * @param string The relative folder path to the file
/** * Delete Upload Directory * * @since 1.0 * @uses GSTHUMBNAILPATH * @uses GSDATAUPLOADPATH * * @param string $path relative path to uploaded file folder * @return bool success */ function delete_upload_dir($path) { $target = GSDATAUPLOADPATH . $path; if (path_is_safe($target, GSDATAUPLOADPATH) && file_exists($target)) { $status = delete_folder($target); // delete thumbs folder if (file_exists(GSTHUMBNAILPATH . $path)) { delete_dir(GSTHUMBNAILPATH . $path); } return $status; } }
function delete_folder($folder_id, $delete_subfolders = false) { global $msg; if ($delete_subfolders){ list($subfolders, $num_subfolders) = getFolderChildren($folder_id); if ($num_subfolders){ foreach ($subfolders as $one_folder){ delete_folder($one_folder, true); } } } $query = "SELECT folder_id, name FROM folder WHERE folder_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($folder_id)); $temp = $statement->fetch(PDO::FETCH_ASSOC); if ($temp) { $foldername = $temp['name']; $query = "SELECT dokument_id FROM dokumente WHERE range_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($folder_id)); while ($dokument_id = $statement->fetchColumn()) { if (delete_document($dokument_id)) { $deleted++; } } $query = "DELETE FROM folder WHERE folder_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($folder_id)); if ($statement->rowCount()) { if ($deleted) { $msg.="info§" . sprintf(_("Der Dateiordner <b>%s</b> und %s Dokument(e) wurden gelöscht"), htmlReady($foldername), $deleted) . "§"; } else { $msg.="info§" . sprintf(_("Der Dateiordner <b>%s</b> wurde gelöscht"),htmlReady($foldername)) . "§"; return TRUE; } } else { if ($deleted){ $msg.="error§" . sprintf(_("Probleme beim Löschen des Ordners <b>%s</b>. %u Dokument(e) wurden gelöscht"),htmlReady($foldername), $deleted) . "§"; }else{ $msg.="error§" . sprintf(_("Probleme beim Löschen des Ordners <b>%s</b>"),htmlReady($foldername)) . "§"; } return FALSE; } } }
} } } $refresh_dirs = false; $clearUploads = false; if (strrpos($FILE_ROOT, '/') != strlen($FILE_ROOT) - 1) { $FILE_ROOT .= '/'; } if (isset($_GET['create']) && isset($_GET['dir'])) { create_folder(); } if (isset($_GET['delFile']) && isset($_GET['dir'])) { delete_file($_GET['delFile']); } if (isset($_GET['delFolder']) && isset($_GET['dir'])) { delete_folder($_GET['delFolder']); } if (isset($_FILES['upload']) && is_array($_FILES['upload']) && isset($_POST['dirPath'])) { $dirPathPost = $_POST['dirPath']; if (strlen($dirPathPost) > 0) { if (substr($dirPathPost, 0, 1) == '/') { $FILE_ROOT .= $dirPathPost; } else { $FILE_ROOT = $dirPathPost; } } if (strrpos($FILE_ROOT, '/') != strlen($FILE_ROOT) - 1) { $FILE_ROOT .= '/'; } do_upload($_FILES['upload'], $BASE_DIR . $BASE_ROOT . $dirPathPost . '/'); }
if (!isset($_GET['n'])) { $_GET['n'] = 0; } if (!isset($_GET['p'])) { $_GET['p'] = 0; } else { switch ($_GET['p']) { case 'delete_photo': if (isset($_GET['id'])) { delete_photo($DB_GEGEVENS, $UPLOAD_FOLDER, $_GET['id']); header("Location: index.php?p=0&n=" . $_GET['n']); } break; case 'delete_folder': if (isset($_GET['id'])) { delete_folder($DB_GEGEVENS, $UPLOAD_FOLDER, $_GET['id']); header("Location: index.php?p=0"); } default: break; } } // page numbering $current_page = $_GET['n']; $albums_per_page = $FOTO_ALBUMS_PER_PAGE; $db = new DB($DB_GEGEVENS); $db->query("SELECT count(id) FROM folder"); $number_of_albums = $db->get_result(0); unset($db); $number_of_pages = ceil($number_of_albums / $albums_per_page); $start = $current_page * $albums_per_page;
function synchronise_folder($folder_id) { global $site; $folder_id = (int) $folder_id; $objekt = new Objekt(array('objekt_id' => $folder_id)); if ($objekt->objekt_id == $folder_id && $objekt->all['tyyp_id'] == 22) { $objekt->load_sisu(); $folder_path = preg_replace('#/$#', '', $site->absolute_path) . $objekt->all['relative_path']; // get folder & file count in this from database $sql = 'select count(objekt_id) from objekt_objekt where parent_id = ' . $folder_id; $result = new SQL($sql); $db_object_count = $result->fetchsingle(); // check if folder & file count from db matches count in file system $fs_object_count = 0; if ($dir = opendir($folder_path)) { while (false !== ($file = readdir($dir))) { if (strpos($file, '.') !== 0) { $fs_object_count++; // break counting if there are more files, syncro is needed if ($fs_object_count > $db_object_count) { break; } } } closedir($dir); } else { // not a folder ... TODO } //if the fs and db object count do not match syncronise folder contents if ($fs_object_count != $db_object_count) { // collect files and folder from fs $fs_files = array(); $fs_folders = array(); $dir = opendir($folder_path); while (false !== ($file = readdir($dir))) { if (strpos($file, '.') !== 0) { if (is_dir($folder_path . '/' . $file)) { $fs_folders[$file] = $file; } else { $fs_files[$file] = array('filename' => $file, 'size' => @filesize($folder_path . '/' . $file), 'mimetype' => get_file_mime_content_type($folder_path . '/' . $file)); } } } closedir($dir); // files first $sql = 'select obj_file.objekt_id, filename, mimetype, size from obj_file left join objekt_objekt on obj_file.objekt_id = objekt_objekt.objekt_id where parent_id = ' . $folder_id; $result = new SQL($sql); $files_to_delete = array(); while ($row = $result->fetch('ASSOC')) { // mark files not found in fs for deletion if (!$fs_files[$row['filename']]) { $files_to_delete[] = $row['objekt_id']; } else { // update file size, mimetype if needed if ($fs_files[$row['filename']]['size'] != $row['size'] || $fs_files[$row['filename']]['mimetype'] != $row['mimetype']) { $sql = $site->db->prepare("update obj_file set size = ?, mimetype = ? where objekt_id = ?", $fs_files[$row['filename']]['size'], $fs_files[$row['filename']]['mimetype'], $row['objekt_id']); new SQL($sql); // set $sql = $site->db->prepare("update objekt set changed_time = now(), changed_user_id = ?, changed_user_name = ? where objekt_id = ?", $site->user->user_id, $site->user->name, $row['objekt_id']); new SQL($sql); } // check for thumbnail if (!file_exists($folder_path . '/.thumbnails/' . $row['filename'])) { // create thumbnail create_file_thumbnail($folder_path . '/' . $row['filename']); } // remove from fs object array unset($fs_files[$row['filename']]); } } // delete files not in fs TODO: catch errors from file delete delete_files($files_to_delete); // left over files are new, create them foreach ($fs_files as $filename => $file) { $safe_filename = safe_filename2($filename); if ($safe_filename != $filename) { if (rename($folder_path . '/' . $filename, $folder_path . '/' . $safe_filename)) { } else { // log unable to rename, skip new Log(array('action' => 'create', 'component' => 'Files', 'type' => 'ERROR', 'message' => "Could not rename '" . $objekt->all['relative_path'] . '/' . $filename . "' to '" . $objekt->all['relative_path'] . '/' . $safe_filename . "', file system error.")); continue; } } // objekt insert_new_file_object($objekt, $filename, $file['size'], $file['mimetype']); // create thumbnail create_file_thumbnail($folder_path . '/' . $safe_filename); } // folders next $sql = 'select obj_folder.objekt_id, relative_path from obj_folder left join objekt_objekt on obj_folder.objekt_id = objekt_objekt.objekt_id where parent_id = ' . $folder_id; $result = new SQL($sql); $folders_to_delete = array(); while ($row = $result->fetch('ASSOC')) { $folder_name = str_replace($objekt->all['relative_path'] . '/', '', $row['relative_path']); // mark folders not found in fs for deletion if (!$fs_folders[$folder_name]) { $folders_to_delete[] = $row['objekt_id']; } else { // remove from fs object array unset($fs_folders[$folder_name]); } } // delete folders present in db but not present in fs foreach ($folders_to_delete as $folder_id) { // TODO: error catching from folder deleting delete_folder($folder_id); } // create new folders foreach ($fs_folders as $folder_name) { create_folder($folder_name, $objekt->objekt_id); } new Log(array('action' => 'sync', 'component' => 'Files', 'objekt_id' => $objekt->objekt_id, 'message' => "Folder '" . $objekt->all['relative_path'] . "' (ID = " . $objekt->objekt_id . ") synchronised.")); // recurse? return true; } else { // nothing to syncro return true; } } else { return 'no_such_folder_object'; } }
function delete_module($dir, $full = false) { $active = get_option('active_modules'); $path = ABSPATH . '/' . MODULES . '/' . $dir; if (is_dir($path) && file_exists($path . '/main.php')) { if (($key = array_multi_search($dir, $active, 0)) !== null) { unset($active[$key]); sort($active); if (file_exists($path . '/uninstall.php')) { require_once $path . '/uninstall.php'; } return update_option('active_modules', json_val_encode($active)); } if ($full) { return delete_folder($path); } } return false; }
$moveFolderId = $_POST['moveFolderId']; if ($moveFolderId != null) { $Query = "update " . TABLE_PREFIX . "folders set pid = '{$folderid}' where id='" . $moveFolderId . "'"; //echo($Query . "<br>\n"); $AffectedRows = $dblink->exec($Query); if ($AffectedRows == 0 || $AffectedRows == 1) { echo "<p class=\"success\">" . T_("You have successfully moved this folder") . "</p>"; $_SESSION["movetype"] = ""; $_SESSION["moveid"] = ""; } else { echo "<p class=\"error\">" . T_("There has been a problem when moving the folder") . ".</p>"; } } $delFolderId = $_POST['delFolderId']; if ($delFolderId != null) { $resultArr = delete_folder($delFolderId, $username); if ($resultArr['success']) { echo "<p class=\"success\">" . $resultArr['message'] . ".</p>"; } else { echo "<p class=\"error\">" . $resultArr['message'] . ".</p>"; } } // End of form actions $Query = "select title from " . TABLE_PREFIX . "folders where id='" . $folderid . "'"; $dbResult = $dblink->query($Query); $title = ""; if ($row =& $dbResult->fetchRow(DB_FETCHMODE_ASSOC)) { $title = "{$row["title"]}"; } if ($folderid != MAIN_FID) { $Query = "select pid from " . TABLE_PREFIX . "folders where (name='{$username}' and id='{$folderid}')";
} else { if ($action == "get_cloud") { $key = $_GET['key']; get_cloud($key); } else { if ($action == "get_elements") { $key = $_GET['key']; $id_cloud = $_GET['id_cloud']; $id_folder = $_GET['id_folder']; get_elements($key, $id_cloud, $id_folder); } else { if ($action == "delete_folder") { $key = $_GET['key']; $id_cloud = $_GET['id_cloud']; $id_folder = $_GET['id_folder']; delete_folder($key, $id_cloud, $id_folder); } else { if ($action == "delete_file") { $key = $_GET['key']; $id_cloud = $_GET['id_cloud']; $id_file = $_GET['id_file']; delete_file($key, $id_cloud, $id_file); } else { if ($action == "create_folder") { $key = $_GET['key']; $id_cloud = $_GET['id_cloud']; $id_folder = $_GET['id_folder']; $name = $_GET['name']; new_folder($key, $id_cloud, $id_folder, $name); } else { if ($action == "create_file") {