Ejemplo n.º 1
1
function deleteDir($dir)
{
    if (substr($dir, strlen($dir) - 1, 1) != '/') {
        $dir .= '/';
    }
    if ($handle = opendir($dir)) {
        while ($obj = readdir($handle)) {
            if ($obj != '.' && $obj != '..') {
                if (is_dir($dir . $obj)) {
                    if (!deleteDir($dir . $obj)) {
                        return false;
                    }
                } elseif (is_file($dir . $obj)) {
                    if (!unlink($dir . $obj)) {
                        return false;
                    }
                }
            }
        }
        closedir($handle);
        if (!@rmdir($dir)) {
            return false;
        }
        return true;
    }
    return false;
}
Ejemplo n.º 2
0
function deleteDir($dir) {
	$dir = (substr($dir,0,-1)!='/')?$dir.'/':$dir;

	if (OS == 'unix') {

	} else {
		if (file_exists($dir)) {
			if ($handle = @opendir($dir)) {
				while (false !== ($file = readdir($handle))) {
					if ($file != '.' && $file != '..') {
						if (is_dir($dir.$file)) {
							deleteDir($dir.$file.'/');
							@rmdir($dir.$file);
						}
						if (is_file($dir.$file)) {
							deleteFile($dir.$file);
						}
					}
				}
				closedir($handle);
			}
			rmdir($dir);
		}
	}
}
Ejemplo n.º 3
0
/**
 * ALLADiN操作ログをテーブルからCSV出力/圧縮
 * @param $core object
 * @param $logTableList array
 * @param $monthsAgo int
 * return ログデータ配列
 */
function outputLogData(&$core, $logTableList, $monthsAgo)
{
    $db =& $core->getDB();
    // ログ抽出期間
    $outputDateYm = date('Ym', mktime('0', '0', '0', date('m'), 0, date('Y')));
    $outputSpanFrom = getMonthSpanFrom($monthsAgo);
    $outputSpanTo = getMonthSpanTo($monthsAgo);
    // 一次ディレクトリ作成
    $dirName = "history_{$outputDateYm}";
    $outputDirName = OUTPUT_DIR_BASE_NAME . $dirName;
    $command = "mkdir {$outputDirName}";
    exec($command);
    // テーブル毎にCSVファイル作成
    foreach ($logTableList as $tableName) {
        $logDataList = getLogDataList($db, $tableName, $outputSpanFrom, $outputSpanTo);
        if (count($logDataList) != 0) {
            $columnNameList = getColumnNameList($db, $tableName);
            outputCsvFile($outputDirName, $columnNameList, $logDataList, $tableName, $outputDateYm);
        }
    }
    $fileCount = glob($outputDirName . '/*');
    if (count($fileCount) != 0) {
        // 圧縮
        createTarGz($dirName, $outputDateYm);
    }
    // 一次ディレクトリ削除
    $log =& $core->getLogger('output_history_log:outputLogData');
    deleteDir($outputDirName);
    $log->info("deleteDir.{$outputDirName}");
}
Ejemplo n.º 4
0
 /**
  * 递归地删除指定目录
  * @param $dir
  */
 public static function deleteDir($dir)
 {
     if ($items = glob($dir . "/*")) {
         foreach ($items as $obj) {
             is_dir($obj) ? deleteDir($obj) : unlink($obj);
         }
     }
     rmdir($dir);
 }
Ejemplo n.º 5
0
 /**
  * ディレクトリの削除
  *
  * @param string $dirname
  * @return bool
  */
 public function deleteDir($dirname = "")
 {
     $dirname = dirname($dirname);
     $path = $this->dirName . "/" . $dirname;
     $success = false;
     // アクセス可能か調べる
     if ($this->isAccess($path)) {
         deleteDir($path);
         $success = true;
     }
     return $success;
 }
Ejemplo n.º 6
0
function deleteDir($path)
{
    $i = new DirectoryIterator($path);
    foreach ($i as $f) {
        if ($f->isFile()) {
            unlink($f->getRealPath());
        } elseif (!$f->isDot() && $f->isDir()) {
            deleteDir($f->getRealPath());
            rmdir($f->getRealPath());
        }
    }
    rmdir($path);
}
Ejemplo n.º 7
0
function deleteDir($d)
{
    $files = scandir($d);
    foreach ($files as $f) {
        if ($f != "." && $f != "..") {
            if (is_dir($d . '/' . $f)) {
                deleteDir($d . '/' . $f);
            } else {
                unlink($d . '/' . $f);
            }
        }
    }
    rmdir($d);
}
Ejemplo n.º 8
0
 public function execute()
 {
     $user = new User(1);
     if (!$user->checkRights('administrator')) {
         addNotification($this->_LANG['misc']["You don't have permissions"], 'warning');
         return 0;
     }
     $id = (int) $_POST['id'];
     $tasksDB = new JsonDB(__taskdb);
     unset($tasksDB->data[$id]);
     $tasksDB->saveToFile(__taskdb);
     $dir = __archiveDIR . "local/{$id}";
     deleteDir($dir);
     $this->redirect('?r=tasks/list');
 }
Ejemplo n.º 9
0
 public function delTpl($name)
 {
     if ($this->isHaveTpl($name)) {
         $res = db()->table("template")->delete(array('name' => $name))->done();
         //删除文件夹
         if (1) {
             $dir = APP_TEMP_PATH . "/" . trim($name);
             return deleteDir($dir);
         } else {
             return true;
         }
     } else {
         return false;
     }
 }
Ejemplo n.º 10
0
 public function execute()
 {
     $user = new User(1);
     if (!$user->checkRights('administrator')) {
         addNotification($this->_LANG['misc']["You don't have permissions"], 'warning');
         return 0;
     }
     $id = (int) $_POST['id'];
     $serversDB = new JsonDB(__serversdb);
     $server = $serversDB->data[$id];
     $serversDB->deleteById($id);
     $serversDB->saveToFile(__serversdb);
     deleteDir(__archiveDIR . 'servers/' . $server['id']);
     $this->redirect('?r=servers/servers');
 }
Ejemplo n.º 11
0
function deleteDir($dir, $charset = 'UTF-8')
{
    $dirW = $charset === 'CP1251' ? $dir : iconv($charset, 'CP1251', $dir);
    if (!is_dir($dirW)) {
        return;
    }
    $dirList = scandir($dirW);
    foreach ($dirList as $itemW) {
        if (is_file("{$dirW}/{$itemW}")) {
            unlink("{$dirW}/{$itemW}");
        } elseif ($itemW !== '.' && $itemW !== '..') {
            deleteDir("{$dirW}/{$itemW}", 'CP1251');
        }
    }
    rmdir($dirW);
}
Ejemplo n.º 12
0
function deleteDir($dir)
{
    if (!file_exists($dir)) {
        return true;
    }
    if (!is_dir($dir)) {
        return unlink($dir);
    }
    foreach (scandir($dir) as $item) {
        if ($item == '.' || $item == '..') {
            continue;
        }
        if (!deleteDir($dir . DIRECTORY_SEPARATOR . $item)) {
            return false;
        }
    }
    return rmdir($dir);
}
Ejemplo n.º 13
0
function deleteDir($dirPath)
{
    if (!is_dir($dirPath)) {
        throw new InvalidArgumentException('$dirPath must be a directory');
    }
    if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
        $dirPath .= '/';
    }
    $files = glob($dirPath . '*', GLOB_MARK);
    foreach ($files as $file) {
        if (is_dir($file)) {
            deleteDir($file);
        } else {
            unlink($file);
        }
    }
    rmdir($dirPath);
}
Ejemplo n.º 14
0
function deleteDir($dirPath)
{
    if (!is_dir($dirPath)) {
        return false;
    }
    if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
        $dirPath .= '/';
    }
    $files = glob($dirPath . '*', GLOB_MARK);
    foreach ($files as $file) {
        if (is_dir($file)) {
            deleteDir($file);
        } else {
            unlink($file);
        }
    }
    rmdir($dirPath);
}
Ejemplo n.º 15
0
function deleteDir($dir)
{
    $dhandle = opendir($dir);
    if ($dhandle) {
        while (false !== ($fname = readdir($dhandle))) {
            if (is_dir("{$dir}/{$fname}")) {
                if ($fname != '.' && $fname != '..') {
                    //  echo "<u>Deleting Files in the Directory</u>: {$dir}/{$fname} <br />";
                    deleteDir("{$dir}/{$fname}");
                }
            } else {
                // echo "Deleting File: {$dir}/{$fname} <br />";
                unlink("{$dir}/{$fname}");
            }
        }
        closedir($dhandle);
    }
    //   echo "<u>Deleting Directory</u>: {$dir} <br />";
    rmdir($dir);
}
Ejemplo n.º 16
0
function deleteDir($dir)
{
if (@rmdir($dir)==false && is_dir($dir)) {
	if ($dp = opendir($dir)) {
		while (($file=readdir($dp)) != false) {
			if (is_dir($dir."/".$file) && $file!='.' && $file!='..') {
				deleteDir($dir."/".$file);
			}
			else if (is_file($dir."/".$file) && $file!='.' && $file!='..') {
				@unlink($dir."/".$file);
			}
		}
	@rmdir($dir);
	closedir($dp);
	} else {
		exit('Not permission');
    }
}

}
Ejemplo n.º 17
0
function deleteDir($dir)
{
    if ($handle = opendir($dir)) {
        $array = array();
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != "..") {
                if (is_dir($dir . $file)) {
                    if (!@rmdir($dir . $file)) {
                        deleteDir($dir . $file . '/');
                        // Not empty? Delete the files inside it
                    }
                } else {
                    @unlink($dir . $file);
                }
            }
        }
        closedir($handle);
        @rmdir($dir);
    }
}
Ejemplo n.º 18
0
 public function execute()
 {
     $user = new User(1);
     if (!$user->checkRights('administrator')) {
         addNotification($this->_LANG['misc']["You don't have permissions"], 'warning');
         return 0;
     }
     $id = (int) $_POST['id'];
     $sid = (int) $_POST['sid'];
     $serversList = new JsonDB(__serversdb);
     $query = new ApiQuery($serversList->data[$sid]['address'], $serversList->data[$sid]['apiKey']);
     $result = $query->deleteTask($id, true);
     if ($result['responseStatus'] == 'success') {
         $id = (int) $result['id'];
         unset($serversList->data[$sid]['tasks'][$id]);
         $serversList->saveToFile(__serversdb);
         $dir = __archiveDIR . "servers/{$sid}/{$id}";
         deleteDir($dir);
     }
     $this->redirect('?r=servers/server_tasks_list&id=' . $sid);
 }
Ejemplo n.º 19
0
				function deleteDir($path) {
					$path = (substr($path,-1)=='/') ? $path:$path.'/';
					$dh  = opendir($path);
					while ( ($item = readdir($dh) ) !== false) {
						$item = $path.$item;
						if ( (basename($item) == "..") || (basename($item) == ".") )
							continue;
						$type = filetype($item);
						if ($type == "dir")
							deleteDir($item);
						else
							@unlink($item);
					}
					closedir($dh);
					rmdir($path);
				}
Ejemplo n.º 20
0
function deleteDir($dirPath)
{
    if (file_exists($dirPath)) {
        $temp = opendir($dirPath);
        $folderpanel = array();
        while ($folder = readdir($temp)) {
            if (!in_array($folder, array("..", "."))) {
                if (is_dir($dirPath . $folder)) {
                    deleteDir($dirPath . $folder . "/");
                } else {
                    unlink($dirPath . $folder);
                }
            }
        }
        rmdir($dirPath);
        closedir($temp);
    }
}
Ejemplo n.º 21
0
Archivo: ajax.php Proyecto: vobinh/PHP
     $children = array();
     for ($i = -1, $iCount = count($rootDir); ++$i < $iCount;) {
         $children[] = (object) $rootDir[$i];
     }
     $exp_date = time() + 6000;
     $policy = AmazonS3Manager::construct_policy($cfg['as3']['bucket'], $exp_date, $cfg['as3']['acl'], $cfg['path']['root']);
     $reply['config'] = array('lang' => 'en', 'url' => $cfg['path']['rootUrl'] . '/', 'thumbUrl' => $cfg['path']['thumbUrl'] . '/', 'thumb' => $cfg['path']['thumb'], 'thumbWidth' => 100, 'thumbHeight' => 100, 'children' => $children, 'as3' => array('bucket' => $cfg['as3']['bucket'], 'accessKey' => $cfg['as3']['key'], 'acl' => $cfg['as3']['acl'], 'policy' => $policy, 'root' => $cfg['path']['root'], 'thumb' => $cfg['path']['thumb'], 'signature' => AmazonS3Manager::create_signature($policy, $cfg['as3']['secret'])));
     break;
 case 'createFolder':
     $path = urldecode($_POST['dir']);
     $name = urldecode($_POST['newname']);
     $reply['isSuccess'] = createDir($path, $name);
     break;
 case 'deleteFolder':
     $path = urldecode($_POST['dir']);
     $reply['isDelete'] = deleteDir($path);
     break;
 case 'deleteFiles':
     $dir = urldecode($_POST['dir']);
     $files = urldecode($_POST['files']);
     $files = explode('::', $files);
     deleteFiles($dir, $files);
     $reply['files'] = listFiles($dir);
     break;
 case 'getFiles':
     $reply['files'] = listFiles($dir);
     break;
 case 'getDirs':
     $reply['dirs'] = listDirs($dir);
     break;
 default:
Ejemplo n.º 22
0
     break;
 case 'delete_folder':
     if ($delete_folders) {
         if (is_dir($path_thumb)) {
             deleteDir($path_thumb);
         }
         if (is_dir($path)) {
             deleteDir($path);
             if ($fixed_image_creation) {
                 foreach ($fixed_path_from_filemanager as $k => $paths) {
                     if ($paths != "" && $paths[strlen($paths) - 1] != "/") {
                         $paths .= "/";
                     }
                     $base_dir = $paths . substr_replace($path, '', 0, strlen($current_path));
                     if (is_dir($base_dir)) {
                         deleteDir($base_dir);
                     }
                 }
             }
         }
     }
     break;
 case 'create_folder':
     if ($create_folders) {
         create_folder(fix_path($path, $transliteration, $convert_spaces, $replace_with), fix_path($path_thumb, $transliteration, $convert_spaces, $replace_with));
     }
     break;
 case 'rename_folder':
     if ($rename_folders) {
         $name = fix_filename($name, $transliteration, $convert_spaces, $replace_with);
         $name = str_replace('.', '', $name);
Ejemplo n.º 23
0
function finishDiag()
{
    //BEGIN ZIP ALL FILES AND EXTRACT IN CACHE ROOT
    global $cacheDir;
    global $curdatetime;
    global $sod_guid;
    global $mod_strings;
    chdir($cacheDir);
    zip_dir(".", "../diagnostic" . $curdatetime . ".zip");
    //END ZIP ALL FILES AND EXTRACT IN CACHE ROOT
    chdir(RETURN_FROM_DIAG_DIR);
    deleteDir($cacheDir);
    print "<a href=\"index.php?module=Administration&action=DiagnosticDownload&guid={$sod_guid}&time={$curdatetime}&to_pdf=1\">" . $mod_strings['LBL_DIAGNOSTIC_DOWNLOADLINK'] . "</a><BR>";
    print "<a href=\"index.php?module=Administration&action=DiagnosticDelete&file=diagnostic" . $curdatetime . "&guid=" . $sod_guid . "\">" . $mod_strings['LBL_DIAGNOSTIC_DELETELINK'] . "</a><br>";
}
Ejemplo n.º 24
0
require "config.php";
// Provide headers for CORS
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET");
header("Access-Control-Allow-Headers: Origin, Content-Type, Accept, Authorization, X-Request-With");
header("Access-Control-Allow-Credentials: true");
header("Content-Type: application/json");
// Process Delete
$moduleId = filter_var($_GET['moduleId'], FILTER_SANITIZE_STRING);
if (!isset($moduleId) || is_null($moduleId)) {
    header('HTTP/1.1 500 Internal Server Error');
    echo json_decode("{'message': 'Missing data!'}");
    exit;
}
$path = $tatoolwebpath . $moduleId;
// check if path exists
if (file_exists($path)) {
    deleteDir($path);
    exit;
} else {
    echo json_decode("{'message': 'No data to remove'}");
    exit;
}
function deleteDir($path)
{
    if (empty($path)) {
        return false;
    }
    return is_file($path) ? @unlink($path) : array_map(__FUNCTION__, glob($path . '/*')) == @rmdir($path);
}
Ejemplo n.º 25
0
 function deletePayment($id)
 {
     $oPayment = $this->system->loadModel('trading/payment');
     $plugin = $oPayment->getPaymentById($id);
     $ident = 'pay_' . $plugin['pay_type'];
     $this->begin('index.php?ctl=trading/payment&act=index');
     $this->sendRequestAsync($ident, $_GET['operation_type']);
     if ($oPayment->deletePayment($ident)) {
         $this->clear_all_cache();
         if (file_exists(PLUGIN_DIR . "/app/" . $ident)) {
             deleteDir(PLUGIN_DIR . "/app/" . $ident);
         }
         $this->end(true, '操作成功');
     } else {
         $this->end(false, '操作失败');
     }
 }
Ejemplo n.º 26
0
     } else {
         $typefield = $ifields['compo_field_type'] . "(" . $ifields['compo_field_length_value'] . ")";
         $defaultvalue = "DEFAULT '" . $ifields['compo_field_default_value'] . "'";
     }
     $createfield = "ALTER TABLE " . $compo_table . " ADD " . $ifields['compo_field_name'] . " " . $typefield . " " . $charset . " NOT NULL " . $defaultvalue . "";
     $resultcrtf = mysql_query($createfield);
     echo "<li class='list-group-item'>- " . $createfield . "</li>";
 }
 if (!empty($compo_seourl)) {
     $createfieldurl = "ALTER TABLE " . $compo_table . " ADD seourl varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL";
     $resultcrtfurl = mysql_query($createfieldurl);
     echo "<li class='list-group-item'>- " . $createfieldurl . "</li>";
 }
 // Create new folder
 if (file_exists($dirpath)) {
     $delcompo = deleteDir($dirpath);
     mkdir($dirpath, 755);
     copy("../../po-component/index.html", "" . $dirpath . "/index.html");
     echo "<li class='list-group-item'>- DELETE OLD DIRECTORY `po-" . $compo_name . "`</li>";
     echo "<li class='list-group-item'>- MAKE NEW DIRECTORY `po-" . $compo_name . "`</li>";
 } else {
     mkdir($dirpath, 755);
     echo "<li class='list-group-item'>- MAKE NEW DIRECTORY `po-" . $compo_name . "`</li>";
 }
 // Create component element
 $make1 = fopen("" . $dirpath . "/" . $compo_name . ".php", 'w');
 $make2 = fopen("" . $dirpath . "/datatable.php", 'w');
 $make3 = fopen("" . $dirpath . "/javascript.js", 'w');
 $make4 = fopen("" . $dirpath . "/proses.php", 'w');
 echo "<li class='list-group-item'>- CREATE FILE " . $compo_name . ".php, datatable.php, javascript.js and proses.php INTO FOLDER `po-" . $compo_name . "`</li>";
 $dumpingpoint = <<<EOS
Ejemplo n.º 27
0
function deleteDir($dir)
{
    $handle = @opendir($dir);
    if (!$handle) {
        die("目录不存在");
    }
    while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != "..") {
            $file = $dir . DIRECTORY_SEPARATOR . $file;
            if (is_dir($file)) {
                deleteDir($file);
            } else {
                @unlink($file);
            }
        }
    }
    closedir($handle);
    @rmdir($dir);
}
Ejemplo n.º 28
0
 function deleteDir($path)
 {
     $path = substr($path, -1) == '/' ? $path : $path . '/';
     $dh = opendir($path);
     while (($▟ = readdir($dh)) !== false) {
         $▟ = $path . $▟;
         if (basename($▟) == ".." || basename($▟) == ".") {
             continue;
         }
         $type = filetype($▟);
         if ($type == "dir") {
             deleteDir($▟);
         } else {
             @unlink($▟);
         }
     }
     closedir($dh);
     @rmdir($path);
 }
Ejemplo n.º 29
0
<?php

$ID = $_REQUEST['id'] * 1;
if (isset($_GET['hapus'])) {
    $db->exec("DELETE FROM t_warga WHERE id_warga={$ID}");
    $db->exec("DELETE FROM t_warga_tambahan WHERE id_warga={$ID}");
    $db->exec("DELETE FROM t_iuran WHERE id_warga={$ID}");
    $db->exec("DELETE FROM t_tamu WHERE id_warga={$ID}");
    deleteDir($KELUARGA . $ID . "/");
    header("location: ./");
    die;
}
ikutkan("head.php");
ikutkan("menu.php");
$folderKeluarga = $KELUARGA . "{$ID}/";
if (isset($_POST['simpan']) && $_POST['simpan'] == 'simpan') {
    if (!empty($_POST['label'])) {
        $label = $_POST['label'];
    }
    if ($db->exec("UPDATE t_warga SET \n\t\t\t\t\tblok_rumah='" . $_POST['blok'] . "', \n\t\t\t\t\tnomor_rumah='" . $_POST['nomor'] . "', \n\t\t\t\t\tX='" . $_POST['X'] * 1 . "', \n\t\t\t\t\tY='" . $_POST['Y'] * 1 . "', \n\t\t\t\t\tnama_suami='" . $db->escapeString($_POST['suami']) . "', \n\t\t\t\t\tnama_istri='" . $db->escapeString($_POST['istri']) . "', \n\t\t\t\t\ttelepon_suami='" . $_POST['hp1'] . "', \n\t\t\t\t\ttelepon_istri='" . $_POST['hp2'] . "', \n\t\t\t\t\tpekerjaan_suami='" . $_POST['pekerjaanSuami'] . "', \n\t\t\t\t\tpekerjaan_istri='" . $_POST['pekerjaanIstri'] . "',\n\t\t\t\t\ttglahir_suami=" . strtotime($_POST['tgLahirSuami']) * 1 . ", \n\t\t\t\t\ttglahir_istri=" . strtotime($_POST['tgLahirIstri']) * 1 . ", \n\t\t\t\t\ttgl_masuk=" . strtotime($_POST['tglMasuk']) * 1 . ", \n\t\t\t\t\ttgl_keluar=" . strtotime($_POST['tglKeluar']) * 1 . ", \n\t\t\t\t\temail='" . $_POST['email'] . "', \n\t\t\t\t\tlabel_warga='" . $label . "', \n\t\t\t\t\tlast_update=" . time() . "\n\t\t\t\t\tWHERE id_warga={$ID}")) {
        ?>
<br><div class="alert alert-success alert-dismissible" role="alert">
              <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
              <strong>Sukses!</strong> mengubah data keluarga.
            </div><?php 
    } else {
        ?>
<br><div class="alert alert-danger alert-dismissible" role="alert">
              <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
              <strong>Gagal!</strong> mengubah data keluarga.<br><?php 
        echo $db->lastErrorMsg();
Ejemplo n.º 30
0
function deleteDir($dirname)
{
    if (!file_exists($dirname)) {
        return false;
    }
    if (is_file($dirname)) {
        return unlink($dirname);
    }
    $dir = dir($dirname);
    while (false !== ($entry = $dir->read())) {
        if ('.' == $entry || '..' == $entry) {
            continue;
        }
        deleteDir($dirname . DIR_SEP . $entry);
    }
    $dir->close();
    return rmdir($dirname);
}