Merge branch 'master' of https://github.com/easysoft/zentaopms
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
+21
-40
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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 = '-';
|
||||
|
||||
@@ -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 = '-';
|
||||
|
||||
@@ -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 = <<<EOD
|
||||
<p>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.</p>
|
||||
<p>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'.</p>
|
||||
<p>1. Upload file to contain pictures of zip package, the program will take the file name as a title, as content with pictures</p>
|
||||
<p>2. The file name at the beginning contains 'digital+underline', generation of title will they ignore.</p>
|
||||
EOD;
|
||||
|
||||
@@ -28,6 +28,6 @@ $lang->file->errorFileUpload = " 文件上传失败,文件大小可能超出
|
||||
$lang->file->errorSuffix = '压缩包格式错误,只能上传zip压缩包!';
|
||||
$lang->file->errorExtract = '解压缩失败!可能文件已经损坏';
|
||||
$lang->file->uploadImagesExplain = <<<EOD
|
||||
<p>1、上传文件为包含图片的zip压缩包,程序会以文件名作为标题,以图片作为内容,生成一条记录。以方便创建。</p>
|
||||
<p>2、如果文件名开头含有 数字+下划线,生成的标题会将他们忽略,例如:01_测试,生成的标题名是“测试”。</p>
|
||||
<p>1、上传文件为包含图片的zip压缩包,程序会以文件名作为标题,以图片作为内容。</p>
|
||||
<p>2、如果文件名可以开头含有 数字+下划线,以方便排序,程序会将他们忽略。</p>
|
||||
EOD;
|
||||
|
||||
@@ -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('<?php echo $lang->file->errorFileSize?>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ function closeWindow()
|
||||
}
|
||||
function switchEncode(fileType)
|
||||
{
|
||||
$('#encode').toggleClass('hidden', fileType != 'csv' && fileType != 'xls' && fileType != 'xlsx');
|
||||
$('#encode').removeAttr('disabled');
|
||||
if(fileType != 'csv')
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
$sessionString = $config->requestType == 'PATH_INFO' ? '?' : '&';
|
||||
$sessionString .= session_name() . '=' . session_id();
|
||||
?>
|
||||
<style> .files-list {margin: 0; max-width: 400px;} .files-list > .list-group-item {padding-right: 5px;} .files-list > .list-group-item a {color: #666} .files-list > .list-group-item:hover a {color: #333} .files-list > .list-group-item > .pull-right {opacity: 0.2; transition: all 0.3s;} .files-list > .list-group-item:hover > .pull-right {opacity: 1}</style>
|
||||
<style> .files-list {margin: 0;} .files-list > .list-group-item {padding: 5px; border:0px;} .files-list > .list-group-item a {color: #666} .files-list > .list-group-item:hover a {color: #333} .files-list > .list-group-item > .right-icon {opacity: 0.01; transition: all 0.3s;} .files-list > .list-group-item:hover > .right-icon {opacity: 1}</style>
|
||||
<script language='Javascript'>
|
||||
$(function(){
|
||||
$(".edit").modalTrigger({width:350, type:'iframe'});
|
||||
@@ -35,11 +35,11 @@ function downloadFile(fileID)
|
||||
if(common::hasPriv('file', 'download'))
|
||||
{
|
||||
echo "<li class='list-group-item'><i class='icon-file-text text-muted icon'></i> ";
|
||||
echo "<span class='pull-right'>";
|
||||
echo '<strong>' . html::a($this->createLink('file', 'download', "fileID=$file->id") . $sessionString, $file->title .'.' . $file->extension, '_blank', "onclick='return downloadFile($file->id)'") . '</strong>';
|
||||
echo "<span class='right-icon'>";
|
||||
common::printLink('file', 'edit', "fileID=$file->id", "<i class='icon-pencil'></i>", '', "class='edit btn-icon' title='{$lang->file->edit}'");
|
||||
if(common::hasPriv('file', 'delete')) echo html::a('###', "<i class='icon-remove'></i>", '', "class='btn-icon' onclick='deleteFile($file->id)' title='$lang->delete'");
|
||||
echo '</span>';
|
||||
echo '<strong>' . html::a($this->createLink('file', 'download', "fileID=$file->id") . $sessionString, $file->title .'.' . $file->extension, '_blank', "onclick='return downloadFile($file->id)'") . '</strong>';
|
||||
echo '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ $(function()
|
||||
if(browseType == 'bysearch') ajaxGetSearchForm();
|
||||
|
||||
|
||||
$('.assign-menu').click(function(e)
|
||||
$('.assign-search').click(function(e)
|
||||
{
|
||||
e.stopPropagation();
|
||||
return false;
|
||||
|
||||
@@ -221,6 +221,7 @@ class searchModel extends model
|
||||
{
|
||||
$query = $this->dao->findByID($queryID)->from(TABLE_USERQUERY)->fetch();
|
||||
if(!$query) return false;
|
||||
|
||||
/* Decode html encode. */
|
||||
$query->form = htmlspecialchars_decode($query->form, ENT_QUOTES);
|
||||
$query->sql = htmlspecialchars_decode($query->sql, ENT_QUOTES);
|
||||
@@ -247,7 +248,6 @@ class searchModel extends model
|
||||
->add('account', $this->app->user->account)
|
||||
->add('form', serialize($this->session->$formVar))
|
||||
->add('sql', $sql)
|
||||
->skipSpecial('form,sql')
|
||||
->get();
|
||||
$this->dao->insert(TABLE_USERQUERY)->data($query)->autoCheck()->check('title', 'notempty')->exec();
|
||||
}
|
||||
|
||||
@@ -229,7 +229,9 @@ class story 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));
|
||||
|
||||
@@ -24,6 +24,7 @@ EOT;
|
||||
|
||||
|
||||
|
||||
|
||||
$lang->upgrade->setStatusFile = "<p>For security reason, we will check file <strong>%s</strong><br />
|
||||
But this file doesn't exist or out of date. You can use the flowing command to create(update)it <br />
|
||||
For linux:<strong>touch %s;</strong> <br />
|
||||
|
||||
@@ -16,13 +16,14 @@ $lang->upgrade->success = '升级成功';
|
||||
$lang->upgrade->tohome = '返回首页';
|
||||
$lang->upgrade->warnning= '警告';
|
||||
$lang->upgrade->warnningContent = <<<EOT
|
||||
警告!升级有危险,请先备份数据库,以防万一。<br />
|
||||
备份方法:<br />
|
||||
1. 可以通过phpMyAdmin进行备份。<br />
|
||||
2. 使用mysql命令行的工具。<br />
|
||||
# mysqldump -u <span class='text-danger'>username</span> -p <span class='text-danger'>dbname</span> > <span class='text-danger'>filename</span> <br />
|
||||
要将上面红色的部分分别替换成对应的用户名和禅道系统的数据库名。<br />
|
||||
<p>升级有危险,请先备份数据库,以防万一。</p>
|
||||
<pre>
|
||||
1. 可以通过phpMyAdmin进行备份。
|
||||
2. 使用mysql命令行的工具。
|
||||
$> mysqldump -u <span class='text-danger'>username</span> -p <span class='text-danger'>dbname</span> > <span class='text-danger'>filename</span>
|
||||
要将上面红色的部分分别替换成对应的用户名和禅道系统的数据库名。
|
||||
比如: mysqldump -u root -p zentao >zentao.bak
|
||||
</pre>
|
||||
EOT;
|
||||
$lang->upgrade->setStatusFile = '<h4>升级之前请先执行下面的命令:</h4>
|
||||
<ul>
|
||||
|
||||
Reference in New Issue
Block a user