Esempio n. 1
0
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)));
    }
}
Esempio n. 2
0
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);
        }
    }
}
Esempio n. 3
0
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());
    }
}
Esempio n. 4
0
/**
 * 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()));
    }
}
Esempio n. 5
0
 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));
         }
     }
 }
Esempio n. 6
0
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']);
}
Esempio n. 7
0
<?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);
}
Esempio n. 8
0
}
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.
Esempio n. 9
0
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']);
    }
}
Esempio n. 10
0
         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];
Esempio n. 11
0
function undoImage($post)
{
    if ($post['has_file']) {
        if (isset($post['thumb'])) {
            file_unlink($post['file']);
        }
        if (isset($post['thumb'])) {
            file_unlink($post['thumb']);
        }
    }
}
Esempio n. 12
0
File: delete.php Progetto: nanfs/lt
        $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);
}
Esempio n. 13
0
 public function delete()
 {
     file_unlink($this->src);
 }
Esempio n. 14
0
    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']));
}
Esempio n. 15
0
     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/');
Esempio n. 16
0
        }
    }
    if ($pseudo_download) {
        include $depth . "../include/pclzip.lib.php";
        $archive = new PclZip('metinfo_pseudo_rule.zip');
        $archive->create($httpdurl, PCLZIP_OPT_REMOVE_PATH, $little . '../../');
        @file_unlink($httpdurl);
        header("Content-type:application/zip;");
        $ua = $_SERVER["HTTP_USER_AGENT"];
        $title = "{$lang_rewriteruledownload2}({$_SERVER['SERVER_SOFTWARE']}).zip";
        if (preg_match("/MSIE/", $ua)) {
            header('Content-Disposition: attachment; filename="' . urlencode($title) . '"');
        } else {
            header('Content-Disposition: attachment; filename="' . $title . '"');
        }
        readfile("metinfo_pseudo_rule.zip");
        @file_unlink("metinfo_pseudo_rule.zip");
    }
} elseif ($depsdo == 'deleteall') {
    if (file_exists('../../httpd.ini')) {
        @unlink('../../httpd.ini');
    }
    if (file_exists('../../.htaccess')) {
        @unlink('../../.htaccess');
    }
    if (file_exists('../../web.config')) {
        @unlink('../../web.config');
    }
}
# 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.
Esempio n. 17
0
    if ($action_type == "del") {
        $allidlist = explode(',', $allid);
        foreach ($allidlist as $key => $val) {
            $query = "delete from {$met_label} where id='{$val}'";
            $db->query($query);
        }
        file_unlink("../../cache/str_{$lang}.inc.php");
        metsave('../seo/strcontent.php?lang=' . $lang . '&anyid=' . $anyid);
    } else {
        $skin_m = $db->get_one("SELECT * FROM {$met_label} WHERE id='{$id}'");
        if (!$skin_m) {
            okinfox('strcontent.php?lang=' . $lang, $lang_dataerror);
        }
        $query = "delete from {$met_label} where id='{$id}'";
        $db->query($query);
        file_unlink("../../cache/str_{$lang}.inc.php");
        metsave('../seo/strcontent.php?lang=' . $lang . '&anyid=' . $anyid);
    }
} else {
    $total_count = $db->counter($met_label, " where lang='{$lang}'", "*");
    require_once 'include/pager.class.php';
    $page = (int) $page;
    if ($page_input) {
        $page = $page_input;
    }
    $list_num = 16;
    $rowset = new Pager($total_count, $list_num, $page);
    $from_record = $rowset->_offset();
    $query = "SELECT * FROM {$met_label} where lang='{$lang}' order BY id LIMIT {$from_record}, {$list_num}";
    $result = $db->query($query);
    while ($list = $db->fetch_array($result)) {
Esempio n. 18
0
function delimg($del, $type, $module = 0, $para_list = NULL)
{
    global $lang, $db, $met_deleteimg, $depth;
    global $met_admin_table, $met_column, $met_cv, $met_download, $met_feedback, $met_flist, $met_img, $met_job, $met_link, $met_list, $met_message, $met_news, $met_parameter, $met_plist, $met_product;
    if ($met_deleteimg) {
        $table = $module == 8 ? $met_feedback : $met_plist;
        if ($para_list == NULL && $module != 2) {
            $query = "select * from {$met_parameter} where lang='{$lang}' and module='{$module}' and (class1='{$del['class1']}' or class1=0) and type='5'";
            $para_list = $db->get_all($query);
        }
        if ($type == 1) {
            $delnow[] = $del;
        } else {
            if ($type == 2) {
                $delnow = $del;
            } else {
                $table = moduledb($module);
                $query = "select * from {$table} where id='{$id}'";
                echo $query;
                $del = $db->get_one($query);
                $delnow[] = $del;
            }
        }
        foreach ($delnow as $key => $val) {
            if ($val['recycle'] != 2 || $module != 2) {
                foreach ($para_list as $key1 => $val1) {
                    if (($module == $val1['module'] || $val['recycle'] == $val1['module']) && ($val1['class1'] == 0 || $val1['class1'] == $val['class1'])) {
                        $imagelist = $db->get_one("select * from {$table} where lang='{$lang}' and  paraid='{$val1['id']}' and listid='{$val['id']}'");
                        file_unlink($depth . "../" . $imagelist['info']);
                        $imagelist['info'] = str_replace('watermark/', '', $imagelist['info']);
                        file_unlink($depth . "../" . $imagelist['info']);
                    }
                }
            }
            if ($module == 6 || $module == 8) {
                continue;
            }
            if ($val['displayimg'] != NULL) {
                $displayimg = explode('|', $val['displayimg']);
                foreach ($displayimg as $key2 => $val2) {
                    $display_val = explode('*', $val2);
                    file_unlink($depth . "../" . $display_val[1]);
                    $display_val[1] = str_replace('watermark/', '', $display_val[1]);
                    file_unlink($depth . "../" . $display_val[1]);
                    $imgurl_diss = explode('/', $display_val[1]);
                    file_unlink($depth . "../" . $imgurl_diss[0] . '/' . $imgurl_diss[1] . '/' . $imgurl_diss[2] . '/thumb_dis/' . $imgurl_diss[count($imgurl_diss) - 1]);
                }
            }
            if ($val['downloadurl'] == NULL) {
                file_unlink($depth . "../" . $val['imgurl']);
                file_unlink($depth . "../" . $val['imgurls']);
                $val['imgurlbig'] = str_replace('watermark/', '', $val['imgurl']);
                file_unlink($depth . "../" . $val['imgurlbig']);
                $imgurl_diss = explode('/', $val['imgurlbig']);
                file_unlink($depth . "../" . $imgurl_diss[0] . '/' . $imgurl_diss[1] . '/' . $imgurl_diss[2] . '/thumb_dis/' . $imgurl_diss[count($imgurl_diss) - 1]);
            } else {
                file_unlink($depth . "../" . $val['downloadurl']);
            }
            $content[0] = $val[content];
            $content[1] = $val[content1];
            $content[2] = $val[content2];
            $content[3] = $val[content3];
            $content[4] = $val[content4];
            foreach ($content as $contentkey => $contentval) {
                if ($contentval) {
                    $tmp1 = explode("<", $contentval);
                    foreach ($tmp1 as $key => $val) {
                        $tmp2 = explode(">", $val);
                        if (strcasecmp(substr(trim($tmp2[0]), 0, 3), 'img') == 0) {
                            preg_match('/http:\\/\\/([^\\"]*)/i', $tmp2[0], $out);
                            $imgs[] = $out[1];
                        }
                    }
                }
            }
            foreach ($imgs as $key => $val) {
                $vals = explode('/', $val);
                file_unlink($depth . "../../upload/images/" . $vals[count($vals) - 1]);
                file_unlink($depth . "../../upload/images/watermark/" . $vals[count($vals) - 1]);
            }
        }
    }
}
Esempio n. 19
0
    $allidlist = explode(',', $allid);
    foreach ($allidlist as $key => $val) {
        $para_list = $db->get_one("SELECT * FROM {$met_parameter} WHERE id='{$val}'");
        $type = $para_list['type'];
        $query = "delete from {$met_parameter} where id='{$val}'";
        $db->query($query);
        if ($type == 2 or $type == 4 or $type == 6) {
            $query = "delete from {$met_list} where bigid='{$val}'";
            $db->query($query);
        }
        /*delete images*/
        if ($type == 5) {
            $query = "select * from {$met_plist} where paraid='{$val}'";
            $result = $db->query($query);
            while ($list = $db->fetch_array($result)) {
                file_unlink("../../" . $list[info]);
            }
        }
        $query = "delete from {$met_plist} where paraid='{$val}'";
        $db->query($query);
        $type = '';
    }
    metsave('../column/parameter/parameter.php?anyid=' . $anyid . '&module=' . $module . '&lang=' . $lang . '&class1=' . $class1 . '&cs=' . $cs, '', $depth);
} elseif ($action == "addsave") {
    $newslit = "<tr class='mouse newlist'>\n";
    $newslit .= "<td class='list-text'><input name='id' type='checkbox' value='new{$lp}' checked='checked' /></td>\n";
    $newslit .= "<td class='list-text'><input name='no_order_new{$lp}' type='text' class='text no_order' /></td>\n";
    $newslit .= "<td class='list-text' style='padding-left:15px; text-align:left;'><input name='name_new{$lp}' type='text' class='text nonull' /></td></td>\n";
    if ($module == 6 || $module == 8 || $module == 10 || $module == 7) {
        $newslit .= "<td class='list-text' style='padding-left:15px; text-align:left;'><input name='description_new{$lp}' type='text' class='text' /></td></td>\n";
    }
Esempio n. 20
0
function delete_page_base($page = '', $board = false)
{
    global $config, $mod;
    if (empty($board)) {
        $board = false;
    }
    if (!$board && $mod['boards'][0] !== '*') {
        error($config['error']['noaccess']);
    }
    if (!hasPermission($config['mod']['edit_pages'], $board)) {
        error($config['error']['noaccess']);
    }
    if ($board !== FALSE && !openBoard($board)) {
        error($config['error']['noboard']);
    }
    if (preg_match('/^[a-z0-9]{1,255}$/', $page) && !preg_match('/^(index|catalog|index\\+50)|(\\d+)$/', $page)) {
        if ($board) {
            $query = prepare('DELETE FROM ``pages`` WHERE `board` = :board AND `name` = :name');
            $query->bindValue(':board', $board ? $board : NULL);
        } else {
            $query = prepare('DELETE FROM ``pages`` WHERE `board` IS NULL AND `name` = :name');
        }
        $query->bindValue(':name', $page);
        $query->execute() or error(db_error($query));
        @file_unlink(($board ? $board . '/' : '') . $page . '.html');
    }
    header('Location: ?/edit_pages' . ($board ? '/' . $board : ''), true, $config['redirect_http']);
}
Esempio n. 21
0
    if (iconv($codeold, $codenew, $val) == $lang_columnhtmlname) {
        $staticnum = $key;
    }
}
$numcsv = 0;
while ($data = fgetcsv($file)) {
    $staticone = iconv($codeold, $codenew, $data[$staticnum]);
    if ($staticone != NULL) {
        $static[$numcsv + 1] = $staticone;
        $static_copy[] = $staticone;
    }
    $dataqrray[] = $data;
    $numcsv++;
}
fclose($file);
@file_unlink($flienamecsv);
if ($static) {
    foreach ($static_copy as $key => $val) {
        $shift = array_shift($static_copy);
        if (array_search($shift, $static_copy) == NULL) {
            if ($shift == $static_copy[0]) {
                $num = $key + 2;
                metsave("../app/batch/contentup.php?anyid={$anyid}&lang={$lang}", "{$lang_csverror1}{$num}", $depth);
            }
        } else {
            $num = $key + 2;
            metsave("../app/batch/contentup.php?anyid={$anyid}&lang={$lang}", "{$lang_csverror1}{$num}", $depth);
        }
    }
    $query = "select id from {$met_column} where (classtype=1 or releclass!=0) and foldername='{$classcsv['foldername']}'";
    $sameflie = $db->get_all($query);
Esempio n. 22
0
} else {
    $admin_list = $db->get_one("SELECT * FROM {$met_column} WHERE id='{$id}'");
    if (!$admin_list) {
        metsave('../column/index.php?anyid=' . $anyid . '&lang=' . $lang, $lang_dataerror);
    }
    $query1 = "select * from {$met_column} where bigclass='{$admin_list['id']}'";
    $result1 = $db->query($query1);
    while ($list1 = $db->fetch_array($result1)) {
        if ($list1['releclass'] || $list1['classtype'] == 3) {
            delcolumn($list1);
        } else {
            $query2 = "select * from {$met_column} where bigclass='{$list1['id']}'";
            $result2 = $db->query($query2);
            while ($list2 = $db->fetch_array($result2)) {
                delcolumn($list2);
            }
            delcolumn($list1);
        }
    }
    if ($admin_list[module] > 1000) {
        deldir("../../" . $admin_list[foldername]);
        $query = "delete from {$met_ifmember_left} where columnid='{$id}'";
        $db->query($query);
    }
    delcolumn($admin_list);
    file_unlink("../../cache/column_{$lang}.inc.php");
    $gent = '../../sitemap/index.php?lang=' . $lang . '&htmsitemap=' . $met_member_force;
    metsave('../column/index.php?anyid=' . $anyid . '&lang=' . $lang, '', '', '', $gent);
}
# 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.
Esempio n. 23
0
fclose($fp);
$sqlzip = 'csv.zip';
$archive = new PclZip($sqlzip);
$zip_list = $archive->create("./{$title}.csv");
$cont = iconv($codeold, $codenew, "{$lang_csvexplain1}\r\n{$lang_csvexplain2}\r\n{$lang_csvexplain3}\r\n{$lang_csvexplain4}");
$fp = fopen(iconv($codeold, $codenew, "./{$lang_langshuom}.txt"), w);
fputs($fp, $cont);
fclose($fp);
$zip_list = $archive->add(iconv($codeold, $codenew, "./{$lang_langshuom}.txt"));
@file_unlink("./{$title}.csv");
@file_unlink(iconv($codenew, $codeold, "./{$title}.csv"));
@file_unlink(iconv($codeold, $codenew, "./{$lang_langshuom}.txt"));
header("Content-type:application/zip;");
$title = $title . '.zip';
$title = iconv($codenew, $codeold, $title);
$encoded_filename = urlencode($title);
$encoded_filename = str_replace("+", "%20", $encoded_filename);
$ua = $_SERVER["HTTP_USER_AGENT"];
if (preg_match("/MSIE/", $ua)) {
    header('Content-Disposition: attachment; filename="' . $encoded_filename . '"');
} else {
    if (preg_match("/Firefox/", $ua)) {
        header('Content-Disposition: attachment; filename="' . $title . '"');
    } else {
        header('Content-Disposition: attachment; filename="' . $title . '"');
    }
}
readfile("csv.zip");
@file_unlink("csv.zip");
# 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.
Esempio n. 24
0
function undoImage(array $post)
{
    if (!$post['has_file'] || !isset($post['files'])) {
        return;
    }
    foreach ($post['files'] as $key => $file) {
        if (isset($file['file_path'])) {
            file_unlink($file['file_path']);
        }
        if (isset($file['thumb_path'])) {
            file_unlink($file['thumb_path']);
        }
    }
}
Esempio n. 25
0
File: htm.php Progetto: nanfs/lt
    if (!file_exists('../databack/')) {
        @mkdir('../databack/', 0777);
    }
    $sqlzip = '../databack/metinfo_htmpack_' . date('YmdHis', time()) . '.zip';
    $zipfile = '../databack/htmpack/';
    $archive = new PclZip($sqlzip);
    $zip_list = $archive->create($zipfile, PCLZIP_OPT_REMOVE_PATH, $zipfile);
    if ($zip_list == 0) {
        die("Error : " . $archive->errorInfo(true));
    }
    deldir($zipfile);
    $fnames = 'metinfo_htmpack_' . date('YmdHis', time());
    header("Content-type:application/zip;");
    header("Content-Disposition:attachment;filename={$fnames}.zip;");
    readfile("{$sqlzip}");
    @file_unlink("{$sqlzip}");
} else {
    $methtmx = '';
    if ($index == "index") {
        $methtm[] = indexhtm(1);
    }
    if ($module == 1) {
        $folder = $met_class[$class1];
        $methtm[] = showhtm($class1, 1);
        if ($met_class[$class1]['releclass']) {
            foreach ($met_class3[$class1] as $key => $val1) {
                if ($val1[isshow]) {
                    $methtm[] = showhtm($val1[id], 1);
                }
            }
        } else {
Esempio n. 26
0
    $sql_errors = '';
    foreach ($queries as &$query) {
        if (!query($query)) {
            $sql_errors .= '<li>' . db_error() . '</li>';
        }
    }
    $boards = listBoards();
    foreach ($boards as &$_board) {
        setupBoard($_board);
        buildIndex();
    }
    $page['title'] = 'Installation complete';
    $page['body'] = '<p style="text-align:center">Thank you for using Tinyboard. Please remember to report any bugs you discover. <a href="http://tinyboard.org/docs/?p=Config">How do I edit the config files?</a></p>';
    if (!empty($sql_errors)) {
        $page['body'] .= '<div class="ban"><h2>SQL errors</h2><p>SQL errors were encountered when trying to install the database. This may be the result of using a database which is already occupied with a Tinyboard installation; if so, you can probably ignore this.</p><p>The errors encountered were:</p><ul>' . $sql_errors . '</ul><p><a href="?step=5">Ignore errors and complete installation.</a></p></div>';
    } else {
        file_write($config['has_installed'], VERSION);
        if (!file_unlink(__FILE__)) {
            $page['body'] .= '<div class="ban"><h2>Delete install.php!</h2><p>I couldn\'t remove <strong>install.php</strong>. You will have to remove it manually.</p></div>';
        }
    }
    echo Element('page.html', $page);
} elseif ($step == 5) {
    $page['title'] = 'Installation complete';
    $page['body'] = '<p style="text-align:center">Thank you for using Tinyboard. Please remember to report any bugs you discover.</p>';
    file_write($config['has_installed'], VERSION);
    if (!file_unlink(__FILE__)) {
        $page['body'] .= '<div class="ban"><h2>Delete install.php!</h2><p>I couldn\'t remove <strong>install.php</strong>. You will have to remove it manually.</p></div>';
    }
    echo Element('page.html', $page);
}
Esempio n. 27
0
     // Remove board from users/permissions table
     $query = query('SELECT `id`,`boards` FROM ``mods``') or error(db_error());
     while ($user = $query->fetch(PDO::FETCH_ASSOC)) {
         $user_boards = explode(',', $user['boards']);
         if (in_array($board['uri'], $user_boards)) {
             unset($user_boards[array_search($board['uri'], $user_boards)]);
             $_query = prepare('UPDATE ``mods`` SET `boards` = :boards WHERE `id` = :id');
             $_query->bindValue(':boards', implode(',', $user_boards));
             $_query->bindValue(':id', $user['id']);
             $_query->execute() or error(db_error($_query));
         }
     }
     // Delete entire board directory
     exec('rm -rf ' . $board['uri'] . '/');
     rrmdir('static/banners/' . $board['uri']);
     file_unlink("stylesheets/board/{$board['uri']}.css");
     // HAAAAAX
     if ($config['dir']['img_root'] != '') {
         rrmdir($config['dir']['img_root'] . $board['uri']);
     }
     if ($config['cache']['enabled']) {
         cache::delete('board_' . $board['uri']);
     }
     _syslog(LOG_NOTICE, "Board deleted: {$board['uri']}");
     if ($d['mod']) {
         $query = prepare('DELETE FROM ``mods`` WHERE `username` = BINARY :id');
         $query->bindValue(':id', $d['mod']);
         $query->execute() or error(db_error($query));
     }
 }
 fclose($f);