Exemple #1
0
 function DoClean()
 {
     $type = get_param('type');
     if (!$type) {
         $this->Messager("请先选择要清理的缓存对象");
     }
     $this->_removeTopicAttach();
     $this->_removeTopicLongtext();
     $this->_removeVoteImage();
     if (in_array('data', $type)) {
         cache_db('clear');
         jtable('failedlogins')->truncate();
         DB::query("update " . TABLE_PREFIX . "members set `username`=`uid` WHERE `username`!=`uid` AND `username` REGEXP '^[0-9]*\$'");
     }
     if (in_array('tpl', $type)) {
         cache_clear();
         jconf::set('validate_category', array());
         jlogic('credits')->rule_conf(true);
     }
     if (in_array('channel', $type)) {
         jlogic('channel')->update_data();
     }
     if (in_array('album', $type)) {
         jlogic('image')->update_data();
     }
     $this->Messager("已清空所有缓存");
 }
Exemple #2
0
/**
 * user_create
 * 
 * creates a new user in the database with the
 * given parameters
 * 
 * $data    -   an array of items to be JSON encoded in
 *              the data field
 * $options -   an array of options to be added to the
 *              options database table for the user
 * $mail    -   an array with the keys 'subject', 'message',
 *              for the users notification email         
 * 
 * @param string $name
 * @param string $email
 * @param string $password
 * @param array $groups
 * @param array $data optional
 * @param array $options optional
 * @param array $mail optional
 * @return int|bool $id
 */
function user_create($name, $email, $password, $groups, $data = array(), $options = array(), $mail = true)
{
    /**
     * if email is in use, return false
     * note; one account per email
     */
    if (num('select id from ' . DB_USERS . ' where email="' . $email . '"') != 0) {
        return false;
    }
    /**
     * add to users table
     */
    $hash = md5(mt_rand());
    query('insert into ' . DB_USERS . ' values (' . '"",' . '"' . $name . '",' . '"' . $email . '",' . '"' . md5($password) . '",' . '"' . $hash . '",' . '"",' . '"' . json_encode($data) . '"' . ')');
    $id = mysql_insert_id();
    /**
     * add to groups table for each group
     */
    foreach ($groups as $group) {
        query('insert into ' . DB_USERS_GROUPS . ' values( ' . $id . ', ' . $group . ' )');
    }
    /**
     * create user files directory
     */
    $FileManager = FileManager::getInstance();
    $FileManager->addDir('users/' . $id);
    /**
     * add options to options table if nessecary
     */
    if (!empty($options)) {
        foreach ($options as $name => $value) {
            query('insert into ' . DB_OPTIONS . ' values( "' . $name . '", "' . $value . '", "user_' . $id . '"');
        }
    }
    // default email
    if ($mail) {
        $mail = array();
        $mail['subject'] = 'User Activation - Furasta.Org';
        $mail['message'] = $name . ',<br/>
		<br/>
		Please activate your new user by clicking on the link below:<br/>
		<br/>
		<a href="' . SITE_URL . 'admin/users/activate.php?hash=' . $hash . '">' . $url . '/admin/users/activate.php?hash=' . $hash . '</a><br/>
		<br/>
		If you are not the person stated above please ignore this email.<br/>
		';
    }
    // send notification email to user
    email($email, $mail['subject'], $mail['message']);
    cache_clear('DB_USERS');
    return $id;
}
Exemple #3
0
 public function exec($sql, $cache_file = false)
 {
     $this->queryCount++;
     try {
         $this->queryHistory[] = $sql;
         if ($cache_file) {
             cache_clear($cache_file);
         }
         return PDO::exec($sql);
     } catch (Exception $e) {
         exit('<h3>Error while executing SQL query!</h3><code>Code: ' . end($this->errorInfo()) . '</code><p><em>For more information check log file.</em></p>');
     }
 }
function cache_clear($type = '')
{
    if (!is_dir(USERBASE . '/ww.cache/' . $type)) {
        return;
    }
    $d = new DirectoryIterator(USERBASE . '/ww.cache/' . $type);
    foreach ($d as $f) {
        $f = $f->getFilename();
        if ($f == '.' || $f == '..') {
            continue;
        }
        if (is_dir(USERBASE . '/ww.cache/' . $type . '/' . $f)) {
            cache_clear($type . '/' . $f);
            rmdir(USERBASE . '/ww.cache/' . $type . '/' . $f);
        } else {
            unlink(USERBASE . '/ww.cache/' . $type . '/' . $f);
        }
    }
}
Exemple #5
0
    public static function update($holder)
    {
        global $blocks, $cfg, $sql, $form, $lang_system, $lang_admin;
        if ($form['blocks'] !== false) {
            $form['blocks'] = implode(', ', $form['blocks']);
        }
        foreach ($form as $key => $value) {
            if (isset($cfg->{$holder}[$key]) && $cfg->{$holder}[$key] != $value) {
                $value ? $sql->exec('
						UPDATE ' . DB_PREFIX . 'config
						SET content = ' . (is_numeric($value) ? $value : '"' . $value . '"') . '
						WHERE name = "' . $key . '" AND holder = "' . $holder . '"') : $sql->exec('DELETE FROM ' . DB_PREFIX . 'config WHERE name = "' . $key . '" AND holder = "' . $holder . '"');
            } elseif (!isset($cfg->{$holder}[$key]) && $value) {
                $sql->exec('
					INSERT INTO ' . DB_PREFIX . 'config (holder, name, content)
					VALUES ("' . $holder . '", "' . $key . '", ' . (is_numeric($value) ? (int) $value : '"' . $value . '"') . ')');
            }
            cache_clear('config.txt');
        }
    }
function cache_load($srcpath, $thumbw, $thumbh)
{
    global $cfg, $imgIsRemote;
    cache_clear();
    // Setup
    if ($imgIsRemote) {
        $srctime = time();
    } else {
        $srctime = @filemtime($srcpath);
    }
    if (!$srctime) {
        return false;
    }
    // Get data
    $data = fr("cache/cacheData.txt");
    if ($data) {
        $data = explode("####\r\n", $data);
    } else {
        $data = array();
    }
    // Search data
    for ($i = count($data); $i >= 0; $i--) {
        $values = explode("##", $data[$i]);
        if ($srcpath == $values[0] && $thumbw == $values[2] && $thumbh == $values[3]) {
            if ($srctime >= $values[4]) {
                cache_log("CACHE_RENEW :: " . $srcpath);
                cache_remove($srcpath);
                return false;
            }
            if (!file_exists($values[1])) {
                cache_remove($srcpath);
                return false;
            }
            cache_log("CACHE_LOAD :: " . $srcpath);
            return $values[1];
        }
    }
    return false;
}
 function DoModifyRewrite()
 {
     $reserved_keys = array('api' => 1, 'backup' => 1, 'cache' => 1, 'data' => 1, 'log' => 1, 'iis_rewrite' => 1, 'images' => 1, 'include' => 1, 'install' => 1, 'modules' => 1, 'setting' => 1, 'templates' => 1, 'uc_server' => 1, 'uc_client' => 1, 'wap' => 1, 'blacklist' => 1, 'get_password' => 1, 'imjiqiren' => 1, 'login' => 1, 'master' => 1, 'member' => 1, 'other' => 1, 'pm' => 1, 'profile' => 1, 'report' => 1, 'search' => 1, 'settings' => 1, 'share' => 1, 'show' => 1, 'tag' => 1, 'theme' => 1, 'topic' => 1, 'url' => 1, 'user_tag' => 1, 'weather' => 1, 'xwb' => 1, 'htaccess' => 1, 'admin' => 1, 'ajax' => 1, 'changelog' => 1, 'favicon' => 1, 'index' => 1, 'license' => 1, 'public' => 1, 'robots' => 1, 'server' => 1, 'test' => 1, 'upgrade' => 1, 'plugin' => 1, 'channel' => 1, 'attach' => 1, 'live' => 1, 'talk' => 1, 'company' => 1, 'department' => 1, 'job' => 1);
     $mod_alias = array();
     foreach ((array) $this->Post['mod_alias'] as $old_name => $new_name) {
         $new_name = trim($new_name);
         if (!empty($new_name) && $old_name != $new_name && preg_match("~^[A-Za-z0-9_]+\$~", $new_name) && !isset($reserved_keys[$new_name])) {
             $mod_alias[$old_name] = $new_name;
         }
     }
     $_rewrite = jconf::get('rewrite');
     if (isset($this->Post['_rewrite_extention']) && (!$this->Post['_rewrite_extention'] || preg_match('~^[\\w\\d\\/\\-\\_\\.]+$~', $this->Post['_rewrite_extention']))) {
         $_rewrite['extention'] = $this->Post['_rewrite_extention'];
     }
     $_rewrite['mode'] = $this->Post['mode'];
     $_rewrite['abs_path'] = preg_replace("/\\/+/", '/', str_replace("\\", '/', dirname($_SERVER['PHP_SELF'])) . "/");
     $gateway = array("stand" => "", "apache_path" => "index.php/", "normal" => "?", "" => "");
     $_rewrite['gateway'] = $gateway[$_rewrite['mode']];
     if (!empty($mod_alias)) {
         $_rewrite['value_replace_list']['mod'] = $mod_alias;
     } else {
         unset($_rewrite['value_replace_list']['mod']);
     }
     jconf::set('rewrite', $_rewrite);
     if ($_rewrite['mode'] == 'stand') {
         $this->_writeHtaccess($_rewrite['abs_path']);
     }
     jconf::update('rewrite_enable', $_rewrite['mode'] ? 1 : 0);
     cache_clear();
     $this->Messager("修改成功,正在更新缓存");
 }
Exemple #8
0
                         if ($step == 6) {
                             cache_clear('fields');
                             cache_fields();
                             cache_clear('option');
                             msg('自定义字段更新成功', '?action=' . $action . '&step=' . ($step + 1));
                         } else {
                             if ($step == 7) {
                                 cache_clear_ad();
                                 tohtml('index');
                                 msg('全部缓存更新成功');
                             } else {
                                 cache_clear('group');
                                 cache_group();
                                 cache_clear('type');
                                 cache_type();
                                 cache_clear('keylink');
                                 cache_keylink();
                                 cache_pay();
                                 cache_banip();
                                 cache_banword();
                                 cache_bancomment();
                                 msg('正在开始更新缓存', '?action=' . $action . '&step=' . ($step + 1));
                             }
                         }
                     }
                 }
             }
         }
     }
     break;
 case 'cacheclear':
Exemple #9
0
 function DoModify()
 {
     if (isset($this->Post['show'])) {
         jconf::set('show', $this->Post['show']);
     }
     if (isset($this->Post['cache'])) {
         jconf::set('cache', $this->Post['cache']);
     }
     cache_clear();
     $config = array();
     if ($this->Post['template_path'] != "" && $this->Post['template_path'] != $this->Config['template_path']) {
         $this->Post['template_path'] = dir_safe($this->Post['template_path']);
         $config['template_path'] = $this->Post['template_path'];
     }
     if (isset($this->Post['templatedeveloper']) && $this->Post['templatedeveloper'] != $this->Config['templatedeveloper']) {
         $config['templatedeveloper'] = $this->Post['templatedeveloper'] ? 1 : 0;
     }
     if (isset($this->Post['style_three_tol']) && $this->Post['style_three_tol'] != $this->Config['style_three_tol']) {
         $config['style_three_tol'] = $this->Post['style_three_tol'] ? 1 : 0;
     }
     if ($config) {
         jconf::update($config);
     }
     $this->Messager("设置成功");
 }
    header('location: users.php');
}
/**
 * set up javascript and php form validation
 */
$conds = array('Name' => array('required' => true, 'pattern' => "^[A-Z a-z]{1,50}\$"), 'Email' => array('required' => true, 'email' => true));
$valid = validate($conds, "#users-edit", 'Edit-User');
/**
 * read post information and edit page if applicable
 */
if (isset($_POST['Edit-User']) && $valid == true) {
    $name = addslashes($_POST['Name']);
    $email = addslashes($_POST['Email']);
    $group = addslashes($_POST['Group']);
    query('update ' . DB_USERS . ' set name="' . $name . '",email="' . $email . '", user_group="' . $group . '" where id=' . $id);
    cache_clear('USERS');
}
$user = User::getInstance($id);
$Template->loadJavascript('admin/users/edit-user.js');
$content = '
<span style="float:right" id="change-password"><span id="header-Login" class="header-img"></span><h1 class="image-left link">Reset Password</h1></span>
<span id="header-Users" class="header-img"></span><h1 class="image-left">Edit User</h1>

<br/>
	<form method="post" id="users-edit">
		<div id="tabs">
			<ul>
				<li><a href="#Options">General</a></li>
			</ul>
			<div id="#Options">
                                <table class="row-color">
<?php

require '../../ww.incs/basics.php';
if (!is_admin()) {
    exit;
}
$id = (int) $_REQUEST['id'];
$to = (int) $_REQUEST['parent_id'];
$order = explode(',', $_REQUEST['order']);
dbQuery("update pages set parent={$to} where id={$id}");
for ($i = 0; $i < count($order); ++$i) {
    $pid = (int) $order[$i];
    dbQuery("update pages set ord={$i} where id={$pid}");
    echo "update pages set ord={$i} where id={$pid}\n";
}
cache_clear('pages');
cache_clear('menus');
dbQuery('update page_summaries set rss=""');
Exemple #12
0
 function delete()
 {
     $_tmp_arr = (array) ($this->Get['id'] ? $this->Get['id'] : $this->Post['delete']);
     $id_arr = array();
     foreach ($_tmp_arr as $_id) {
         $_id = (int) $_id;
         if ($_id > 0) {
             $id_arr[$_id] = $_id;
         }
     }
     if (!$id_arr) {
         $this->Messager("未指定删除的标签");
     }
     $sql = "SELECT * FROM `" . TABLE_PREFIX . "tag` WHERE `id` in('" . implode("','", $id_arr) . "')";
     $query = $this->DatabaseHandler->Query($sql);
     $tag_id_list = $tag_list = array();
     while (false != ($row = $query->GetRow())) {
         $id = (int) $row['id'];
         if ($id < 1) {
             continue;
         }
         $tag_id_list[$id] = $id;
         $tag_list[$id] = $row['name'];
     }
     if (!$tag_id_list) {
         $this->Messager("请指定删除的标签");
     }
     $ids = "'" . implode("','", $tag_id_list) . "'";
     $sql = "DELETE FROM `" . TABLE_PREFIX . "tag` WHERE `id` IN({$ids})";
     DB::query($sql, "SKIP_ERROR");
     $sql = "DELETE FROM `" . TABLE_PREFIX . "my_tag` WHERE `tag_id` IN({$ids})";
     DB::query($sql, "SKIP_ERROR");
     $item_list = jconf::get('tag', 'item_list');
     foreach ($item_list as $item) {
         $sql = "DELETE FROM `" . $item['table_name'] . "_tag` WHERE `tag_id` IN({$ids})";
         DB::query($sql, "SKIP_ERROR");
         $sql = "DELETE FROM `" . TABLE_PREFIX . "my_{$item['value']}_tag` WHERE `tag_id` IN({$ids})";
         DB::query($sql, "SKIP_ERROR");
         foreach ($tag_list as $tag) {
             if (!$tag) {
                 continue;
             }
             $sql = "UPDATE `{$item['table_name']}` SET `tag`=TRIM(LEADING ',' FROM REPLACE(CONCAT_WS('',',',tag),',{$tag}','')) , `tag_count`=if(`tag_count`>1,`tag_count`-1,0) WHERE `tag` LIKE '%{$tag}%'";
             DB::query($sql, "SKIP_ERROR");
         }
     }
     cache_clear();
     $this->Messager("删除成功");
 }
Exemple #13
0
 function batch_process($content_items = false)
 {
     $chunks_folder = $this->get_import_location() . '_process_import' . DS;
     $index_file = $chunks_folder . 'index.php';
     if (!is_dir($chunks_folder)) {
         mkdir_recursive($chunks_folder);
     }
     $total = 0;
     $remaining = 0;
     $batch_file = false;
     if (!is_array($content_items) or empty($content_items)) {
         $content_items = array();
         if (is_file($index_file)) {
             $total = file_get_contents($index_file);
         }
         if ($total == 0) {
             $total = 0;
             $dir = $chunks_folder;
             if ($handle = opendir($dir)) {
                 while (($file = readdir($handle)) !== false) {
                     if (!in_array($file, array('.', '..')) && !is_dir($dir . $file) and strstr($file, 'import_chunk_')) {
                         $total++;
                     }
                 }
             }
             file_put_contents($index_file, $total);
         }
         $i = 0;
         $dir = $chunks_folder;
         $rem_counter = 0;
         $process_xml_files = array();
         $chunk_size = $this->batch_size;
         if ($handle = opendir($dir)) {
             while (($file = readdir($handle)) !== false) {
                 if (!in_array($file, array('.', '..')) && !is_dir($dir . $file) and strstr($file, 'import_chunk_')) {
                     //if (!is_array($content_items)) {
                     if ($i < $chunk_size) {
                         $batch_file = $chunks_folder . $file;
                         $batch_file_content = file_get_contents($batch_file);
                         if (strstr($file, 'import_chunk_xml')) {
                             // for ($x=0; $x<=10; $x++){
                             $content_from_xml = $this->parse_content_from_xml_string($batch_file_content);
                             if (is_array($content_from_xml)) {
                                 foreach ($content_from_xml as $content_from_x) {
                                     $content_items[] = $content_from_x;
                                 }
                                 // $rem_counter--;
                             }
                             //}
                         } else {
                             $content_items_from_file = @unserialize($batch_file_content);
                             if (!empty($content_items_from_file)) {
                                 foreach ($content_items_from_file as $content_from_x) {
                                     $content_items[] = $content_from_x;
                                 }
                             }
                         }
                         if ($batch_file != false and is_file($batch_file)) {
                             @unlink($batch_file);
                         }
                     }
                     $i++;
                 }
             }
             $remaining = $i;
         }
     } else {
         $total = count($content_items);
     }
     // dd($content_items);
     if ($content_items != false and is_array($content_items)) {
         if (!empty($content_items)) {
             $parent = get_content('one=true&subtype=dynamic&is_deleted=0&is_active=1');
             if ($parent == false) {
                 $parent = get_content('one=true&content_type=page&is_deleted=0&is_active=1');
             }
             if ($parent == false) {
                 $parent = 0;
             }
             $content_items = $this->map_array($content_items);
             $parent_id = $parent['id'];
             $restored_items = array();
             foreach ($content_items as $content) {
                 if (isset($content['title'])) {
                     $is_saved = get_content('one=true&title=' . $content['title']);
                     if (isset($content['description']) and (!isset($content['content']) or $content['content'] == false)) {
                         //$content['content'] = $content['description'];
                     }
                     if (!isset($content['parent'])) {
                         $content['parent'] = $parent_id;
                     }
                     if (isset($content['parent'])) {
                         $par = get_content_by_id($content['parent']);
                         if ($par != false) {
                             if (isset($par['is_shop']) and $par['is_shop'] == 1) {
                                 $content['content_type'] = 'product';
                                 $content['subtype'] = 'product';
                             }
                         }
                     }
                     if (!isset($content['content_type'])) {
                         $content['content_type'] = 'post';
                     }
                     if (!isset($content['subtype'])) {
                         $content['subtype'] = 'post';
                     }
                     // $content['subtype'] = 'post';
                     $content['is_active'] = 1;
                     if (isset($content['debug'])) {
                         unset($content['debug']);
                     }
                     //  $content['debug'] = 'y';
                     //  $content['download_remote_images'] = true;
                     if ($is_saved != false) {
                         $content['id'] = $is_saved['id'];
                         if (!isset($content['content_type'])) {
                             $content['content_type'] = $is_saved['content_type'];
                             $content['subtype'] = $is_saved['subtype'];
                         }
                     }
                     $import = save_content($content);
                     $restored_items[] = $import;
                 }
             }
             cache_clear('categories');
             cache_clear('content');
             $remaining = $remaining - 1;
             if ($remaining <= 0) {
                 file_put_contents($index_file, '0');
             }
             if ($total < $remaining) {
                 $total = 0;
                 $dir = $chunks_folder;
                 if ($handle = opendir($dir)) {
                     while (($file = readdir($handle)) !== false) {
                         if (!in_array($file, array('.', '..')) && !is_dir($dir . $file) and strstr($file, 'import_chunk_')) {
                             $total++;
                         }
                     }
                 }
                 file_put_contents($index_file, $total);
             }
             $ret = array('success' => count($restored_items) . " items restored", 'total' => $total, 'remaining' => $remaining);
             return $ret;
         }
     }
     return false;
 }
Exemple #14
0
<?php

/*
	[Destoon B2B System] Copyright (c) 2008-2015 www.destoon.com
	This is NOT a freeware, use is subject to license.txt
*/
defined('DT_ADMIN') or exit('Access Denied');
$menus = array(array('重建缓存', '?file=' . $file . '&action=cache'), array('模板管理', '?file=template'), array('风格管理', '?file=skin'), array('标签向导', '?file=' . $file));
switch ($action) {
    case 'cache':
        cache_clear('htm', 'dir', 'tag');
        dmsg('更新成功', '?file=' . $file);
        break;
    case 'find':
        $mid or $mid = '';
        $tb = isset($tb) ? trim($tb) : '';
        if (isset($MODULE[$mid]) && $mid > 3) {
            $table = get_table($mid);
            $note = urlencode($MODULE[$mid]['name']);
        } else {
            $table = $DT_PRE . $tb;
            $note = '';
        }
        dheader('?file=' . $file . '&action=dict&table=' . $table . '&note=' . $note);
        break;
    case 'dict':
        isset($table) && $table or exit;
        $table = strip_sql($table, 0);
        if (strpos($table, $DT_PRE) === false) {
            $rtable = $table;
        } else {
Exemple #15
0
function cache_clear_sql($dir, $all = false)
{
    global $DT_TIME;
    if ($dir) {
        $globs = glob(DT_CACHE . '/sql/' . $dir . '/*.php');
        if ($globs) {
            foreach ($globs as $v) {
                if ($all) {
                    file_del($v);
                } else {
                    $exptime = intval(substr(file_get($v), 8, 18));
                    if ($exptime && $DT_TIME > $exptime) {
                        file_del($v);
                    }
                }
            }
        }
    } else {
        cache_clear('php', 'dir', 'sql');
    }
}
 /**
  * uninstall
  * Uninstall module
  */
 function uninstall()
 {
     parent::uninstall();
     Router::cleanUpCache(true);
     if (function_exists("cache_clear")) {
         cache_clear();
     }
 }
Exemple #17
0
/**
 * cache_clear_image
 *
 * destroys all caches of a single image
 *
 * @param string $path
 * @return bool
 */
function cache_clear_image($path)
{
    return cache_clear('IMAGES' . '/' . md5($path));
}
Exemple #18
0
 case 'download':
     $fileid or msg();
     $file_ext = $bakid ? '.' . $bakid . '.bak' : '.htm';
     file_down($template_root . '/' . $fileid . $file_ext);
     break;
 case 'delete':
     $fileid or msg();
     $file_ext = $bakid ? '.' . $bakid . '.bak' : '.htm';
     file_del($template_root . '/' . $fileid . $file_ext);
     if (!$bakid) {
         template_name();
     }
     dmsg('删除成功', $this_forward);
     break;
 case 'cache':
     cache_clear('php', 'dir', 'tpl');
     dmsg('更新成功', $this_forward);
     break;
 default:
     $dirs = $files = $templates = $baks = array();
     if (substr($template_root, -1) != '/') {
         $template_root .= '/';
     }
     $files = glob($template_root . '*');
     if (!$files) {
         msg('模板文件不存在,请先创建', "?file={$file}&action=add&dir={$dir}");
     }
     foreach ($files as $k => $v) {
         if (is_dir($v)) {
             $dirid = basename($v);
             $dirs[$dirid]['dirname'] = $dirid;
Exemple #19
0
function delete_record($dbHandle, $files)
{
    global $database_path;
    settype($files, "array");
    // get PDF filenames of deleted items
    $result = $dbHandle->query("SELECT file FROM library WHERE id IN (" . join(',', $files) . ")");
    $filenames = $result->fetchAll(PDO::FETCH_COLUMN);
    $result = null;
    // delete PDFs, supplementary files and PNGs
    while (list(, $filename) = each($filenames)) {
        if (is_file('library' . DIRECTORY_SEPARATOR . $filename)) {
            unlink('library' . DIRECTORY_SEPARATOR . $filename);
        }
        $integer1 = sprintf("%05d", intval($filename));
        $supplementary_files = glob('library/supplement/' . $integer1 . '*', GLOB_NOSORT);
        if (is_array($supplementary_files)) {
            foreach ($supplementary_files as $supplementary_file) {
                @unlink($supplementary_file);
            }
        }
        $png_files = glob('library/pngs/' . $integer1 . '*.png', GLOB_NOSORT);
        if (is_array($png_files)) {
            foreach ($png_files as $png_file) {
                @unlink($png_file);
            }
        }
    }
    // delete from clipboard, make sure session_write_close was not called before this
    if (!empty($_SESSION['session_clipboard'])) {
        $_SESSION['session_clipboard'] = array_diff($_SESSION['session_clipboard'], $files);
    }
    // delete from main database
    $dbHandle->beginTransaction();
    $dbHandle->exec("DELETE FROM library WHERE id IN (" . join(',', $files) . ")");
    $dbHandle->exec("DELETE FROM shelves WHERE fileID IN (" . join(',', $files) . ")");
    $dbHandle->exec("DELETE FROM filescategories WHERE fileID IN (" . join(',', $files) . ")");
    $dbHandle->exec("DELETE FROM projectsfiles WHERE fileID IN (" . join(',', $files) . ")");
    $dbHandle->exec("DELETE FROM notes WHERE fileID IN (" . join(',', $files) . ")");
    $dbHandle->exec("DELETE FROM yellowmarkers WHERE filename IN ('" . join("','", $filenames) . "')");
    $dbHandle->exec("DELETE FROM annotations WHERE filename IN ('" . join("','", $filenames) . "')");
    $dbHandle->commit();
    $dbHandle = null;
    // delete full texts
    $fdbHandle = database_connect($database_path, 'fulltext');
    $fdbHandle->exec("DELETE FROM full_text WHERE fileID IN (" . join(',', $files) . ")");
    $fdbHandle = null;
    // delete discussions
    if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'database' . DIRECTORY_SEPARATOR . 'discussions.sq3')) {
        $fdbHandle = database_connect($database_path, 'discussions');
        $fdbHandle->exec("DELETE FROM filediscussion WHERE fileID IN (" . join(',', $files) . ")");
        $fdbHandle = null;
    }
    // delete PDF bookmarks and history
    if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'database' . DIRECTORY_SEPARATOR . 'history.sq3')) {
        $fdbHandle = database_connect($database_path, 'history');
        $fdbHandle->beginTransaction();
        $fdbHandle->exec("DELETE FROM usersfiles WHERE fileID IN (" . join(',', $files) . ")");
        $fdbHandle->exec("DELETE FROM bookmarks WHERE file IN ('" . join("','", $filenames) . "')");
        $fdbHandle->commit();
        $fdbHandle = null;
    }
    // update export files cache
    $export_files = read_export_files(0);
    $export_files = array_diff($export_files, $files);
    $export_files = array_values($export_files);
    cache_clear();
    save_export_files($export_files);
    if (!empty($error)) {
        return $error;
    }
}
Exemple #20
0
<?php

/*
	[Destoon B2B System] Copyright (c) 2008-2013 Destoon.COM
	This is NOT a freeware, use is subject to license.txt
*/
defined('IN_DESTOON') or exit('Access Denied');
switch ($action) {
    case 'cache':
        cache_clear_tag(1);
        //cache_clear_sql(0);
        cache_clear('php', 'dir', 'tpl');
        cache_clear('cat');
        cache_category();
        cache_clear('area');
        cache_area();
        msg('缓存更新成功', '?file=' . $file . '&action=module');
        break;
    case 'all':
        msg('全站更新成功');
        break;
    case 'index':
        tohtml('index');
        msg('网站首页生成成功', '?file=' . $file . '&action=all');
        break;
    case 'back':
        $moduleids = 0;
        unset($MODULE[1]);
        unset($MODULE[2]);
        $KEYS = array_keys($MODULE);
        foreach ($KEYS as $k => $v) {
if ($template == '' && $pid) {
    $template = dbOne('select template from pages where id=' . $pid, 'template');
}
$type = $_REQUEST['type'];
$title = isset($_REQUEST['title']) ? addslashes($_REQUEST['title']) : '';
$keywords = isset($_REQUEST['keywords']) ? $_REQUEST['keywords'] : '';
$associated_date = $_REQUEST['associated_date'];
$description = isset($_REQUEST['description']) ? $_REQUEST['description'] : '';
$importance = isset($_REQUEST['importance']) ? (double) $_REQUEST['importance'] : 0.5;
if ($importance < 0.1) {
    $importance = 0.5;
}
if ($importance > 1) {
    $importance = 1;
}
// }
$ord = dbOne('select ord from pages where parent=' . $pid . ' order by ord desc limit 1', 'ord') + 1;
$original_body = isset($_REQUEST['body']) ? $_REQUEST['body'] : '';
$body = $original_body;
$body = sanitise_html($body);
$q = 'insert into pages set ord="' . $ord . '",importance="' . $importance . '",' . 'keywords="' . $keywords . '",description="' . $description . '",cdate=now(),' . 'template="' . $template . '",edate=now(),name="' . $name . '",title="' . $title . '",' . 'original_body="' . addslashes($original_body) . '",' . 'body="' . addslashes($body) . '",type="' . $type . '",' . 'associated_date="' . addslashes($associated_date) . '"';
$q .= ',parent=' . $pid;
$q .= ',special=0';
dbQuery($q);
$id = dbOne('select last_insert_id() as id', 'id');
dbQuery('insert into permissions set id="' . $id . '", type=1, value="' . get_userid() . '=7' . "\n\n4" . '"');
$msgs .= '<em>' . __('New page created.') . '</em>';
dbQuery('update page_summaries set rss=""');
cache_clear('menus');
cache_clear('pages');
echo '<script>window.parent.pages_add_node("' . addslashes($name) . '",' . $id . ',' . $pid . ');</script>';
Exemple #22
0
    if (in_array($name, pages_array()) == false) {
        /**
         * if page should be new home page then remove
         * home tag from previous home page
         */
        if ($home == 1) {
            query('update ' . DB_PAGES . ' set home=0 where home=1');
        }
        /**
         * save page to database 
         */
        query('insert into ' . DB_PAGES . ' values ("","' . $name . '","' . $content . '","' . $slug . '","' . $template . '","' . $type . '","' . date("Y-m-d\n\t\t") . '","' . $User->name() . '","10000","' . $parent . '","' . $perm . '","' . $home . '","' . $navigation . '")');
        /**
         * clear pages cache and redirect to edit pages
         */
        cache_clear('PAGES');
        $id = mysql_insert_id();
        // update options if they exist
        update_options(@$_POST['options'], 'page_' . $id);
        header('location: pages.php?page=edit&error=3&id=' . $id);
    } else {
        $Template->runtimeError('4', $name);
    }
}
/**
 * set page options in case its used!
 */
$page_options = array();
/**
 * page specific javascript 
 */
Exemple #23
0
 * @version    1.0
 * @package    admin_pages
 */
/**
 * make sure ajax script was loaded and user is
 * logged in 
 */
if (!defined('AJAX_LOADED') || !defined('AJAX_VERIFIED')) {
    die;
}
/**
 * check if user has permission to delete pages
 */
if (!$User->hasPerm('d')) {
    die('perm');
}
$id = addslashes(@$_GET['id']);
if ($id == '') {
    exit;
}
$parent = single('select parent from ' . DB_PAGES . ' where id=' . $id, 'parent');
$children = rows('select id from ' . DB_PAGES . ' where parent=' . $id);
if (count($children) != 0) {
    foreach ($children as $child) {
        query('update ' . DB_PAGES . ' set parent=' . $parent . ' where id=' . $child['id']);
    }
}
query('insert into ' . DB_TRASH . ' select NULL,name,content,slug,template,type,edited,user,position,parent,perm,home,display from ' . DB_PAGES . ' where id=' . $id);
query('delete from ' . DB_PAGES . ' where id=' . $id);
cache_clear('DB_PAGES');
function plan_write_journaling($edit, $plandata, $private, $nolinebreaks = FALSE, $writer = FALSE)
{
    include_once 'plan_read.php';
    include_once 'snoop.php';
    include_once 'spiel.php';
    include_once 'send.php';
    $planowner = $writer;
    // make sure all the timecodes are the same
    $time = time();
    // find the character encoding of the plan entry, convert it to something
    // more universal
    mb_detect_order("UTF-8, UTF-8, Windows-1252");
    if (mb_detect_encoding($plandata) == "Windows-1252") {
        $plandata = mb_convert_encoding($plandata, UTF - 8, Windows - 1252);
    }
    // make sure no one can post an update to someone else's plan
    // this will need to be smarter if we ever implement group plans
    // but probably we won't, so no biggie.
    if ($planowner != $_SERVER['USER'] && !user_is_administrator()) {
        $planowner = $_SERVER['USER'];
    }
    $plan_dir = "{$_SERVER['PWUSERS_DIR']}/{$planowner}/plan";
    // Find the old snoops. We have to masquerade briefly as 'cacheuser' to do
    // this without leaving a spurious snitch or getting private entries.
    // We remain 'cacheuser' until after snoop_add() below.
    $_SERVER['USER'] = '******';
    // find old snoops, for later clearing
    $old_snoop_array = snoop_find(plan_read_local($planowner, $_SERVER['USERINFO_ARRAY']['defaultdays'] + 3 . 'd'), $planowner);
    // delete the (now-invalid) cache files
    cache_clear($planowner);
    // leave a reminder to plan_read_local to ignore linebreaks.
    if ($nolinebreaks) {
        $plandata .= "<!--nolinebreaks-->";
    }
    if ($_POST['title']) {
        $plandata .= "<!--title {$_POST['title']} -->";
    }
    if ($_POST['tags']) {
        $plandata .= "<!--tags {$_POST['tags']} -->";
    }
    // if we weren't editing an existing (already-posted) entry, set the filename for the current time.
    if (!$_POST['edit'] || $_POST['edit'] == $_POST['draft_edit']) {
        $_POST['edit'] = ".{$time}";
    }
    $plan_fn = "{$plan_dir}/plan{$_POST['edit']}.txt{$_POST['private']}";
    if (!file_exists($plan_fn)) {
        file_put_contents("{$_SERVER['PWUSERS_DIR']}/{$planowner}/stats/lastupdate", $time);
    }
    if ($_FILES['attached_file']['tmp_name']) {
        rename("{$_FILES['attached_file']['tmp_name']}", "{$_SERVER['USER_ROOT']}/files/{$_FILES['attached_file']['name']}");
        if (strstr($_FILES['attached_file']['name'], 'jpg') || strstr($_FILES['attached_file']['name'], 'gif') || strstr($_FILES['attached_file']['name'], 'png')) {
            $plandata .= "<img src='/userfiles/view/{$writer}/{$_FILES['attached_file']['name']}' />";
        } else {
            $plandata .= "\n<a href='/userfiles/view/{$writer}/{$_FILES['attached_file']['name']}'>{$_FILES['attached_file']['name']}</a>";
        }
    }
    //	else trigger_error("No Files Uploaded");
    $plandata .= $_POST['markdown'];
    $plandata .= $_POST['nofeed'];
    // save old headers and footers.
    if (strstr($plan_fn, 'header') || strstr($plan_fn, 'footer')) {
        exec("mv {$plan_fn} {$plan_fn}.{$time}");
    }
    // write the update to disk.
    file_put_contents($plan_fn, $plandata);
    // new feature: SPIEL
    // here's the part where spiels are found
    // TODO(v4.5): replace spiel syntax with hashtags
    if (!$private && !$edit) {
        spiel_find($plandata, $planowner, $time);
    }
    // here's the part where sends are found
    if (!$private && !$edit) {
        send_find($plandata, $planowner, $time);
    }
    if (file_exists($plan_fn)) {
        if ($private && file_exists("{$plan_dir}/plan{$edit}.txt")) {
            exec("mv {$plan_dir}/plan{$edit}.txt {$plan_dir}/rem.plan{$edit}.txt");
        }
        if (!$private && file_exists("{$plan_dir}/plan{$edit}.txt.p")) {
            exec("mv {$plan_dir}/plan{$edit}.txt.p {$plan_dir}/rem.plan{$edit}.txt.p");
        }
        if ($_POST['draft_edit'] && file_exists("{$plan_dir}/draft{$_POST['draft_edit']}.txt")) {
            unlink("{$plan_dir}/draft{$_POST['draft_edit']}.txt");
        }
        // clean up old drafts
        if ($drafts = files_list("{$plan_dir}/", "draft*.txt")) {
            foreach ($drafts as $draft) {
                if (filemtime("{$plan_dir}/{$draft}") < time() - 7 * 24 * 3600) {
                    unlink("{$plan_dir}/{$draft}");
                }
            }
        }
    }
    @chmod($plan_fn, 0755);
    // clean old snoops and add new ones
    $new_snoop_array = snoop_find(plan_read_local($planowner), $planowner);
    $snoops_to_remove = array_unique(array_diff($old_snoop_array, $new_snoop_array));
    $snoops_to_set = array_unique(array_diff($new_snoop_array, $old_snoop_array));
    $remove_status = snoop_clean($snoops_to_remove, $planowner);
    $add_status = snoop_add($snoops_to_set, $planowner);
    $_SERVER['USER'] = $_SERVER['USERINFO_ARRAY']['username'];
    // done masquerading
    // report the good news if we wrote the post to disk.
    if (file_exists($plan_fn)) {
        if ($_SERVER['AJAX_POST']) {
            return $plandata;
        }
        if (!$_SERVER['BLOGPOST']) {
            if ($_COOKIE[$_SERVER['AUTH_COOKIE']]) {
                if ($_SERVER['AJAX_POST']) {
                    return $plandata;
                } else {
                    redirect("/read/{$planowner}");
                }
            } elseif (user_is_valid($_SERVER['USERINFO_ARRAY']['username'], $_SERVER['USERINFO_ARRAY']['userpass'])) {
                if ($_POST['mailpost']) {
                    echo "posted";
                    exit;
                } else {
                    // If the writer's cookie expired while updating, log her back in.
                    login($_SERVER['USERINFO_ARRAY']['username'], $_SERVER['USERINFO_ARRAY']['userpass'], 0, "/read/{$planowner}");
                    exit;
                }
            }
        } else {
            return ".{$time}";
        }
    } else {
        if ($_SERVER['BLOGPOST']) {
            return FALSE;
        } else {
            output('Error Updating', "<div class='alert'>There was an error writing {$_SERVER['USER']}'s plan entry to {$plan_fn} {$edit}. <a href='{$_SERVER['WEB_ROOT']}/feature'>File a bug</a> so we know about this problem. Here's your plan text for safekeeping:<br /><br />{$plandata}</div>", '', ' had an error');
        }
    }
}
/**
 * make sure ajax script was loaded and user is
 * logged in 
 */
if (!defined('AJAX_LOADED') || !defined('AJAX_VERIFIED')) {
    die;
}
$name = addslashes(@$_POST['name']);
$perms = addslashes(@$_POST['perms']);
/**
 * validate post info 
 */
if (empty($name)) {
    die('error');
}
/**
 * check if group name is used already 
 */
if (num('select name from ' . DB_GROUPS . ' where name="' . $name . '"') != 0) {
    die('error');
}
/**
 * add group to database 
 */
mysql_query('insert into ' . DB_GROUPS . ' values( "", "' . $name . '", "' . $perms . '" )');
$id = mysql_insert_id();
// make group dirs
Group::createGroupDirs($id);
// clear caches
cache_clear('DB_USERS');
die(print $id);
Exemple #26
0
function RemoveJourno($art, $journo_id)
{
    $article_id = $art['id'];
    db_query("DELETE FROM journo_attr WHERE article_id=? AND journo_id=?", $article_id, $journo_id);
    db_commit();
    print "<strong>REMOVED JOURNO</strong>";
    /* TODO: LOG IT! */
    /* make sure the journos page gets updated on next view */
    $cacheid = sprintf("j%s", $journo_id);
    cache_clear($cacheid);
}
        if (!file_exists($newdir)) {
            mkdir($newdir);
        }
        `rm -fr "{$newdir}"/logo-*`;
        move_uploaded_file($_FILES['site_logo']['tmp_name'], $newdir . '/logo.png');
    }
    $pageLengthLimit = $_REQUEST['site_page_length_limit'];
    if (!empty($pageLengthLimit) && is_numeric($pageLengthLimit)) {
        $DBVARS['site_page_length_limit'] = $pageLengthLimit;
    } else {
        if (isset($DBVARS['site_page_length_limit'])) {
            unset($DBVARS['site_page_length_limit']);
        }
    }
    config_rewrite();
    cache_clear();
    echo '<em>options updated</em>';
}
if ($action == 'remove_logo') {
    unlink(USERBASE . '/f/skin_files/logo.png');
}
// }
// { form
echo '<form method="post" action="siteoptions.php?page=general" enctype="mu' . 'ltipart/form-data"><input type="hidden" name="MAX_FILE_SIZE" value="999' . '9999" /><table>';
// { website title and subtitle
echo '<tr><th>Website Title</th><td><input name="site_title" value="' . htmlspecialchars($DBVARS['site_title']) . '" /></td></tr>' . '<tr><th>Website Subtitle</th><td><input name="site_subtitle" value="' . htmlspecialchars($DBVARS['site_subtitle']) . '" /></td></tr>';
// }
// { canonical domain name
$canonical_name = @$DBVARS['canonical_name'] ? ' value="' . htmlspecialchars($DBVARS['canonical_name']) . '"' : '';
echo '<tr><th>Canonical Domain Name</th><td><input name="canonical_name" ' . 'placeholder="leave blank to accept multiple domain names"' . $canonical_name . ' /></td></tr>';
// }
 function Run()
 {
     $summary = $this->content(new Control('div'));
     $run = new Anchor(buildQuery('DocMain', 'Run'), 'Run again');
     $down = new Anchor(buildQuery('DocMain', 'Download'), 'Download');
     $preview = new Anchor(buildQuery('Preview'), 'Preview');
     $this->content('<div style="text-align: center; font-size: 18px; font-weight: bold">');
     $this->content($run->WdfRender() . "&nbsp;&nbsp;" . $down->WdfRender() . "&nbsp;&nbsp;" . $preview->WdfRender());
     $this->content('</div>');
     if (!file_exists(__DIR__ . '/out')) {
         mkdir(__DIR__ . '/out');
     }
     foreach (system_glob_rec(__DIR__ . '/out', '*') as $file) {
         unlink($file);
     }
     cache_clear();
     $path = realpath(__DIR__ . '/../../system/');
     $i = 1;
     global $home, $processed_files;
     $home = array('funcs' => array(), 'classes' => array(), 'methods' => array(), 'tree' => array(), 'interfaces' => array(), 'namespaces' => array());
     $processed_files = array();
     $all_files = system_glob_rec($path, '*.php');
     $cnt_all_files = count($all_files);
     foreach ($all_files as $file) {
         if ($this->skip($file)) {
             $cnt_all_files--;
             continue;
         }
         $title = str_replace($path . '/', '', $file);
         $fn_cls = __DIR__ . '/out/classes_' . str_replace('.php.md', '.md', str_replace('/', '_', $title) . '.md');
         $fn_fnc = __DIR__ . '/out/functions_' . str_replace('.php.md', '.md', str_replace('/', '_', $title) . '.md');
         $this->_startSection("FILE: {$file}");
         $data = $this->process($file);
         if ($i++ > self::MAX_FILES) {
             $this->content("<h1>Stopping, still " . ($cnt_all_files - self::MAX_FILES) . " missing</h1>");
             break;
         }
         // functions
         $lines = array();
         foreach ($data['functions'] as $func) {
             $l = $this->funcToMd($func);
             if ($l) {
                 $home['funcs'][$func['name']] = basename($fn_fnc, '.md') . "#wiki-" . md5($func['name']);
                 $lines[] = $l;
                 //					$processed_files[$title][] = $func['name']; // we do not want functions in the folder tree
             }
         }
         if (count($lines) > 0) {
             file_put_contents($fn_fnc, $this->escapeMd("# Functions in file {$title}\n" . implode("\n", $lines)));
         }
         // classes
         $lines = array();
         foreach ($data['classes'] as $class) {
             //				log_if($class['name']=="uiControl",$class['name'],$class);
             $lines[] = $this->classToMd($class, basename($fn_cls, '.md'));
             if ($class['type'] == 'interface' && !isset($home['interfaces'][$class['type']])) {
                 $home['interfaces'][$class['name']] = array();
             }
             if (isset($class['implements'])) {
                 foreach ($class['implements'] as $int) {
                     if (!isset($home['interfaces'][$int])) {
                         $home['interfaces'][$int] = array($class['name']);
                     } else {
                         $home['interfaces'][$int][] = $class['name'];
                     }
                 }
             }
             $processed_files[$title][] = $class['name'];
         }
         if (count($lines) > 0) {
             file_put_contents($fn_cls, $this->escapeMd("# Classes in file {$title}\n" . implode("\n", $lines)));
         }
     }
     $this->_endSection();
     $this->writeIndexes();
     $this->createLinks();
     $this->writeZip();
     if (array_sum($this->sums) > 0 || count($this->errors) > 0) {
         $summary->addClass('summary');
         $summary->content("<b>Summary:</b><br/>");
         if ($this->sums['comment'] > 0) {
             $summary->content("Missing comments: {$this->sums['comment']}<br/>");
         }
         if ($this->sums['short'] > 0) {
             $summary->content("Missing short descriptions: {$this->sums['short']}<br/>");
         }
         if ($this->sums['long'] > 0) {
             $summary->content("Missing long descriptions: {$this->sums['long']}<br/>");
         }
         if ($this->sums['param'] > 0) {
             $summary->content("Missing param descriptions: {$this->sums['param']}<br/>");
         }
         if ($this->sums['return'] > 0) {
             $summary->content("Missing return value descriptions: {$this->sums['return']}<br/>");
         }
         foreach ($this->errors as $err) {
             $summary->content("{$err}<br/>");
         }
     }
 }
Exemple #29
0
    function DoImport()
    {
        if (true !== JISHIGOU_FOUNDER) {
            $this->Messager("为安全起见,只有网站创始人才能执行数据恢复操作。", null);
        }
        $readerror = 0;
        $datafile = '';
        $from = get_param('from');
        $datafile_server = get_param('datafile_server');
        $datafile_server = dir_safe($datafile_server);
        if (false == preg_match('~^\\.\\/data\\/backup\\/db\\/([\\w\\d\\-\\_]+)\\/\\1(\\-\\d+)?\\.sql$~i', $datafile_server)) {
            $this->Messager("文件名参数传递有误,请返回重试", null);
        }
        $autoimport = get_param('autoimport');
        $supe = get_param('supe');
        $delunzip = get_param('delunzip');
        if ($from == 'server') {
            $datafile = RELATIVE_ROOT_PATH . './' . $datafile_server;
        }
        $dbcharset = $this->DatabaseHandler->Charset;
        if ($datafile && false != ($fp = @fopen($datafile, 'rb'))) {
            $sqldump = fgets($fp, 256);
            $identify = explode(',', base64_decode(preg_replace("/^# Identify:\\s*(\\w+).*/s", "\\1", $sqldump)));
            $dumpinfo = array('method' => $identify[3], 'volume' => intval($identify[4]));
            if ($dumpinfo['method'] == 'multivol') {
                $sqldump .= @fread($fp, filesize($datafile));
            }
            fclose($fp);
        } else {
            if ($autoimport) {
                cache_clear();
                $this->Messager('分卷数据成功导入数据库。', null);
            } else {
                $this->Messager('数据文件不存在: 可能服务器不允许上传文件或尺寸超过限制。', null);
            }
        }
        if ($dumpinfo['method'] == 'multivol') {
            $sqlquery = splitsql($sqldump);
            unset($sqldump);
            $supetablepredot = strpos($supe['tablepre'], '.');
            $supe['dbname'] = $supetablepredot !== FALSE ? substr($supe['tablepre'], 0, $supetablepredot) : '';
            foreach ($sqlquery as $sql) {
                $sql = syntablestruct(trim($sql), $this->DatabaseHandler->GetVersion() > '4.1', $dbcharset);
                if (substr($sql, 0, 11) == 'INSERT INTO') {
                    $sqldbname = substr($sql, 12, 20);
                    $dotpos = strpos($sqldbname, '.');
                    if ($dotpos !== FALSE) {
                        if (empty($supe['dbmode'])) {
                            $sql = 'INSERT INTO `' . $supe['dbname'] . '`.' . substr($sql, 13 + $dotpos);
                        } else {
                        }
                    } else {
                        $sql = 'REPLACE INTO ' . substr($sql, 11);
                    }
                }
                if ($sql != '') {
                    $this->DatabaseHandler->Query($sql, 'SKIP_ERROR');
                    if (($sqlerror = $this->DatabaseHandler->GetLastErrorString()) && $this->DatabaseHandler->GetLastErrorNo() != 1062) {
                        die('MySQL Query Error' . $sql);
                    }
                }
            }
            if ($delunzip) {
                @unlink($datafile_server);
            }
            $datafile_next = preg_replace("/\\-({$dumpinfo['volume']})(\\.sql)\$/i", "-" . ($dumpinfo['volume'] + 1) . "\\2", $datafile_server);
            if ($dumpinfo['volume'] == 1) {
                $to = "admin.php?mod=db&code=doimport&from=server&datafile_server=" . urlencode($datafile_next) . "&autoimport=yes&importsubmit=yes" . (!empty($delunzip) ? '&delunzip=yes' : '');
                $msg = '<form method="post" action="' . $to . '">
					<input type="hidden" name="FORMHASH" value="' . FORMHASH . '"  />
                    <br /><br /><br />分卷数据成功导入数据库,您需要自动导入本次其它的备份吗?<br /><br /><br /><br />
                    <input class="button" type="submit" name="confirmed" value=" 确 定 "> &nbsp;
                    <input class="button" type="button" value=" 取 消 " onClick="history.go(-1);">
                  </form><br />';
                $this->Messager($msg, null);
            } elseif ($autoimport) {
                $this->Messager("数据文件 #{$dumpinfo['volume']} 成功导入,程序将自动继续。", "admin.php?mod=db&code=doimport&from=server&datafile_server=" . urlencode($datafile_next) . "&autoimport=yes&importsubmit=yes" . (!empty($delunzip) ? '&delunzip=yes' : ''));
            } else {
                cache_clear();
                $this->Messager('数据成功导入数据库。', null);
            }
        } else {
            $this->Messager('数据文件非 JishiGou 格式,无法导入。');
        }
    }
Exemple #30
0
 /**
  * @internal SysAdmin cache manager: clear event.
  */
 function CacheClear()
 {
     cache_clear();
     redirect('sysadmin', 'cache');
 }