diff --git a/lib/dao/dao.class.php b/lib/dao/dao.class.php index ad120989d0..20868b6395 100755 --- a/lib/dao/dao.class.php +++ b/lib/dao/dao.class.php @@ -1050,8 +1050,7 @@ class dao $errorCode = $errorInfo[1]; $errorMsg = $errorInfo[2]; $message = $exception->getMessage(); - if(strpos($this->repairCode, "|$errorCode|") !== false or - ($errorCode == '1016' and strpos($errorMsg, 'errno: 145') !== false)) + if(strpos($this->repairCode, "|$errorCode|") !== false or ($errorCode == '1016' and strpos($errorMsg, 'errno: 145') !== false)) { $message .= ' ' . $this->lang->repairTable; } diff --git a/lib/zdb/zdb.class.php b/lib/zdb/zdb.class.php index 54f10aec46..c327420b83 100644 --- a/lib/zdb/zdb.class.php +++ b/lib/zdb/zdb.class.php @@ -83,12 +83,29 @@ class zdb /* Create sql code. */ $backupSql = "DROP TABLE IF EXISTS `$table`;\n"; $backupSql .= $this->getSchemaSQL($table); - $backupSql .= $this->getDataSQL($table); - - /* Write sql code. */ fwrite($fp, $backupSql); + + $rows = $this->dbh->query("select * from `$table`"); + while($row = $rows->fetch(PDO::FETCH_ASSOC)) + { + /* Create key sql for insert. */ + $keys = array_keys($row); + $keys = array_map('addslashes', $keys); + $keys = join('`,`', $keys); + $keys = "`" . $keys . "`"; + + /* Create a value sql. */ + $value = array_values($row); + $value = array_map('addslashes', $value); + $value = join("','", $value); + $value = "'" . $value . "'"; + $sql = "INSERT INTO `$table`($keys) VALUES (" . $value . ");\n"; + + /* Write sql code. */ + fwrite($fp, $sql); + } } - fclose ($fp); + fclose($fp); return $return; } @@ -114,40 +131,4 @@ class zdb $createSql = $this->dbh->query("show create table `$table`")->fetch(PDO::FETCH_ASSOC); return $createSql['Create Table'] . ";\n"; } - - /** - * Get data SQL. - * - * @param string $table - * @access public - * @return string - */ - public function getDataSQL($table) - { - $rows = $this->dbh->query("select * from `$table`")->fetchAll(PDO::FETCH_ASSOC); - $sql = ''; - if(!empty($rows)) - { - /* Create key sql for insert. */ - $keys = array_keys(current($rows)); - $keys = array_map('addslashes', $keys); - $keys = join('`,`', $keys); - $keys = "`" . $keys . "`"; - - /* Create all value sql. */ - $values = array(); - foreach($rows as $row) - { - $value = array_values($row); - $value = array_map('addslashes', $value); - $value = join("','", $value); - $value = "'" . $value . "'"; - - $values[] = "($value)"; - } - - $sql .= "INSERT INTO `$table`($keys) VALUES" . join(',', $values) . ";\n"; - } - return $sql; - } } diff --git a/module/bug/control.php b/module/bug/control.php index 06e2a9df25..3362367200 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -390,7 +390,9 @@ class bug extends control if(is_dir($extractPath)) { $titles = array(); - foreach(glob($extractPath . '/*') as $fileName) + $files = glob($extractPath . '/*'); + sort($files); + foreach($files as $fileName) { $fileName = basename($fileName); $titles[$fileName] = preg_replace('/^\d+_/', '', pathinfo($fileName, PATHINFO_FILENAME)); diff --git a/module/common/lang/en.php b/module/common/lang/en.php index 97e1774c4f..e774453873 100644 --- a/module/common/lang/en.php +++ b/module/common/lang/en.php @@ -62,7 +62,7 @@ $lang->files = 'Files '; $lang->pasteText = 'Paste text'; $lang->uploadImages = 'Upload images '; $lang->timeout = 'Timed out, please check the network, or retry!'; -$lang->repairTable = 'The table may be damaged, you can perform bin/checkdb on the command line to try to repair!'; +$lang->repairTable = 'The table may be damaged, please repair by phpmyadmin or myisamchk!'; $lang->duplicate = '%s has the same title'; $lang->unfold = '+'; $lang->fold = '-'; diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index 09b8df3aca..b695ee2ff3 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -62,7 +62,7 @@ $lang->files = '附件 '; $lang->pasteText = '粘贴文本 '; $lang->uploadImages = '多图上传 '; $lang->timeout = '连接超时,请检查网络环境,或重试!'; -$lang->repairTable = '数据库表可能损坏,需要修复,可以在命令行执行bin目录下的checkdb尝试修复!'; +$lang->repairTable = '数据库表可能损坏,请用phpmyadmin或myisamchk检查修复。'; $lang->duplicate = '已有相同标题的%s'; $lang->unfold = '+'; $lang->fold = '-'; diff --git a/module/file/lang/en.php b/module/file/lang/en.php index 15d762d919..649a9eb74d 100644 --- a/module/file/lang/en.php +++ b/module/file/lang/en.php @@ -28,6 +28,6 @@ $lang->file->errorFileUpload = " Failed to upload files, file size may exceed t $lang->file->errorSuffix = 'Compressed packet format error, can only upload zip!'; $lang->file->errorExtract = 'Decompression failure! The file may have been damaged'; $lang->file->uploadImagesExplain = <<1. Upload file to contain pictures of zip compressed package, the program will take the file name as a title, as content with pictures, generating a record.

-

2. if the file name at the beginning contains 'digital+underline', generation of title will they ignore, for example: '01_test', the title is 'test'.

+

1. Upload file to contain pictures of zip package, the program will take the file name as a title, as content with pictures

+

2. The file name at the beginning contains 'digital+underline', generation of title will they ignore.

EOD; diff --git a/module/file/lang/zh-cn.php b/module/file/lang/zh-cn.php index a967b8931d..42f0db46c8 100644 --- a/module/file/lang/zh-cn.php +++ b/module/file/lang/zh-cn.php @@ -28,6 +28,6 @@ $lang->file->errorFileUpload = " 文件上传失败,文件大小可能超出 $lang->file->errorSuffix = '压缩包格式错误,只能上传zip压缩包!'; $lang->file->errorExtract = '解压缩失败!可能文件已经损坏'; $lang->file->uploadImagesExplain = <<1、上传文件为包含图片的zip压缩包,程序会以文件名作为标题,以图片作为内容,生成一条记录。以方便创建。

-

2、如果文件名开头含有 数字+下划线,生成的标题会将他们忽略,例如:01_测试,生成的标题名是“测试”。

+

1、上传文件为包含图片的zip压缩包,程序会以文件名作为标题,以图片作为内容。

+

2、如果文件名可以开头含有 数字+下划线,以方便排序,程序会将他们忽略。

EOD; diff --git a/module/file/view/buildform.html.php b/module/file/view/buildform.html.php index 489b79caf1..0bff28681d 100644 --- a/module/file/view/buildform.html.php +++ b/module/file/view/buildform.html.php @@ -52,7 +52,11 @@ function checkSize(obj) var sizeType = {'K': 1024, 'M': 1024 * 1024, 'G': 1024 * 1024 * 1024}; var unit = maxUploadInfo.replace(/\d+/, ''); var maxUploadSize = maxUploadInfo.replace(unit,'') * sizeType[unit]; - var fileSize = $(obj)[0].files[0].size; + var fileSize = 0; + $(obj).parents('#fileform').find(':file').each(function() + { + if($(this).val()) fileSize += $(this)[0].files[0].size; + }) if(fileSize > maxUploadSize) alert('file->errorFileSize?>'); } } diff --git a/module/file/view/export.html.php b/module/file/view/export.html.php index 41b0bec6b6..cc319d8254 100644 --- a/module/file/view/export.html.php +++ b/module/file/view/export.html.php @@ -32,7 +32,6 @@ function closeWindow() } function switchEncode(fileType) { - $('#encode').toggleClass('hidden', fileType != 'csv' && fileType != 'xls' && fileType != 'xlsx'); $('#encode').removeAttr('disabled'); if(fileType != 'csv') { diff --git a/module/file/view/printfiles.html.php b/module/file/view/printfiles.html.php index 1158c890de..3396699f25 100644 --- a/module/file/view/printfiles.html.php +++ b/module/file/view/printfiles.html.php @@ -2,7 +2,7 @@ $sessionString = $config->requestType == 'PATH_INFO' ? '?' : '&'; $sessionString .= session_name() . '=' . session_id(); ?> - +