本文整理汇总了PHP中deleteFile函数的典型用法代码示例。如果您正苦于以下问题:PHP deleteFile函数的具体用法?PHP deleteFile怎么用?PHP deleteFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了deleteFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteDir
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);
}
}
}
示例2: beforeDelete
public function beforeDelete()
{
if ($this->video_file) {
$pathVideo = Yii::getPathOfAlias($this->path) . DIRECTORY_SEPARATOR . $this->apartment_id . DIRECTORY_SEPARATOR;
deleteFile($pathVideo, $this->video_file);
}
return parent::beforeDelete();
}
示例3: deleteFilesByLuaId
function deleteFilesByLuaId($id)
{
global $dbConnect;
$dbresult = $dbConnect->getFilesByLua($id);
while ($row = mysql_fetch_assoc($dbresult)) {
deleteFile($row['Id']);
}
rmdir("files/" . $id);
}
示例4: delete
public function delete()
{
$returnVal = false;
if ($this->intTableKeyValue != "") {
$info = $this->arrObjInfo;
if (parent::delete()) {
deleteFile(BASE_DIRECTORY . $info['icon']);
$returnVal = true;
}
}
return $returnVal;
}
示例5: delete
public function delete()
{
$returnVal = false;
if ($this->intTableKeyValue != "") {
$info = $this->arrObjInfo;
$returnVal = parent::delete();
if ($info['headertype'] == "image" && $info['headercode'] != "") {
deleteFile(BASE_DIRECTORY . $info['headercode']);
}
}
return $returnVal;
}
示例6: imagedel
public function imagedel()
{
global $CONFIG;
$path = 'gallery/images';
foreach ($_POST['ids'] as $id) {
$getfile = $this->gallery->get_image_id($id);
$delImage[] = $getfile['content'];
}
foreach ($delImage as $image) {
deleteFile($image, $path);
}
$albumid = $_POST['album'];
$data = $this->gallery->image_del($_POST['ids']);
echo "<script>alert('Photo successfully deleted');window.location.href='" . $CONFIG['admin']['base_url'] . "gallery/album/?album=" . $albumid . "'</script>";
}
示例7: index
/**
* Display a list of Templates data.
*
* @return void
*/
public function index($offset = 0)
{
// Deleting anything?
if (isset($_POST['delete'])) {
$this->auth->restrict($this->permissionDelete);
$checked = $this->input->post('checked');
if (is_array($checked) && count($checked)) {
// If any of the deletions fail, set the result to false, so
// failure message is set if any of the attempts fail, not just
// the last attempt
$result = true;
foreach ($checked as $pid) {
/*******Physically delete the template from its location******/
$template_to_be_deleted = $this->templates_model->find_by('id', $pid);
$file_to_delete = $template_to_be_deleted->filename;
$deletepath = $this->config->item('smartembed_template_location') . $file_to_delete;
$is_file_delete = false;
$is_file_delete = deleteFile($deletepath);
/********************************************/
$deleted = $this->templates_model->delete($pid);
if ($deleted == false || $is_file_delete == false) {
$result = false;
}
}
if ($result) {
Template::set_message(count($checked) . ' ' . lang('templates_delete_success'), 'success');
} else {
Template::set_message(lang('templates_delete_failure') . $this->templates_model->error, 'error');
}
}
}
$pagerUriSegment = 5;
$pagerBaseUrl = site_url(SITE_AREA . '/embeds/templates/index') . '/';
$limit = $this->settings_lib->item('site.list_limit') ?: 15;
$this->load->library('pagination');
$pager['base_url'] = $pagerBaseUrl;
$pager['total_rows'] = $this->templates_model->count_all();
$pager['per_page'] = $limit;
$pager['uri_segment'] = $pagerUriSegment;
$this->pagination->initialize($pager);
$this->templates_model->limit($limit, $offset);
$records = $this->templates_model->find_all();
Template::set('records', $records);
Template::set('toolbar_title', lang('templates_manage'));
Template::render();
}
示例8: project_management_recursive_rmdir
/**
*
* @ WHMCS FULL DECODED & NULLED
*
* @ Version : 5.2.15
* @ Author : MTIMER
* @ Release on : 2013-12-24
* @ Website : http://www.mtimer.cn
*
**/
function project_management_recursive_rmdir($dir)
{
if (is_dir($dir)) {
$folder_path_real = realpath($dir);
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir . "/" . $object) == "dir") {
project_management_recursive_rmdir($dir . "/" . $object);
continue;
}
deleteFile($dir . "/", $object);
continue;
}
}
reset($objects);
rmdir($dir);
}
}
示例9: deleteCategory
/**
* Delete category
* @param $sCategory - category identificator
* @return $bResult: true - success / false - failure
*/
function deleteCategory($sCategory)
{
$bResult = false;
if (!isEmptyCategory($sCategory)) {
$res = getResult("SELECT `ID` FROM `" . MODULE_DB_PREFIX . "Categories` WHERE `Parent`='" . $sCategory . "'");
for ($i = 0; $i < mysql_num_rows($res); $i++) {
$aCat = mysql_fetch_assoc($res);
$bResult = deleteCategory($aCat['ID']);
}
$res = getResult("SELECT `ID` FROM `" . MODULE_DB_PREFIX . "Files` WHERE `CategoryId`='" . $sCategory . "'");
for ($i = 0; $i < mysql_num_rows($res); $i++) {
$aFile = mysql_fetch_assoc($res);
$bResult = deleteFile($aFile['ID']);
}
} else {
$bResult = true;
}
getResult("DELETE FROM `" . MODULE_DB_PREFIX . "Categories` WHERE `ID`='" . $sCategory . "'");
return $bResult;
}
示例10: delete
public function delete()
{
$returnVal = false;
if ($this->intTableKeyValue != "") {
$info = $this->arrObjInfo;
$countErrors = 0;
$result = $this->MySQL->query("DELETE FROM " . $this->strTableName . " WHERE " . $this->strTableKey . " = '" . $this->intTableKeyValue . "'");
if ($this->MySQL->error) {
$countErrors++;
}
$result = $this->MySQL->query("DELETE FROM " . $this->MySQL->get_tablePrefix() . "medals_members WHERE " . $this->strTableKey . " = '" . $this->intTableKeyValue . "'");
if ($this->MySQL->error) {
$countErrors++;
}
$this->resortOrder();
if ($countErrors == 0) {
$returnVal = true;
deleteFile(BASE_DIRECTORY . $info['imageurl']);
}
}
return $returnVal;
}
示例11: delete
public function delete()
{
if ($this->intTableKeyValue != "") {
switch ($this->arrObjInfo['itemtype']) {
case "link":
$this->objLink->select($this->arrObjInfo['itemtype_id']);
$this->objLink->delete();
break;
case "image":
$this->objImage->select($this->arrObjInfo['itemtype_id']);
$info = $this->objImage->get_info();
deleteFile(BASE_DIRECTORY . $info['imageurl']);
$this->objImage->delete();
break;
case "shoutbox":
$this->objShoutbox->select($this->arrObjInfo['itemtype_id']);
$this->objShoutbox->delete();
break;
case "custompage":
$this->objCustomPage->select($this->arrObjInfo['itemtype_id']);
$this->objCustomPage->delete();
break;
case "customform":
$this->objCustomPage->select($this->arrObjInfo['itemtype_id']);
$this->objCustomPage->delete();
break;
case "customcode":
$this->objCustomBlock->select($this->arrObjInfo['itemtype_id']);
$this->objCustomBlock->delete();
break;
case "customformat":
$this->objCustomBlock->select($this->arrObjInfo['itemtype_id']);
$this->objCustomBlock->delete();
break;
}
return parent::delete();
}
}
示例12: deleteFile
function deleteFile($path)
{
global $text;
if (is_dir($path)) {
$handle = opendir($path);
while ($list = readdir($handle)) {
if ($list == '.' || $list == '..') {
//do nothing
} else {
$list = $path . '/' . $list;
}
switch ($list) {
case $list == '.' || $list == '..':
//echo $list.' this is special directory ';
continue;
case is_file($list):
if (unlink($list)) {
$text = $text . 'DEL ' . $list . '<br/>';
} else {
$text = $text . 'DEL SUCCESS';
}
break;
case is_dir($list):
//$text=$text. '��Ŀ¼ '.$list.'<br/>';
deleteFile($list);
break;
default:
//$text=$text.'default action '.$list.'';
continue;
}
}
} else {
$text = $text . $path . ' sorry the path is not directory';
}
return $text;
}
示例13: deleteFile
deleteFile("templates/Includes/Preview.ss");
deleteFile("templates/Includes/PreviewAssets.ss");
deleteFile("javascript/preview.js");
deleteFile("scss/preview.scss");
deleteFile("css/preview.css");
//deleting the preview directory
$directory = "_preview";
$delRT = deleteDirectory($directory);
if ($delRT == 1) {
//nothing
} else {
echo $delRT;
exit;
}
//deleting this file
deleteFile("_deletepreviewfiles.php");
echo "success";
exit;
} else {
echo "You need to append ?delete=1 to delete the preview files";
exit;
}
function deleteFile($file)
{
if (!is_writeable($file)) {
return "The file \"{$file}\" can't be deleted. Please check your permissions and try again.";
}
$msg = "";
if (file_exists($file)) {
unlink($file);
$msg = "deleted file {$file}";
示例14:
if ($query = $database->query($sql)) {
$result = $query->fetchRow();
$bildfilename = $result['file_name'];
$parent_id = $result['parent_id'];
//echo '<h2>'.$parent_id.'</h2>' ;
$query2 = $database->query('SELECT * FROM ' . TABLE_PREFIX . 'mod_foldergallery_categories WHERE id=' . $parent_id . ' LIMIT 1;');
$categorie = $query2->fetchRow();
if ($categorie['parent_id'] != -1) {
$parent = $categorie['parent'] . '/' . $categorie['categorie'];
} else {
$parent = '';
}
$folder = $root_dir . $parent;
$pathToFolder = $path . $folder . '/';
$pathToFile = $path . $folder . '/' . $bildfilename;
$pathToThumb = $path . $folder . $thumbdir . '/' . $bildfilename;
if (!deleteFile($pathToFile) || !deleteFile($pathToThumb)) {
$admin->print_error($MOD_FOLDERGALLERY['ERROR_MESSAGE'], WB_URL . '/modules/foldergallery/admin/modify_cat.php?page_id=' . $page_id . '§ion_id=' . $section_id . '&cat_id=' . $cat_id);
}
$sql = 'DELETE FROM ' . TABLE_PREFIX . 'mod_foldergallery_files WHERE id=' . $_GET['id'];
$database->query($sql);
$admin->print_success($TEXT['SUCCESS'], WB_URL . '/modules/foldergallery/admin/modify_cat.php?page_id=' . $page_id . '§ion_id=' . $section_id . '&cat_id=' . $cat_id);
} else {
$admin->print_error($MOD_FOLDERGALLERY['ERROR_MESSAGE'], WB_URL . '/modules/foldergallery/admin/modify_cat.php?page_id=' . $page_id . '§ion_id=' . $section_id . '&cat_id=' . $cat_id);
}
} else {
$admin->print_error($MOD_FOLDERGALLERY['ERROR_MESSAGE'], WB_URL . '/modules/foldergallery/admin/modify_cat.php?page_id=' . $page_id . '§ion_id=' . $section_id . '&cat_id=' . $cat_id);
}
// reset the mySQL encoding
mysql_set_charset($oldMysqlEncoding, $database->db_handle);
$admin->print_footer();
示例15: imageFrame
function imageFrame($filename = false, $framefile = false)
{
global $IMAGE, $CONFIG;
if (array_key_exists('mobile', $CONFIG)) {
include APP . LIBS . 'class_image_upload/class.upload.php';
} else {
include LIBS . 'class_image_upload/class.upload.php';
}
deleteFile($filename, 'imageFramed');
// pr($IMAGE[0]['pathfile'].$filename);
$handle = new Upload($IMAGE[0]['pathfile'] . $filename);
// pr($handle);
if ($handle->uploaded) {
$handle->image_resize = true;
$handle->image_x = 180;
$handle->image_y = 181;
$handle->image_ratio_crop = false;
$handle->jpeg_quality = 100;
$handle->image_watermark = $IMAGE[0]['pathframe'] . $framefile;
$handle->Process($IMAGE[0]['imageframed']);
if ($handle->processed) {
$filename = $handle->file_dst_name;
} else {
echo 'Error: ' . $handle->error . '';
}
$handle->Clean();
return true;
} else {
echo 'Error: ' . $handle->error . '';
}
return false;
}