当前位置: 首页>>代码示例>>PHP>>正文


PHP file_unlink函数代码示例

本文整理汇总了PHP中file_unlink函数的典型用法代码示例。如果您正苦于以下问题:PHP file_unlink函数的具体用法?PHP file_unlink怎么用?PHP file_unlink使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了file_unlink函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sitemap_build

function sitemap_build($action, $settings, $board)
{
    global $config;
    // Possible values for $action:
    //	- all (rebuild everything, initialization)
    //	- news (news has been updated)
    //	- boards (board list changed)
    //	- post (a post has been made)
    //	- thread (a thread has been made)
    if ($action != 'all') {
        if ($action != 'post-thread' && $action != 'post-delete') {
            return;
        }
        if (isset($settings['regen_time']) && $settings['regen_time'] > 0) {
            if ($last_gen = @filemtime($settings['path'])) {
                if (time() - $last_gen < (int) $settings['regen_time']) {
                    return;
                }
                // Too soon
            }
        }
    }
    if ($config['smart_build']) {
        file_unlink($settings['path']);
    } else {
        $boards = explode(' ', $settings['boards']);
        $threads = array();
        foreach ($boards as $board) {
            $query = query(sprintf("SELECT `id` AS `thread_id`, (SELECT `time` FROM ``posts_%s`` WHERE `thread` = `thread_id` OR `id` = `thread_id` ORDER BY `time` DESC LIMIT 1) AS `lastmod` FROM ``posts_%s`` WHERE `thread` IS NULL", $board, $board)) or error(db_error());
            $threads[$board] = $query->fetchAll(PDO::FETCH_ASSOC);
        }
        file_write($settings['path'], Element('themes/sitemap/sitemap.xml', array('settings' => $settings, 'config' => $config, 'threads' => $threads, 'boards' => $boards)));
    }
}
开发者ID:odilitime,项目名称:infinity,代码行数:34,代码来源:theme.php

示例2: catalog_build

function catalog_build($action, $settings, $board)
{
    global $config;
    // Possible values for $action:
    //	- all (rebuild everything, initialization)
    //	- news (news has been updated)
    //	- boards (board list changed)
    //	- post (a reply has been made)
    //	- post-thread (a thread has been made)
    $boards = explode(' ', $settings['boards']);
    if ($action == 'all') {
        foreach ($boards as $board) {
            $b = new Catalog();
            if ($config['smart_build']) {
                file_unlink($config['dir']['home'] . $board . '/catalog.html');
            } else {
                $b->build($settings, $board);
            }
        }
    } elseif ($action == 'post-thread' || $settings['update_on_posts'] && $action == 'post' || $settings['update_on_posts'] && $action == 'post-delete' && in_array($board, $boards)) {
        $b = new Catalog();
        if ($config['smart_build']) {
            file_unlink($config['dir']['home'] . $board . '/catalog.html');
        } else {
            $b->build($settings, $board);
        }
    }
}
开发者ID:0151n,项目名称:vichan,代码行数:28,代码来源:theme.php

示例3: ukko_build

function ukko_build($action, $settings)
{
    global $config;
    $ukko = new ukko();
    $ukko->settings = $settings;
    if (!($action == 'all' || $action == 'post' || $action == 'post-thread' || $action == 'post-delete')) {
        return;
    }
    if ($config['smart_build']) {
        file_unlink($settings['uri'] . '/index.html');
    } else {
        file_write($settings['uri'] . '/index.html', $ukko->build());
    }
}
开发者ID:odilitime,项目名称:infinity,代码行数:14,代码来源:theme.php

示例4: semirand_build

/**
 * Generate the board's HTML and move it and its JavaScript in place, whence
 * it's served
 */
function semirand_build($action, $settings)
{
    global $config;
    if ($action !== 'all' && $action !== 'post' && $action !== 'post-thread' && $action !== 'post-delete') {
        return;
    }
    if ($config['smart_build']) {
        file_unlink($settings['uri'] . '/index.html');
    } else {
        $semirand = new semirand($settings);
        // Copy the generated board HTML to its place
        file_write($settings['uri'] . '/index.html', $semirand->build());
        file_write($settings['uri'] . '/semirand.js', Element('themes/semirand/semirand.js', array()));
    }
}
开发者ID:anastiel,项目名称:lainchan,代码行数:19,代码来源:theme.php

示例5: build

 public function build($action, $settings)
 {
     global $config, $_theme;
     if ($action == 'all') {
         copy('templates/themes/recent_textonly/' . $settings['basecss'], $config['dir']['home'] . $settings['css']);
     }
     $this->excluded = explode(' ', $settings['exclude']);
     if ($action == 'all' || $action == 'post' || $action == 'post-thread' || $action == 'post-delete') {
         if ($config['smart_build']) {
             file_unlink($config['dir']['home'] . $settings['html']);
         } else {
             file_write($config['dir']['home'] . $settings['html'], $this->homepage($settings));
         }
     }
 }
开发者ID:remiscarlet,项目名称:kcad,代码行数:15,代码来源:theme.php

示例6: mod_spoiler_image

function mod_spoiler_image($board, $post, $file)
{
    global $config, $mod;
    if (!openBoard($board)) {
        error($config['error']['noboard']);
    }
    if (!hasPermission($config['mod']['spoilerimage'], $board)) {
        error($config['error']['noaccess']);
    }
    // Delete file thumbnail
    $query = prepare(sprintf("SELECT `files`, `thread` FROM ``posts_%s`` WHERE id = :id", $board));
    $query->bindValue(':id', $post, PDO::PARAM_INT);
    $query->execute() or error(db_error($query));
    $result = $query->fetch(PDO::FETCH_ASSOC);
    $files = json_decode($result['files']);
    file_unlink($board . '/' . $config['dir']['thumb'] . $files[$file]->thumb);
    $files[$file]->thumb = 'spoiler';
    $files[$file]->thumbheight = 128;
    $files[$file]->thumbwidth = 128;
    // Make thumbnail spoiler
    $query = prepare(sprintf("UPDATE ``posts_%s`` SET `files` = :files WHERE `id` = :id", $board));
    $query->bindValue(':files', json_encode($files));
    $query->bindValue(':id', $post, PDO::PARAM_INT);
    $query->execute() or error(db_error($query));
    // Record the action
    modLog("Spoilered file from post #{$post}");
    // Rebuild thread
    buildThread($result['thread'] ? $result['thread'] : $post);
    // Rebuild board
    buildIndex();
    // Rebuild themes
    rebuildThemes('post-delete', $board);
    // Redirect
    header('Location: ?/' . sprintf($config['board_path'], $board) . $config['file_index'], true, $config['redirect_http']);
}
开发者ID:vicentil,项目名称:vichan,代码行数:35,代码来源:pages.php

示例7: explode

<?php

$depth = '../';
require_once $depth . '../login/login_check.php';
$rurl = '../app/wap/flash.php?anyid=' . $anyid . '&lang=' . $lang . '&module=' . $module . '&cs=' . $cs;
if ($action == "del") {
    $allidlist = explode(',', $allid);
    foreach ($allidlist as $key => $val) {
        $flashrec = $db->get_one("SELECT * FROM {$met_flash} where id='{$val}'");
        file_unlink("../../" . $flashrec[img_path]);
        file_unlink("../../" . $flashrec[flash_path]);
        file_unlink("../../" . $flashrec[flash_back]);
        $query = "delete from {$met_flash} where id='{$val}'";
        $db->query($query);
    }
    metsave($rurl, '', $depth);
} else {
    $flashrec = $db->get_one("SELECT * FROM {$met_flash} where id='{$id}'");
    file_unlink("../../" . $flashrec[img_path]);
    file_unlink("../../" . $flashrec[flash_path]);
    file_unlink("../../" . $flashrec[flash_back]);
    $query = "delete from {$met_flash} where id='{$id}'";
    $db->query($query);
    metsave($rurl, '', $depth);
}
开发者ID:nanfs,项目名称:lt,代码行数:25,代码来源:flashdelete.php

示例8: explode

}
if ($action == "del") {
    $allidlist = explode(',', $allid);
    foreach ($allidlist as $key => $val) {
        if ($met_deleteimg) {
            foreach ($para_list as $key => $val1) {
                $imagelist = $db->get_one("select * from {$met_plist} where lang='{$lang}' and  paraid='{$val1['id']}' and listid='{$val}'");
                file_unlink($depth . "../" . $imagelist[info]);
            }
        }
        $query = "delete from {$met_plist} where listid='{$val}' and module='6'";
        $db->query($query);
        $query = "delete from {$met_cv} where id='{$val}'";
        $db->query($query);
    }
    metsave($backurl, '', $depth);
} else {
    if ($met_deleteimg) {
        foreach ($para_list as $key => $val) {
            $imagelist = $db->get_one("select * from {$met_plist} where lang='{$lang}' and  paraid='{$val['id']}' and listid='{$id}'");
            file_unlink($depth . "../" . $imagelist[info]);
        }
    }
    $query = "delete from {$met_plist} where listid='{$id}' and module='6'";
    $db->query($query);
    $query = "delete from {$met_cv} where id='{$id}'";
    $db->query($query);
    metsave($backurl, '', $depth);
}
# This program is an open source system, commercial use, please consciously to purchase commercial license.
# Copyright (C) MetInfo Co., Ltd. (http://www.metinfo.cn). All rights reserved.
开发者ID:Jesuslagliva12,项目名称:OpenAPI,代码行数:31,代码来源:cv_delete.php

示例9: undoImage

function undoImage(array $post)
{
    if (!$post['has_file']) {
        return;
    }
    if (isset($post['file_path'])) {
        file_unlink($post['file_path']);
    }
    if (isset($post['thumb_path'])) {
        file_unlink($post['thumb_path']);
    }
}
开发者ID:carriercomm,项目名称:Tinyboard,代码行数:12,代码来源:functions.php

示例10: file_unlink

         if ($size[0] > $config['max_width'] || $size[1] > $config['max_height']) {
             file_unlink($post['file']);
             error($config['error']['maxsize']);
         }
     } else {
         // GD failed
         // TODO?
     }
 } else {
     // find dimensions of an image using GD
     if (!($size = @getimagesize($post['file']))) {
         file_unlink($post['file']);
         error($config['error']['invalidimg']);
     }
     if ($size[0] > $config['max_width'] || $size[1] > $config['max_height']) {
         file_unlink($post['file']);
         error($config['error']['maxsize']);
     }
 }
 // create image object
 $image = new Image($post['file'], $post['extension']);
 if ($image->size->width > $config['max_width'] || $image->size->height > $config['max_height']) {
     $image->delete();
     error($config['error']['maxsize']);
 }
 $post['width'] = $image->size->width;
 $post['height'] = $image->size->height;
 if ($config['spoiler_images'] && isset($_POST['spoiler'])) {
     $post['thumb'] = 'spoiler';
     $size = @getimagesize($config['spoiler_image']);
     $post['thumbwidth'] = $size[0];
开发者ID:nabm,项目名称:Tinyboard,代码行数:31,代码来源:post.php

示例11: undoImage

function undoImage($post)
{
    if ($post['has_file']) {
        if (isset($post['thumb'])) {
            file_unlink($post['file']);
        }
        if (isset($post['thumb'])) {
            file_unlink($post['thumb']);
        }
    }
}
开发者ID:nabm,项目名称:Tinyboard,代码行数:11,代码来源:functions.php

示例12: is_numeric

        $msn = 'msn_' . $allidlist[$i];
        $msn = ${$msn};
        $taobao = 'taobao_' . $allidlist[$i];
        $taobao = ${$taobao};
        $alibaba = 'alibaba_' . $allidlist[$i];
        $alibaba = ${$alibaba};
        $skype = 'skype_' . $allidlist[$i];
        $skype = ${$skype};
        $tpif = is_numeric($allidlist[$i]) ? 1 : 0;
        $sqly = $tpif ? "id='{$allidlist[$i]}'" : '';
        if ($sqly != '') {
            $skin_m = $db->get_one("SELECT * FROM {$met_online} WHERE {$sqly}");
        }
        if ($tpif) {
            if (!$skin_m) {
                metsave('-1', $lang_dataerror, $depth);
            }
        }
        $uptp = $tpif ? "update" : "insert into";
        $upbp = $tpif ? "where id='{$allidlist[$i]}'" : ",lang='{$lang}'";
        $query = "{$uptp} {$met_online} set\n                      name           = '{$name}',\n     \t\t\t\t  no_order       = '{$no_order}',\n\t\t\t\t\t  qq             = '{$qq}',\n\t\t\t\t\t  msn            = '{$msn}',\n\t\t\t\t\t  taobao         = '{$taobao}',\n\t\t\t\t\t  alibaba        = '{$alibaba}',\n\t\t\t\t\t  skype          = '{$skype}'\n\t\t\t{$upbp}";
        $db->query($query);
    }
    file_unlink($depth . "../../cache/online_{$lang}.inc.php");
    metsave($rurl, '', $depth);
} else {
    $query = "delete from {$met_online} where id='{$id}'";
    $db->query($query);
    file_unlink($depth . "../../cache/online_{$lang}.inc.php");
    metsave($rurl, '', $depth);
}
开发者ID:nanfs,项目名称:lt,代码行数:31,代码来源:delete.php

示例13: delete

 public function delete()
 {
     file_unlink($this->src);
 }
开发者ID:niksfish,项目名称:Tinyboard,代码行数:4,代码来源:image.php

示例14: openBoard

    openBoard($board['uri']);
    $query = query(sprintf("SELECT `file`, `thumb` FROM ``posts_%s`` WHERE `file` IS NOT NULL", $board['uri']));
    $valid_src = array();
    $valid_thumb = array();
    while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
        $valid_src[] = $post['file'];
        $valid_thumb[] = $post['thumb'];
    }
    $files_src = array_map('basename', glob($board['dir'] . $config['dir']['img'] . '*'));
    $files_thumb = array_map('basename', glob($board['dir'] . $config['dir']['thumb'] . '*'));
    $stray_src = array_diff($files_src, $valid_src);
    $stray_thumb = array_diff($files_thumb, $valid_thumb);
    $stats = array('deleted' => 0, 'size' => 0);
    foreach ($stray_src as $src) {
        $stats['deleted']++;
        $stats['size'] = filesize($board['dir'] . $config['dir']['img'] . $src);
        if (!file_unlink($board['dir'] . $config['dir']['img'] . $src)) {
            $er = error_get_last();
            die("error: " . $er['message'] . "\n");
        }
    }
    foreach ($stray_thumb as $thumb) {
        $stats['deleted']++;
        $stats['size'] = filesize($board['dir'] . $config['dir']['thumb'] . $thumb);
        if (!file_unlink($board['dir'] . $config['dir']['thumb'] . $thumb)) {
            $er = error_get_last();
            die("error: " . $er['message'] . "\n");
        }
    }
    echo sprintf("deleted %s files (%s)\n", $stats['deleted'], format_bytes($stats['size']));
}
开发者ID:0151n,项目名称:vichan,代码行数:31,代码来源:delete-stray-images.php

示例15: explode

     if ($met_thumb_wate == 1) {
         if ($met_wate_class == 2) {
             $img->met_image_name = $depth . $met_wate_img;
         } else {
             $img->met_text_size = $met_text_size;
         }
         $img->save_file = $imgurls;
         $img->create($imgurls);
         $imgurls_a = explode("../", $imgurls);
         $imgurls = "../" . $imgurls_a[3];
     }
     if ($met_thumb_img != $depth . "../" . str_ireplace("/thumb", "", $val['imgurls'])) {
         $imgurls = '../' . str_ireplace("../", "", $imgurls);
         $query = "update {$table} set imgurls='{$imgurls}' where id='{$val['id']}'";
         if ($met_deleteimg == 1 && $db->query($query)) {
             @file_unlink("../../{$val['imgurls']}");
         }
     }
 }
 $met_img_x = '';
 $met_img_y = '';
 if ($mou == 3) {
     $met_img_x = $met_productdetail_x;
     $met_img_y = $met_productdetail_y;
 }
 if ($mou == 5) {
     $met_img_x = $met_imgdetail_x;
     $met_img_y = $met_imgdetail_y;
 }
 $met_bigthumb_img = $depth . "../" . $met_big_img;
 $imgurls = $f->createthumb($met_bigthumb_img, $met_img_x, $met_img_y, 'thumb_dis/');
开发者ID:Jesuslagliva12,项目名称:OpenAPI,代码行数:31,代码来源:thumb.php


注:本文中的file_unlink函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。