@ -1,201 +0,0 @@ |
||||
Apache License |
||||
Version 2.0, January 2004 |
||||
http://www.apache.org/licenses/ |
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION |
||||
|
||||
1. Definitions. |
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, |
||||
and distribution as defined by Sections 1 through 9 of this document. |
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by |
||||
the copyright owner that is granting the License. |
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all |
||||
other entities that control, are controlled by, or are under common |
||||
control with that entity. For the purposes of this definition, |
||||
"control" means (i) the power, direct or indirect, to cause the |
||||
direction or management of such entity, whether by contract or |
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the |
||||
outstanding shares, or (iii) beneficial ownership of such entity. |
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity |
||||
exercising permissions granted by this License. |
||||
|
||||
"Source" form shall mean the preferred form for making modifications, |
||||
including but not limited to software source code, documentation |
||||
source, and configuration files. |
||||
|
||||
"Object" form shall mean any form resulting from mechanical |
||||
transformation or translation of a Source form, including but |
||||
not limited to compiled object code, generated documentation, |
||||
and conversions to other media types. |
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or |
||||
Object form, made available under the License, as indicated by a |
||||
copyright notice that is included in or attached to the work |
||||
(an example is provided in the Appendix below). |
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object |
||||
form, that is based on (or derived from) the Work and for which the |
||||
editorial revisions, annotations, elaborations, or other modifications |
||||
represent, as a whole, an original work of authorship. For the purposes |
||||
of this License, Derivative Works shall not include works that remain |
||||
separable from, or merely link (or bind by name) to the interfaces of, |
||||
the Work and Derivative Works thereof. |
||||
|
||||
"Contribution" shall mean any work of authorship, including |
||||
the original version of the Work and any modifications or additions |
||||
to that Work or Derivative Works thereof, that is intentionally |
||||
submitted to Licensor for inclusion in the Work by the copyright owner |
||||
or by an individual or Legal Entity authorized to submit on behalf of |
||||
the copyright owner. For the purposes of this definition, "submitted" |
||||
means any form of electronic, verbal, or written communication sent |
||||
to the Licensor or its representatives, including but not limited to |
||||
communication on electronic mailing lists, source code control systems, |
||||
and issue tracking systems that are managed by, or on behalf of, the |
||||
Licensor for the purpose of discussing and improving the Work, but |
||||
excluding communication that is conspicuously marked or otherwise |
||||
designated in writing by the copyright owner as "Not a Contribution." |
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity |
||||
on behalf of whom a Contribution has been received by Licensor and |
||||
subsequently incorporated within the Work. |
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of |
||||
this License, each Contributor hereby grants to You a perpetual, |
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
||||
copyright license to reproduce, prepare Derivative Works of, |
||||
publicly display, publicly perform, sublicense, and distribute the |
||||
Work and such Derivative Works in Source or Object form. |
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of |
||||
this License, each Contributor hereby grants to You a perpetual, |
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
||||
(except as stated in this section) patent license to make, have made, |
||||
use, offer to sell, sell, import, and otherwise transfer the Work, |
||||
where such license applies only to those patent claims licensable |
||||
by such Contributor that are necessarily infringed by their |
||||
Contribution(s) alone or by combination of their Contribution(s) |
||||
with the Work to which such Contribution(s) was submitted. If You |
||||
institute patent litigation against any entity (including a |
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work |
||||
or a Contribution incorporated within the Work constitutes direct |
||||
or contributory patent infringement, then any patent licenses |
||||
granted to You under this License for that Work shall terminate |
||||
as of the date such litigation is filed. |
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the |
||||
Work or Derivative Works thereof in any medium, with or without |
||||
modifications, and in Source or Object form, provided that You |
||||
meet the following conditions: |
||||
|
||||
(a) You must give any other recipients of the Work or |
||||
Derivative Works a copy of this License; and |
||||
|
||||
(b) You must cause any modified files to carry prominent notices |
||||
stating that You changed the files; and |
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works |
||||
that You distribute, all copyright, patent, trademark, and |
||||
attribution notices from the Source form of the Work, |
||||
excluding those notices that do not pertain to any part of |
||||
the Derivative Works; and |
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its |
||||
distribution, then any Derivative Works that You distribute must |
||||
include a readable copy of the attribution notices contained |
||||
within such NOTICE file, excluding those notices that do not |
||||
pertain to any part of the Derivative Works, in at least one |
||||
of the following places: within a NOTICE text file distributed |
||||
as part of the Derivative Works; within the Source form or |
||||
documentation, if provided along with the Derivative Works; or, |
||||
within a display generated by the Derivative Works, if and |
||||
wherever such third-party notices normally appear. The contents |
||||
of the NOTICE file are for informational purposes only and |
||||
do not modify the License. You may add Your own attribution |
||||
notices within Derivative Works that You distribute, alongside |
||||
or as an addendum to the NOTICE text from the Work, provided |
||||
that such additional attribution notices cannot be construed |
||||
as modifying the License. |
||||
|
||||
You may add Your own copyright statement to Your modifications and |
||||
may provide additional or different license terms and conditions |
||||
for use, reproduction, or distribution of Your modifications, or |
||||
for any such Derivative Works as a whole, provided Your use, |
||||
reproduction, and distribution of the Work otherwise complies with |
||||
the conditions stated in this License. |
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, |
||||
any Contribution intentionally submitted for inclusion in the Work |
||||
by You to the Licensor shall be under the terms and conditions of |
||||
this License, without any additional terms or conditions. |
||||
Notwithstanding the above, nothing herein shall supersede or modify |
||||
the terms of any separate license agreement you may have executed |
||||
with Licensor regarding such Contributions. |
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade |
||||
names, trademarks, service marks, or product names of the Licensor, |
||||
except as required for reasonable and customary use in describing the |
||||
origin of the Work and reproducing the content of the NOTICE file. |
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or |
||||
agreed to in writing, Licensor provides the Work (and each |
||||
Contributor provides its Contributions) on an "AS IS" BASIS, |
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
||||
implied, including, without limitation, any warranties or conditions |
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A |
||||
PARTICULAR PURPOSE. You are solely responsible for determining the |
||||
appropriateness of using or redistributing the Work and assume any |
||||
risks associated with Your exercise of permissions under this License. |
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, |
||||
whether in tort (including negligence), contract, or otherwise, |
||||
unless required by applicable law (such as deliberate and grossly |
||||
negligent acts) or agreed to in writing, shall any Contributor be |
||||
liable to You for damages, including any direct, indirect, special, |
||||
incidental, or consequential damages of any character arising as a |
||||
result of this License or out of the use or inability to use the |
||||
Work (including but not limited to damages for loss of goodwill, |
||||
work stoppage, computer failure or malfunction, or any and all |
||||
other commercial damages or losses), even if such Contributor |
||||
has been advised of the possibility of such damages. |
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing |
||||
the Work or Derivative Works thereof, You may choose to offer, |
||||
and charge a fee for, acceptance of support, warranty, indemnity, |
||||
or other liability obligations and/or rights consistent with this |
||||
License. However, in accepting such obligations, You may act only |
||||
on Your own behalf and on Your sole responsibility, not on behalf |
||||
of any other Contributor, and only if You agree to indemnify, |
||||
defend, and hold each Contributor harmless for any liability |
||||
incurred by, or claims asserted against, such Contributor by reason |
||||
of your accepting any such warranty or additional liability. |
||||
|
||||
END OF TERMS AND CONDITIONS |
||||
|
||||
APPENDIX: How to apply the Apache License to your work. |
||||
|
||||
To apply the Apache License to your work, attach the following |
||||
boilerplate notice, with the fields enclosed by brackets "[]" |
||||
replaced with your own identifying information. (Don't include |
||||
the brackets!) The text should be enclosed in the appropriate |
||||
comment syntax for the file format. We also recommend that a |
||||
file or class name and description of purpose be included on the |
||||
same "printed page" as the copyright notice for easier |
||||
identification within third-party archives. |
||||
|
||||
Copyright [yyyy] [name of copyright owner] |
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); |
||||
you may not use this file except in compliance with the License. |
||||
You may obtain a copy of the License at |
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0 |
||||
|
||||
Unless required by applicable law or agreed to in writing, software |
||||
distributed under the License is distributed on an "AS IS" BASIS, |
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
See the License for the specific language governing permissions and |
||||
limitations under the License. |
@ -1,102 +0,0 @@ |
||||
<?php |
||||
include 'common.php'; |
||||
include 'header.php'; |
||||
include 'menu.php'; |
||||
|
||||
$actionUrl = $security->getTokenUrl( |
||||
Typecho_Router::url('do', array('action' => 'backup', 'widget' => 'Backup'), |
||||
Typecho_Common::url('index.php', $options->rootUrl))); |
||||
|
||||
$backupFiles = Typecho_Widget::widget('Widget_Backup')->listFiles(); |
||||
?> |
||||
|
||||
<div class="main"> |
||||
<div class="body container"> |
||||
<?php include 'page-title.php'; ?> |
||||
<div class="row typecho-page-main" role="main"> |
||||
<div class="col-mb-12 col-tb-8"> |
||||
<div id="typecho-welcome"> |
||||
<form action="<?php echo $actionUrl; ?>" method="post">
|
||||
<h3><?php _e('备份您的数据'); ?></h3>
|
||||
<ul> |
||||
<li><?php _e('此备份操作仅包含<strong>内容数据</strong>, 并不会涉及任何<strong>设置信息</strong>'); ?></li>
|
||||
<li><?php _e('如果您的数据量过大, 为了避免操作超时, 建议您直接使用数据库提供的备份工具备份数据'); ?></li>
|
||||
<li><strong class="warning"><?php _e('为了缩小备份文件体积, 建议您在备份前删除不必要的数据'); ?></strong></li>
|
||||
</ul> |
||||
<p><button class="btn primary" type="submit"><?php _e('开始备份 »'); ?></button></p>
|
||||
<input tabindex="1" type="hidden" name="do" value="export"> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
|
||||
<div id="backup-secondary" class="col-mb-12 col-tb-4" role="form"> |
||||
<h3><?php _e('恢复数据'); ?></h3>
|
||||
<ul class="typecho-option-tabs clearfix"> |
||||
<li class="active w-50"><a href="#from-upload">上传</a></li> |
||||
<li class="w-50"><a href="#from-server">从服务器</a></li> |
||||
</ul> |
||||
|
||||
<form action="<?php echo $actionUrl; ?>" id="from-upload" class="tab-content" method="post" enctype="multipart/form-data">
|
||||
<ul class="typecho-option"> |
||||
<li> |
||||
<input tabindex="2" id="backup-upload-file" name="file" type="file" class="file"> |
||||
</li> |
||||
</ul> |
||||
<ul class="typecho-option typecho-option-submit"> |
||||
<li> |
||||
<button tabindex="3" type="submit" class="btn primary"><?php _e('上传并恢复 »'); ?></button>
|
||||
<input type="hidden" name="do" value="import"> |
||||
</li> |
||||
</ul> |
||||
</form> |
||||
|
||||
<form action="<?php echo $actionUrl; ?>" id="from-server" class="tab-content hidden" method="post">
|
||||
<ul class="typecho-option"> |
||||
<li> |
||||
<?php if (empty($backupFiles)): ?> |
||||
<p class="description"><?php _e('将备份文件手动上传至服务器的 %s 目录下后, 这里会出现文件选项', __TYPECHO_BACKUP_DIR__); ?></p>
|
||||
<?php else: ?> |
||||
<label class="typecho-label" for="backup-select-file"><?php _e('选择一个备份文件恢复数据'); ?></label>
|
||||
<select name="file" id="backup-select-file"> |
||||
<?php foreach ($backupFiles as $file): ?> |
||||
<option value="<?php echo $file; ?>"><?php echo $file; ?></option>
|
||||
<?php endforeach; ?> |
||||
</select> |
||||
<?php endif; ?> |
||||
</li> |
||||
</ul> |
||||
<ul class="typecho-option typecho-option-submit"> |
||||
<li> |
||||
<button tabindex="5" type="submit" class="btn primary"><?php _e('选择并恢复 »'); ?></button>
|
||||
<input type="hidden" name="do" value="import"> |
||||
</li> |
||||
</ul> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<?php |
||||
include 'copyright.php'; |
||||
include 'common-js.php'; |
||||
?> |
||||
<script> |
||||
$('#backup-secondary .typecho-option-tabs li').click(function() { |
||||
$('#backup-secondary .typecho-option-tabs li').removeClass('active'); |
||||
$(this).addClass('active'); |
||||
$(this).parents('#backup-secondary').find('.tab-content').addClass('hidden'); |
||||
|
||||
var selected_tab = $(this).find('a').attr('href'); |
||||
$(selected_tab).removeClass('hidden'); |
||||
|
||||
return false; |
||||
}); |
||||
|
||||
$('#backup-secondary form').submit(function (e) { |
||||
if (!confirm('<?php _e('恢复操作将清除所有现有数据, 是否继续?'); ?>')) {
|
||||
return false; |
||||
} |
||||
}); |
||||
</script> |
||||
<?php include 'footer.php'; ?> |
Before Width: | Height: | Size: 847 B After Width: | Height: | Size: 847 B |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
@ -1,64 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Typecho Blog Platform |
||||
* |
||||
* @copyright Copyright (c) 2008 Typecho team (http://www.typecho.org) |
||||
* @license GNU General Public License 2.0 |
||||
* @version $Id$ |
||||
*/ |
||||
|
||||
/** 定义根目录 */ |
||||
define('__TYPECHO_ROOT_DIR__', dirname(__FILE__)); |
||||
|
||||
/** 定义插件目录(相对路径) */ |
||||
define('__TYPECHO_PLUGIN_DIR__', '/usr/plugins'); |
||||
|
||||
/** 定义模板目录(相对路径) */ |
||||
define('__TYPECHO_THEME_DIR__', '/usr/themes'); |
||||
|
||||
/** 后台路径(相对路径) */ |
||||
define('__TYPECHO_ADMIN_DIR__', '/admin/'); |
||||
|
||||
/** 设置包含路径 */ |
||||
@set_include_path(get_include_path() . PATH_SEPARATOR . |
||||
__TYPECHO_ROOT_DIR__ . '/var' . PATH_SEPARATOR . |
||||
__TYPECHO_ROOT_DIR__ . __TYPECHO_PLUGIN_DIR__); |
||||
|
||||
/** 载入API支持 */ |
||||
require_once 'Typecho/Common.php'; |
||||
|
||||
/** 载入Response支持 */ |
||||
require_once 'Typecho/Response.php'; |
||||
|
||||
/** 载入配置支持 */ |
||||
require_once 'Typecho/Config.php'; |
||||
|
||||
/** 载入异常支持 */ |
||||
require_once 'Typecho/Exception.php'; |
||||
|
||||
/** 载入插件支持 */ |
||||
require_once 'Typecho/Plugin.php'; |
||||
|
||||
/** 载入国际化支持 */ |
||||
require_once 'Typecho/I18n.php'; |
||||
|
||||
/** 载入数据库支持 */ |
||||
require_once 'Typecho/Db.php'; |
||||
|
||||
/** 载入路由器支持 */ |
||||
require_once 'Typecho/Router.php'; |
||||
|
||||
/** 程序初始化 */ |
||||
Typecho_Common::init(); |
||||
|
||||
/** 定义数据库参数 */ |
||||
$db = new Typecho_Db('Pdo_Mysql', 'blog_'); |
||||
$db->addServer(array ( |
||||
'host' => '127.0.0.1', |
||||
'user' => 'username', |
||||
'password' => 'password', |
||||
'charset' => 'utf8', |
||||
'port' => '3306', |
||||
'database' => 'databasename', |
||||
), Typecho_Db::READ | Typecho_Db::WRITE); |
||||
Typecho_Db::set($db); |
@ -1 +0,0 @@ |
||||
config.inc.php |
@ -1,201 +0,0 @@ |
||||
Apache License |
||||
Version 2.0, January 2004 |
||||
http://www.apache.org/licenses/ |
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION |
||||
|
||||
1. Definitions. |
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, |
||||
and distribution as defined by Sections 1 through 9 of this document. |
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by |
||||
the copyright owner that is granting the License. |
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all |
||||
other entities that control, are controlled by, or are under common |
||||
control with that entity. For the purposes of this definition, |
||||
"control" means (i) the power, direct or indirect, to cause the |
||||
direction or management of such entity, whether by contract or |
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the |
||||
outstanding shares, or (iii) beneficial ownership of such entity. |
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity |
||||
exercising permissions granted by this License. |
||||
|
||||
"Source" form shall mean the preferred form for making modifications, |
||||
including but not limited to software source code, documentation |
||||
source, and configuration files. |
||||
|
||||
"Object" form shall mean any form resulting from mechanical |
||||
transformation or translation of a Source form, including but |
||||
not limited to compiled object code, generated documentation, |
||||
and conversions to other media types. |
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or |
||||
Object form, made available under the License, as indicated by a |
||||
copyright notice that is included in or attached to the work |
||||
(an example is provided in the Appendix below). |
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object |
||||
form, that is based on (or derived from) the Work and for which the |
||||
editorial revisions, annotations, elaborations, or other modifications |
||||
represent, as a whole, an original work of authorship. For the purposes |
||||
of this License, Derivative Works shall not include works that remain |
||||
separable from, or merely link (or bind by name) to the interfaces of, |
||||
the Work and Derivative Works thereof. |
||||
|
||||
"Contribution" shall mean any work of authorship, including |
||||
the original version of the Work and any modifications or additions |
||||
to that Work or Derivative Works thereof, that is intentionally |
||||
submitted to Licensor for inclusion in the Work by the copyright owner |
||||
or by an individual or Legal Entity authorized to submit on behalf of |
||||
the copyright owner. For the purposes of this definition, "submitted" |
||||
means any form of electronic, verbal, or written communication sent |
||||
to the Licensor or its representatives, including but not limited to |
||||
communication on electronic mailing lists, source code control systems, |
||||
and issue tracking systems that are managed by, or on behalf of, the |
||||
Licensor for the purpose of discussing and improving the Work, but |
||||
excluding communication that is conspicuously marked or otherwise |
||||
designated in writing by the copyright owner as "Not a Contribution." |
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity |
||||
on behalf of whom a Contribution has been received by Licensor and |
||||
subsequently incorporated within the Work. |
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of |
||||
this License, each Contributor hereby grants to You a perpetual, |
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
||||
copyright license to reproduce, prepare Derivative Works of, |
||||
publicly display, publicly perform, sublicense, and distribute the |
||||
Work and such Derivative Works in Source or Object form. |
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of |
||||
this License, each Contributor hereby grants to You a perpetual, |
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
||||
(except as stated in this section) patent license to make, have made, |
||||
use, offer to sell, sell, import, and otherwise transfer the Work, |
||||
where such license applies only to those patent claims licensable |
||||
by such Contributor that are necessarily infringed by their |
||||
Contribution(s) alone or by combination of their Contribution(s) |
||||
with the Work to which such Contribution(s) was submitted. If You |
||||
institute patent litigation against any entity (including a |
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work |
||||
or a Contribution incorporated within the Work constitutes direct |
||||
or contributory patent infringement, then any patent licenses |
||||
granted to You under this License for that Work shall terminate |
||||
as of the date such litigation is filed. |
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the |
||||
Work or Derivative Works thereof in any medium, with or without |
||||
modifications, and in Source or Object form, provided that You |
||||
meet the following conditions: |
||||
|
||||
(a) You must give any other recipients of the Work or |
||||
Derivative Works a copy of this License; and |
||||
|
||||
(b) You must cause any modified files to carry prominent notices |
||||
stating that You changed the files; and |
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works |
||||
that You distribute, all copyright, patent, trademark, and |
||||
attribution notices from the Source form of the Work, |
||||
excluding those notices that do not pertain to any part of |
||||
the Derivative Works; and |
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its |
||||
distribution, then any Derivative Works that You distribute must |
||||
include a readable copy of the attribution notices contained |
||||
within such NOTICE file, excluding those notices that do not |
||||
pertain to any part of the Derivative Works, in at least one |
||||
of the following places: within a NOTICE text file distributed |
||||
as part of the Derivative Works; within the Source form or |
||||
documentation, if provided along with the Derivative Works; or, |
||||
within a display generated by the Derivative Works, if and |
||||
wherever such third-party notices normally appear. The contents |
||||
of the NOTICE file are for informational purposes only and |
||||
do not modify the License. You may add Your own attribution |
||||
notices within Derivative Works that You distribute, alongside |
||||
or as an addendum to the NOTICE text from the Work, provided |
||||
that such additional attribution notices cannot be construed |
||||
as modifying the License. |
||||
|
||||
You may add Your own copyright statement to Your modifications and |
||||
may provide additional or different license terms and conditions |
||||
for use, reproduction, or distribution of Your modifications, or |
||||
for any such Derivative Works as a whole, provided Your use, |
||||
reproduction, and distribution of the Work otherwise complies with |
||||
the conditions stated in this License. |
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, |
||||
any Contribution intentionally submitted for inclusion in the Work |
||||
by You to the Licensor shall be under the terms and conditions of |
||||
this License, without any additional terms or conditions. |
||||
Notwithstanding the above, nothing herein shall supersede or modify |
||||
the terms of any separate license agreement you may have executed |
||||
with Licensor regarding such Contributions. |
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade |
||||
names, trademarks, service marks, or product names of the Licensor, |
||||
except as required for reasonable and customary use in describing the |
||||
origin of the Work and reproducing the content of the NOTICE file. |
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or |
||||
agreed to in writing, Licensor provides the Work (and each |
||||
Contributor provides its Contributions) on an "AS IS" BASIS, |
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
||||
implied, including, without limitation, any warranties or conditions |
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A |
||||
PARTICULAR PURPOSE. You are solely responsible for determining the |
||||
appropriateness of using or redistributing the Work and assume any |
||||
risks associated with Your exercise of permissions under this License. |
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, |
||||
whether in tort (including negligence), contract, or otherwise, |
||||
unless required by applicable law (such as deliberate and grossly |
||||
negligent acts) or agreed to in writing, shall any Contributor be |
||||
liable to You for damages, including any direct, indirect, special, |
||||
incidental, or consequential damages of any character arising as a |
||||
result of this License or out of the use or inability to use the |
||||
Work (including but not limited to damages for loss of goodwill, |
||||
work stoppage, computer failure or malfunction, or any and all |
||||
other commercial damages or losses), even if such Contributor |
||||
has been advised of the possibility of such damages. |
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing |
||||
the Work or Derivative Works thereof, You may choose to offer, |
||||
and charge a fee for, acceptance of support, warranty, indemnity, |
||||
or other liability obligations and/or rights consistent with this |
||||
License. However, in accepting such obligations, You may act only |
||||
on Your own behalf and on Your sole responsibility, not on behalf |
||||
of any other Contributor, and only if You agree to indemnify, |
||||
defend, and hold each Contributor harmless for any liability |
||||
incurred by, or claims asserted against, such Contributor by reason |
||||
of your accepting any such warranty or additional liability. |
||||
|
||||
END OF TERMS AND CONDITIONS |
||||
|
||||
APPENDIX: How to apply the Apache License to your work. |
||||
|
||||
To apply the Apache License to your work, attach the following |
||||
boilerplate notice, with the fields enclosed by brackets "[]" |
||||
replaced with your own identifying information. (Don't include |
||||
the brackets!) The text should be enclosed in the appropriate |
||||
comment syntax for the file format. We also recommend that a |
||||
file or class name and description of purpose be included on the |
||||
same "printed page" as the copyright notice for easier |
||||
identification within third-party archives. |
||||
|
||||
Copyright [yyyy] [name of copyright owner] |
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); |
||||
you may not use this file except in compliance with the License. |
||||
You may obtain a copy of the License at |
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0 |
||||
|
||||
Unless required by applicable law or agreed to in writing, software |
||||
distributed under the License is distributed on an "AS IS" BASIS, |
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
See the License for the specific language governing permissions and |
||||
limitations under the License. |
@ -1 +0,0 @@ |
||||
# ushio-img |
@ -1,102 +0,0 @@ |
||||
<?php |
||||
include 'common.php'; |
||||
include 'header.php'; |
||||
include 'menu.php'; |
||||
|
||||
$actionUrl = $security->getTokenUrl( |
||||
Typecho_Router::url('do', array('action' => 'backup', 'widget' => 'Backup'), |
||||
Typecho_Common::url('index.php', $options->rootUrl))); |
||||
|
||||
$backupFiles = Typecho_Widget::widget('Widget_Backup')->listFiles(); |
||||
?> |
||||
|
||||
<div class="main"> |
||||
<div class="body container"> |
||||
<?php include 'page-title.php'; ?> |
||||
<div class="row typecho-page-main" role="main"> |
||||
<div class="col-mb-12 col-tb-8"> |
||||
<div id="typecho-welcome"> |
||||
<form action="<?php echo $actionUrl; ?>" method="post">
|
||||
<h3><?php _e('备份您的数据'); ?></h3>
|
||||
<ul> |
||||
<li><?php _e('此备份操作仅包含<strong>内容数据</strong>, 并不会涉及任何<strong>设置信息</strong>'); ?></li>
|
||||
<li><?php _e('如果您的数据量过大, 为了避免操作超时, 建议您直接使用数据库提供的备份工具备份数据'); ?></li>
|
||||
<li><strong class="warning"><?php _e('为了缩小备份文件体积, 建议您在备份前删除不必要的数据'); ?></strong></li>
|
||||
</ul> |
||||
<p><button class="btn primary" type="submit"><?php _e('开始备份 »'); ?></button></p>
|
||||
<input tabindex="1" type="hidden" name="do" value="export"> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
|
||||
<div id="backup-secondary" class="col-mb-12 col-tb-4" role="form"> |
||||
<h3><?php _e('恢复数据'); ?></h3>
|
||||
<ul class="typecho-option-tabs clearfix"> |
||||
<li class="active w-50"><a href="#from-upload">上传</a></li> |
||||
<li class="w-50"><a href="#from-server">从服务器</a></li> |
||||
</ul> |
||||
|
||||
<form action="<?php echo $actionUrl; ?>" id="from-upload" class="tab-content" method="post" enctype="multipart/form-data">
|
||||
<ul class="typecho-option"> |
||||
<li> |
||||
<input tabindex="2" id="backup-upload-file" name="file" type="file" class="file"> |
||||
</li> |
||||
</ul> |
||||
<ul class="typecho-option typecho-option-submit"> |
||||
<li> |
||||
<button tabindex="3" type="submit" class="btn primary"><?php _e('上传并恢复 »'); ?></button>
|
||||
<input type="hidden" name="do" value="import"> |
||||
</li> |
||||
</ul> |
||||
</form> |
||||
|
||||
<form action="<?php echo $actionUrl; ?>" id="from-server" class="tab-content hidden" method="post">
|
||||
<ul class="typecho-option"> |
||||
<li> |
||||
<?php if (empty($backupFiles)): ?> |
||||
<p class="description"><?php _e('将备份文件手动上传至服务器的 %s 目录下后, 这里会出现文件选项', __TYPECHO_BACKUP_DIR__); ?></p>
|
||||
<?php else: ?> |
||||
<label class="typecho-label" for="backup-select-file"><?php _e('选择一个备份文件恢复数据'); ?></label>
|
||||
<select name="file" id="backup-select-file"> |
||||
<?php foreach ($backupFiles as $file): ?> |
||||
<option value="<?php echo $file; ?>"><?php echo $file; ?></option>
|
||||
<?php endforeach; ?> |
||||
</select> |
||||
<?php endif; ?> |
||||
</li> |
||||
</ul> |
||||
<ul class="typecho-option typecho-option-submit"> |
||||
<li> |
||||
<button tabindex="5" type="submit" class="btn primary"><?php _e('选择并恢复 »'); ?></button>
|
||||
<input type="hidden" name="do" value="import"> |
||||
</li> |
||||
</ul> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<?php |
||||
include 'copyright.php'; |
||||
include 'common-js.php'; |
||||
?> |
||||
<script> |
||||
$('#backup-secondary .typecho-option-tabs li').click(function() { |
||||
$('#backup-secondary .typecho-option-tabs li').removeClass('active'); |
||||
$(this).addClass('active'); |
||||
$(this).parents('#backup-secondary').find('.tab-content').addClass('hidden'); |
||||
|
||||
var selected_tab = $(this).find('a').attr('href'); |
||||
$(selected_tab).removeClass('hidden'); |
||||
|
||||
return false; |
||||
}); |
||||
|
||||
$('#backup-secondary form').submit(function (e) { |
||||
if (!confirm('<?php _e('恢复操作将清除所有现有数据, 是否继续?'); ?>')) {
|
||||
return false; |
||||
} |
||||
}); |
||||
</script> |
||||
<?php include 'footer.php'; ?> |
@ -1,23 +0,0 @@ |
||||
<?php |
||||
include 'common.php'; |
||||
include 'header.php'; |
||||
include 'menu.php'; |
||||
?> |
||||
|
||||
<div class="main"> |
||||
<div class="body container"> |
||||
<?php include 'page-title.php'; ?> |
||||
<div class="row typecho-page-main" role="form"> |
||||
<div class="col-mb-12 col-tb-6 col-tb-offset-3"> |
||||
<?php Typecho_Widget::widget('Widget_Metas_Category_Edit')->form()->render(); ?> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<?php |
||||
include 'copyright.php'; |
||||
include 'common-js.php'; |
||||
include 'form-js.php'; |
||||
include 'footer.php'; |
||||
?> |
@ -1,105 +0,0 @@ |
||||
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?> |
||||
<script src="<?php $options->adminStaticUrl('js', 'jquery.js?v=' . $suffixVersion); ?>"></script>
|
||||
<script src="<?php $options->adminStaticUrl('js', 'jquery-ui.js?v=' . $suffixVersion); ?>"></script>
|
||||
<script src="<?php $options->adminStaticUrl('js', 'typecho.js?v=' . $suffixVersion); ?>"></script>
|
||||
<script> |
||||
(function () { |
||||
$(document).ready(function() { |
||||
// 处理消息机制 |
||||
(function () { |
||||
var prefix = '<?php echo Typecho_Cookie::getPrefix(); ?>',
|
||||
cookies = { |
||||
notice : $.cookie(prefix + '__typecho_notice'), |
||||
noticeType : $.cookie(prefix + '__typecho_notice_type'), |
||||
highlight : $.cookie(prefix + '__typecho_notice_highlight') |
||||
}, |
||||
path = '<?php echo Typecho_Cookie::getPath(); ?>';
|
||||
|
||||
if (!!cookies.notice && 'success|notice|error'.indexOf(cookies.noticeType) >= 0) { |
||||
var head = $('.typecho-head-nav'), |
||||
p = $('<div class="message popup ' + cookies.noticeType + '">' |
||||
+ '<ul><li>' + $.parseJSON(cookies.notice).join('</li><li>') |
||||
+ '</li></ul></div>'), offset = 0; |
||||
|
||||
if (head.length > 0) { |
||||
p.insertAfter(head); |
||||
offset = head.outerHeight(); |
||||
} else { |
||||
p.prependTo(document.body); |
||||
} |
||||
|
||||
function checkScroll () { |
||||
if ($(window).scrollTop() >= offset) { |
||||
p.css({ |
||||
'position' : 'fixed', |
||||
'top' : 0 |
||||
}); |
||||
} else { |
||||
p.css({ |
||||
'position' : 'absolute', |
||||
'top' : offset |
||||
}); |
||||
} |
||||
} |
||||
|
||||
$(window).scroll(function () { |
||||
checkScroll(); |
||||
}); |
||||
|
||||
checkScroll(); |
||||
|
||||
p.slideDown(function () { |
||||
var t = $(this), color = '#C6D880'; |
||||
|
||||
if (t.hasClass('error')) { |
||||
color = '#FBC2C4'; |
||||
} else if (t.hasClass('notice')) { |
||||
color = '#FFD324'; |
||||
} |
||||
|
||||
t.effect('highlight', {color : color}) |
||||
.delay(5000).fadeOut(function () { |
||||
$(this).remove(); |
||||
}); |
||||
}); |
||||
|
||||
|
||||
$.cookie(prefix + '__typecho_notice', null, {path : path}); |
||||
$.cookie(prefix + '__typecho_notice_type', null, {path : path}); |
||||
} |
||||
|
||||
if (cookies.highlight) { |
||||
$('#' + cookies.highlight).effect('highlight', 1000); |
||||
$.cookie(prefix + '__typecho_notice_highlight', null, {path : path}); |
||||
} |
||||
})(); |
||||
|
||||
|
||||
// 导航菜单 tab 聚焦时展开下拉菜单 |
||||
(function () { |
||||
$('#typecho-nav-list').find('.parent a').focus(function() { |
||||
$('#typecho-nav-list').find('.child').hide(); |
||||
$(this).parents('.root').find('.child').show(); |
||||
}); |
||||
$('.operate').find('a').focus(function() { |
||||
$('#typecho-nav-list').find('.child').hide(); |
||||
}); |
||||
})(); |
||||
|
||||
|
||||
if ($('.typecho-login').length == 0) { |
||||
$('a').each(function () { |
||||
var t = $(this), href = t.attr('href'); |
||||
|
||||
if ((href && href[0] == '#') |
||||
|| /^<?php echo preg_quote($options->adminUrl, '/'); ?>.*$/.exec(href)
|
||||
|| /^<?php echo substr(preg_quote(Typecho_Common::url('s', $options->index), '/'), 0, -1); ?>action\/[_a-zA-Z0-9\/]+.*$/.exec(href)) {
|
||||
return; |
||||
} |
||||
|
||||
t.attr('target', '_blank'); |
||||
}); |
||||
} |
||||
}); |
||||
})(); |
||||
</script> |
@ -1,59 +0,0 @@ |
||||
<?php |
||||
if (!defined('__DIR__')) { |
||||
define('__DIR__', dirname(__FILE__)); |
||||
} |
||||
|
||||
define('__TYPECHO_ADMIN__', true); |
||||
|
||||
/** 载入配置文件 */ |
||||
if (!defined('__TYPECHO_ROOT_DIR__') && !@include_once __DIR__ . '/../config.inc.php') { |
||||
file_exists(__DIR__ . '/../install.php') ? header('Location: ../install.php') : print('Missing Config File'); |
||||
exit; |
||||
} |
||||
|
||||
/** 初始化组件 */ |
||||
Typecho_Widget::widget('Widget_Init'); |
||||
|
||||
/** 注册一个初始化插件 */ |
||||
Typecho_Plugin::factory('admin/common.php')->begin(); |
||||
|
||||
Typecho_Widget::widget('Widget_Options')->to($options); |
||||
Typecho_Widget::widget('Widget_User')->to($user); |
||||
Typecho_Widget::widget('Widget_Security')->to($security); |
||||
Typecho_Widget::widget('Widget_Menu')->to($menu); |
||||
|
||||
/** 初始化上下文 */ |
||||
$request = $options->request; |
||||
$response = $options->response; |
||||
|
||||
/** 检测是否是第一次登录 */ |
||||
$currentMenu = $menu->getCurrentMenu(); |
||||
list($prefixVersion, $suffixVersion) = explode('/', $options->version); |
||||
$params = parse_url($currentMenu[2]); |
||||
$adminFile = basename($params['path']); |
||||
|
||||
if (!$user->logged && !Typecho_Cookie::get('__typecho_first_run') && !empty($currentMenu)) { |
||||
|
||||
if ('welcome.php' != $adminFile) { |
||||
$response->redirect(Typecho_Common::url('welcome.php', $options->adminUrl)); |
||||
} else { |
||||
Typecho_Cookie::set('__typecho_first_run', 1); |
||||
} |
||||
|
||||
} else { |
||||
|
||||
/** 检测版本是否升级 */ |
||||
if ($user->pass('administrator', true) && !empty($currentMenu)) { |
||||
$mustUpgrade = (!defined('Typecho_Common::VERSION') || version_compare(str_replace('/', '.', Typecho_Common::VERSION), |
||||
str_replace('/', '.', $options->version), '>')); |
||||
|
||||
if ($mustUpgrade && 'upgrade.php' != $adminFile && 'backup.php' != $adminFile) { |
||||
$response->redirect(Typecho_Common::url('upgrade.php', $options->adminUrl)); |
||||
} else if (!$mustUpgrade && 'upgrade.php' == $adminFile) { |
||||
$response->redirect($options->adminUrl); |
||||
} else if (!$mustUpgrade && 'welcome.php' == $adminFile && $user->logged) { |
||||
$response->redirect($options->adminUrl); |
||||
} |
||||
} |
||||
|
||||
} |
@ -1,13 +0,0 @@ |
||||
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?> |
||||
<div class="typecho-foot" role="contentinfo"> |
||||
<div class="copyright"> |
||||
<a href="http://typecho.org" class="i-logo-s">Typecho</a> |
||||
<p><?php _e('由 <a href="http://typecho.org">%s</a> 强力驱动, 版本 %s (%s)', $options->software, $prefixVersion, $suffixVersion); ?></p>
|
||||
</div> |
||||
<nav class="resource"> |
||||
<a href="http://docs.typecho.org"><?php _e('帮助文档'); ?></a> •
|
||||
<a href="http://forum.typecho.org"><?php _e('支持论坛'); ?></a> •
|
||||
<a href="https://github.com/typecho/typecho/issues"><?php _e('报告错误'); ?></a> •
|
||||
<a href="http://extends.typecho.org"><?php _e('资源下载'); ?></a>
|
||||
</nav> |
||||
</div> |
@ -1 +0,0 @@ |
||||
/*!normalize.css v2.1.3 | MIT License | git.io/normalize */ article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block;}audio,canvas,video{display:inline-block;}audio:not([controls]){display:none;height:0;}[hidden],template{display:none;}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;}body{margin:0;}a{background:transparent;}a:focus{outline:thin dotted;}a:active,a:hover{outline:0;}h1{font-size:2em;margin:.67em 0;}abbr[title]{border-bottom:1px dotted;}b,strong{font-weight:bold;}dfn{font-style:italic;}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0;}mark{background:#ff0;color:#000;}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em;}pre{white-space:pre-wrap;}q{quotes:"\201C" "\201D" "\2018" "\2019";}small{font-size:80%;}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;}sup{top:-0.5em;}sub{bottom:-0.25em;}img{border:0;}svg:not(:root){overflow:hidden;}figure{margin:0;}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:.35em .625em .75em;}legend{border:0;padding:0;}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0;}button,input{line-height:normal;}button,select{text-transform:none;}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;}button[disabled],html input[disabled]{cursor:default;}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0;}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none;}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;}textarea{overflow:auto;vertical-align:top;}table{border-collapse:collapse;border-spacing:0;} |
@ -1,44 +0,0 @@ |
||||
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?> |
||||
<script> |
||||
$(document).ready(function () { |
||||
// 自定义字段 |
||||
$('#custom-field-expand').click(function() { |
||||
var btn = $('i', this); |
||||
if (btn.hasClass('i-caret-right')) { |
||||
btn.removeClass('i-caret-right').addClass('i-caret-down'); |
||||
} else { |
||||
btn.removeClass('i-caret-down').addClass('i-caret-right'); |
||||
} |
||||
$(this).parent().toggleClass('fold'); |
||||
return false; |
||||
}); |
||||
|
||||
function attachDeleteEvent (el) { |
||||
$('button.btn-xs', el).click(function () { |
||||
if (confirm('<?php _e('确认要删除此字段吗?'); ?>')) {
|
||||
$(this).parents('tr').fadeOut(function () { |
||||
$(this).remove(); |
||||
}); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
$('#custom-field table tbody tr').each(function () { |
||||
attachDeleteEvent(this); |
||||
}); |
||||
|
||||
$('#custom-field button.operate-add').click(function () { |
||||
var html = '<tr><td><input type="text" name="fieldNames[]" placeholder="<?php _e('字段名称'); ?>" class="text-s w-100"></td>'
|
||||
+ '<td><select name="fieldTypes[]" id="">' |
||||
+ '<option value="str"><?php _e('字符'); ?></option>'
|
||||
+ '<option value="int"><?php _e('整数'); ?></option>'
|
||||
+ '<option value="float"><?php _e('小数'); ?></option>'
|
||||
+ '</select></td>' |
||||
+ '<td><textarea name="fieldValues[]" placeholder="<?php _e('字段值'); ?>" class="text-s w-100" rows="2"></textarea></td>'
|
||||
+ '<td><button type="button" class="btn btn-xs"><?php _e('删除'); ?></button></td></tr>',
|
||||
el = $(html).hide().appendTo('#custom-field table tbody').fadeIn(); |
||||
|
||||
attachDeleteEvent(el); |
||||
}); |
||||
}); |
||||
</script> |
@ -1,73 +0,0 @@ |
||||
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?> |
||||
<?php |
||||
$fields = isset($post) ? $post->getFieldItems() : $page->getFieldItems(); |
||||
$defaultFields = isset($post) ? $post->getDefaultFieldItems() : $page->getDefaultFieldItems(); |
||||
?> |
||||
<section id="custom-field" class="typecho-post-option<?php if (empty($defaultFields) && empty($fields)): ?> fold<?php endif; ?>">
|
||||
<label id="custom-field-expand" class="typecho-label"><a href="##"><i class="i-caret-right"></i> <?php _e('自定义字段'); ?></a></label>
|
||||
<table class="typecho-list-table mono"> |
||||
<colgroup> |
||||
<col width="25%"/> |
||||
<col width="10%"/> |
||||
<col width="55%"/> |
||||
<col width="10%"/> |
||||
</colgroup> |
||||
<?php foreach ($defaultFields as $field): ?> |
||||
<?php list ($label, $input) = $field; ?> |
||||
<tr> |
||||
<td><?php $label->render(); ?></td>
|
||||
<td colspan="3"><?php $input->render(); ?></td>
|
||||
</tr> |
||||
<?php endforeach; ?> |
||||
<?php foreach ($fields as $field): ?> |
||||
<tr> |
||||
<td> |
||||
<label for="fieldname" class="sr-only"><?php _e('字段名称'); ?></label>
|
||||
<input type="text" name="fieldNames[]" value="<?php echo htmlspecialchars($field['name']); ?>" id="fieldname" class="text-s w-100">
|
||||
</td> |
||||
<td> |
||||
<label for="fieldtype" class="sr-only"><?php _e('字段类型'); ?></label>
|
||||
<select name="fieldTypes[]" id="fieldtype"> |
||||
<option value="str"<?php if ('str' == $field['type']): ?> selected<?php endif; ?>><?php _e('字符'); ?></option>
|
||||
<option value="int"<?php if ('int' == $field['type']): ?> selected<?php endif; ?>><?php _e('整数'); ?></option>
|
||||
<option value="float"<?php if ('float' == $field['type']): ?> selected<?php endif; ?>><?php _e('小数'); ?></option>
|
||||
</select> |
||||
</td> |
||||
<td> |
||||
<label for="fieldvalue" class="sr-only"><?php _e('字段值'); ?></label>
|
||||
<textarea name="fieldValues[]" id="fieldvalue" class="text-s w-100" rows="2"><?php echo htmlspecialchars($field[$field['type'] . '_value']); ?></textarea>
|
||||
</td> |
||||
<td> |
||||
<button type="button" class="btn btn-xs"><?php _e('删除'); ?></button>
|
||||
</td> |
||||
</tr> |
||||
<?php endforeach; ?> |
||||
<?php if (empty($defaultFields) && empty($fields)): ?> |
||||
<tr> |
||||
<td> |
||||
<label for="fieldname" class="sr-only"><?php _e('字段名称'); ?></label>
|
||||
<input type="text" name="fieldNames[]" placeholder="<?php _e('字段名称'); ?>" id="fieldname" class="text-s w-100">
|
||||
</td> |
||||
<td> |
||||
<label for="fieldtype" class="sr-only"><?php _e('字段类型'); ?></label>
|
||||
<select name="fieldTypes[]" id="fieldtype"> |
||||
<option value="str"><?php _e('字符'); ?></option>
|
||||
<option value="int"><?php _e('整数'); ?></option>
|
||||
<option value="float"><?php _e('小数'); ?></option>
|
||||
</select> |
||||
</td> |
||||
<td> |
||||
<label for="fieldvalue" class="sr-only"><?php _e('字段值'); ?></label>
|
||||
<textarea name="fieldValues[]" placeholder="<?php _e('字段值'); ?>" id="fieldvalue" class="text-s w-100" rows="2"></textarea>
|
||||
</td> |
||||
<td> |
||||
<button type="button" class="btn btn-xs"><?php _e('删除'); ?></button>
|
||||
</td> |
||||
</tr> |
||||
<?php endif; ?> |
||||
</table> |
||||
<div class="description clearfix"> |
||||
<button type="button" class="btn btn-xs operate-add"><?php _e('+添加字段'); ?></button>
|
||||
<?php _e('自定义字段可以扩展你的模板功能, 使用方法参见 <a href="http://docs.typecho.org/help/custom-fields">帮助文档</a>'); ?> |
||||
</div> |
||||
</section> |
@ -1,336 +0,0 @@ |
||||
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?> |
||||
<?php $content = !empty($post) ? $post : $page; if ($options->markdown): ?> |
||||
<script src="<?php $options->adminStaticUrl('js', 'hyperdown.js?v=' . $suffixVersion); ?>"></script>
|
||||
<script src="<?php $options->adminStaticUrl('js', 'pagedown.js?v=' . $suffixVersion); ?>"></script>
|
||||
<script src="<?php $options->adminStaticUrl('js', 'pagedown-extra.js?v=' . $suffixVersion); ?>"></script>
|
||||
<script src="<?php $options->adminStaticUrl('js', 'diff.js?v=' . $suffixVersion); ?>"></script>
|
||||
<script> |
||||
$(document).ready(function () { |
||||
var textarea = $('#text'), |
||||
toolbar = $('<div class="editor" id="wmd-button-bar" />').insertBefore(textarea.parent()), |
||||
preview = $('<div id="wmd-preview" class="wmd-hidetab" />').insertAfter('.editor'); |
||||
|
||||
var options = {}, isMarkdown = <?php echo intval($content->isMarkdown || !$content->have()); ?>;
|
||||
|
||||
options.strings = { |
||||
bold: '<?php _e('加粗'); ?> <strong> Ctrl+B',
|
||||
boldexample: '<?php _e('加粗文字'); ?>',
|
||||
|
||||
italic: '<?php _e('斜体'); ?> <em> Ctrl+I',
|
||||
italicexample: '<?php _e('斜体文字'); ?>',
|
||||
|
||||
link: '<?php _e('链接'); ?> <a> Ctrl+L',
|
||||
linkdescription: '<?php _e('请输入链接描述'); ?>',
|
||||
|
||||
quote: '<?php _e('引用'); ?> <blockquote> Ctrl+Q',
|
||||
quoteexample: '<?php _e('引用文字'); ?>',
|
||||
|
||||
code: '<?php _e('代码'); ?> <pre><code> Ctrl+K',
|
||||
codeexample: '<?php _e('请输入代码'); ?>',
|
||||
|
||||
image: '<?php _e('图片'); ?> <img> Ctrl+G',
|
||||
imagedescription: '<?php _e('请输入图片描述'); ?>',
|
||||
|
||||
olist: '<?php _e('数字列表'); ?> <ol> Ctrl+O',
|
||||
ulist: '<?php _e('普通列表'); ?> <ul> Ctrl+U',
|
||||
litem: '<?php _e('列表项目'); ?>',
|
||||
|
||||
heading: '<?php _e('标题'); ?> <h1>/<h2> Ctrl+H',
|
||||
headingexample: '<?php _e('标题文字'); ?>',
|
||||
|
||||
hr: '<?php _e('分割线'); ?> <hr> Ctrl+R',
|
||||
more: '<?php _e('摘要分割线'); ?> <!--more--> Ctrl+M',
|
||||
|
||||
undo: '<?php _e('撤销'); ?> - Ctrl+Z',
|
||||
redo: '<?php _e('重做'); ?> - Ctrl+Y',
|
||||
redomac: '<?php _e('重做'); ?> - Ctrl+Shift+Z',
|
||||
|
||||
fullscreen: '<?php _e('全屏'); ?> - Ctrl+J',
|
||||
exitFullscreen: '<?php _e('退出全屏'); ?> - Ctrl+E',
|
||||
fullscreenUnsupport: '<?php _e('此浏览器不支持全屏操作'); ?>',
|
||||
|
||||
imagedialog: '<p><b><?php _e('插入图片'); ?></b></p><p><?php _e('请在下方的输入框内输入要插入的远程图片地址'); ?></p><p><?php _e('您也可以使用附件功能插入上传的本地图片'); ?></p>',
|
||||
linkdialog: '<p><b><?php _e('插入链接'); ?></b></p><p><?php _e('请在下方的输入框内输入要插入的链接地址'); ?></p>',
|
||||
|
||||
ok: '<?php _e('确定'); ?>',
|
||||
cancel: '<?php _e('取消'); ?>',
|
||||
|
||||
help: '<?php _e('Markdown语法帮助'); ?>'
|
||||
}; |
||||
|
||||
var converter = new HyperDown(), |
||||
editor = new Markdown.Editor(converter, '', options), |
||||
diffMatch = new diff_match_patch(), last = '', preview = $('#wmd-preview'), |
||||
mark = '@mark' + Math.ceil(Math.random() * 100000000) + '@', |
||||
span = '<span class="diff" />', |
||||
cache = {}; |
||||
|
||||
// 修正白名单 |
||||
converter.enableHtml(true); |
||||
converter.commonWhiteList += '|img|cite|embed|iframe'; |
||||
converter.specialWhiteList = $.extend(converter.specialWhiteList, { |
||||
'ol' : 'ol|li', |
||||
'ul' : 'ul|li', |
||||
'blockquote' : 'blockquote', |
||||
'pre' : 'pre|code' |
||||
}); |
||||
|
||||
converter.hook('beforeParseInline', function (html) { |
||||
return html.replace(/^\s*<!\-\-\s*more\s*\-\->\s*$/, function () { |
||||
return converter.makeHolder('<!--more-->'); |
||||
}); |
||||
}); |
||||
|
||||
// 自动跟随 |
||||
converter.hook('makeHtml', function (html) { |
||||
html = html.replace('<p><!--more--></p>', '<!--more-->'); |
||||
|
||||
if (html.indexOf('<!--more-->') > 0) { |
||||
var parts = html.split(/\s*<\!\-\-more\-\->\s*/), |
||||
summary = parts.shift(), |
||||
details = parts.join(''); |
||||
|
||||
html = '<div class="summary">' + summary + '</div>' |
||||
+ '<div class="details">' + details + '</div>'; |
||||
} |
||||
|
||||
|
||||
var diffs = diffMatch.diff_main(last, html); |
||||
last = html; |
||||
|
||||
if (diffs.length > 0) { |
||||
var stack = [], markStr = mark; |
||||
|
||||
for (var i = 0; i < diffs.length; i ++) { |
||||
var diff = diffs[i], op = diff[0], str = diff[1] |
||||
sp = str.lastIndexOf('<'), ep = str.lastIndexOf('>'); |
||||
|
||||
if (op != 0) { |
||||
if (sp >=0 && sp > ep) { |
||||
if (op > 0) { |
||||
stack.push(str.substring(0, sp) + markStr + str.substring(sp)); |
||||
} else { |
||||
var lastStr = stack[stack.length - 1], lastSp = lastStr.lastIndexOf('<'); |
||||
stack[stack.length - 1] = lastStr.substring(0, lastSp) + markStr + lastStr.substring(lastSp); |
||||
} |
||||
} else { |
||||
if (op > 0) { |
||||
stack.push(str + markStr); |
||||
} else { |
||||
stack.push(markStr); |
||||
} |
||||
} |
||||
|
||||
markStr = ''; |
||||
} else { |
||||
stack.push(str); |
||||
} |
||||
} |
||||
|
||||
html = stack.join(''); |
||||
|
||||
if (!markStr) { |
||||
var pos = html.indexOf(mark), prev = html.substring(0, pos), |
||||
next = html.substr(pos + mark.length), |
||||
sp = prev.lastIndexOf('<'), ep = prev.lastIndexOf('>'); |
||||
|
||||
if (sp >= 0 && sp > ep) { |
||||
html = prev.substring(0, sp) + span + prev.substring(sp) + next; |
||||
} else { |
||||
html = prev + span + next; |
||||
} |
||||
} |
||||
} |
||||
|
||||
// 替换img |
||||
html = html.replace(/<(img)\s+([^>]*)\s*src="([^"]+)"([^>]*)>/ig, function (all, tag, prefix, src, suffix) { |
||||
if (!cache[src]) { |
||||
cache[src] = false; |
||||
} else { |
||||
return '<span class="cache" data-width="' + cache[src][0] + '" data-height="' + cache[src][1] + '" ' |
||||
+ 'style="background:url(' + src + ') no-repeat left top; width:' |
||||
+ cache[src][0] + 'px; height:' + cache[src][1] + 'px; display: inline-block; max-width: 100%;' |
||||
+ '-webkit-background-size: contain;-moz-background-size: contain;-o-background-size: contain;background-size: contain;" />'; |
||||
} |
||||
|
||||
return all; |
||||
}); |
||||
|
||||
// 替换block |
||||
html = html.replace(/<(iframe|embed)\s+([^>]*)>/ig, function (all, tag, src) { |
||||
if (src[src.length - 1] == '/') { |
||||
src = src.substring(0, src.length - 1); |
||||
} |
||||
|
||||
return '<div style="background: #ddd; height: 40px; overflow: hidden; line-height: 40px; text-align: center; font-size: 12px; color: #777">' |
||||
+ tag + ' : ' + $.trim(src) + '</div>'; |
||||
}); |
||||
|
||||
return html; |
||||
}); |
||||
|
||||
function cacheResize() { |
||||
var t = $(this), w = parseInt(t.data('width')), h = parseInt(t.data('height')), |
||||
ow = t.width(); |
||||
|
||||
t.height(h * ow / w); |
||||
} |
||||
|
||||
var to; |
||||
editor.hooks.chain('onPreviewRefresh', function () { |
||||
var diff = $('.diff', preview), scrolled = false; |
||||
|
||||
if (to) { |
||||
clearTimeout(to); |
||||
} |
||||
|
||||
$('img', preview).load(function () { |
||||
var t = $(this), src = t.attr('src'); |
||||
|
||||
if (scrolled) { |
||||
preview.scrollTo(diff, { |
||||
offset : - 50 |
||||
}); |
||||
} |
||||
|
||||
if (!!src && !cache[src]) { |
||||
cache[src] = [this.width, this.height]; |
||||
} |
||||
}); |
||||
|
||||
$('.cache', preview).resize(cacheResize).each(cacheResize); |
||||
|
||||
var changed = $('.diff', preview).parent(); |
||||
if (!changed.is(preview)) { |
||||
changed.css('background-color', 'rgba(255,230,0,0.5)'); |
||||
to = setTimeout(function () { |
||||
changed.css('background-color', 'transparent'); |
||||
}, 4500); |
||||
} |
||||
|
||||
if (diff.length > 0) { |
||||
var p = diff.position(), lh = diff.parent().css('line-height'); |
||||
lh = !!lh ? parseInt(lh) : 0; |
||||
|
||||
if (p.top < 0 || p.top > preview.height() - lh) { |
||||
preview.scrollTo(diff, { |
||||
offset : - 50 |
||||
}); |
||||
scrolled = true; |
||||
} |
||||
} |
||||
}); |
||||
|
||||
<?php Typecho_Plugin::factory('admin/editor-js.php')->markdownEditor($content); ?> |
||||
|
||||
var input = $('#text'), th = textarea.height(), ph = preview.height(), |
||||
uploadBtn = $('<button type="button" id="btn-fullscreen-upload" class="btn btn-link">' |
||||
+ '<i class="i-upload"><?php _e('附件'); ?></i></button>')
|
||||
.prependTo('.submit .right') |
||||
.click(function() { |
||||
$('a', $('.typecho-option-tabs li').not('.active')).trigger('click'); |
||||
return false; |
||||
}); |
||||
|
||||
$('.typecho-option-tabs li').click(function () { |
||||
uploadBtn.find('i').toggleClass('i-upload-active', |
||||
$('#tab-files-btn', this).length > 0); |
||||
}); |
||||
|
||||
editor.hooks.chain('enterFakeFullScreen', function () { |
||||
th = textarea.height(); |
||||
ph = preview.height(); |
||||
$(document.body).addClass('fullscreen'); |
||||
var h = $(window).height() - toolbar.outerHeight(); |
||||
|
||||
textarea.css('height', h); |
||||
preview.css('height', h); |
||||
}); |
||||
|
||||
editor.hooks.chain('enterFullScreen', function () { |
||||
$(document.body).addClass('fullscreen'); |
||||
|
||||
var h = window.screen.height - toolbar.outerHeight(); |
||||
textarea.css('height', h); |
||||
preview.css('height', h); |
||||
}); |
||||
|
||||
editor.hooks.chain('exitFullScreen', function () { |
||||
$(document.body).removeClass('fullscreen'); |
||||
textarea.height(th); |
||||
preview.height(ph); |
||||
}); |
||||
|
||||
function initMarkdown() { |
||||
editor.run(); |
||||
|
||||
var imageButton = $('#wmd-image-button'), |
||||
linkButton = $('#wmd-link-button'); |
||||
|
||||
Typecho.insertFileToEditor = function (file, url, isImage) { |
||||
var button = isImage ? imageButton : linkButton; |
||||
|
||||
options.strings[isImage ? 'imagename' : 'linkname'] = file; |
||||
button.trigger('click'); |
||||
|
||||
var checkDialog = setInterval(function () { |
||||
if ($('.wmd-prompt-dialog').length > 0) { |
||||
$('.wmd-prompt-dialog input').val(url).select(); |
||||
clearInterval(checkDialog); |
||||
checkDialog = null; |
||||
} |
||||
}, 10); |
||||
}; |
||||
|
||||
Typecho.uploadComplete = function (file) { |
||||
Typecho.insertFileToEditor(file.title, file.url, file.isImage); |
||||
}; |
||||
|
||||
// 编辑预览切换 |
||||
var edittab = $('.editor').prepend('<div class="wmd-edittab"><a href="#wmd-editarea" class="active"><?php _e('撰写'); ?></a><a href="#wmd-preview"><?php _e('预览'); ?></a></div>'),
|
||||
editarea = $(textarea.parent()).attr("id", "wmd-editarea"); |
||||
|
||||
$(".wmd-edittab a").click(function() { |
||||
$(".wmd-edittab a").removeClass('active'); |
||||
$(this).addClass("active"); |
||||
$("#wmd-editarea, #wmd-preview").addClass("wmd-hidetab"); |
||||
|
||||
var selected_tab = $(this).attr("href"), |
||||
selected_el = $(selected_tab).removeClass("wmd-hidetab"); |
||||
|
||||
// 预览时隐藏编辑器按钮 |
||||
if (selected_tab == "#wmd-preview") { |
||||
$("#wmd-button-row").addClass("wmd-visualhide"); |
||||
} else { |
||||
$("#wmd-button-row").removeClass("wmd-visualhide"); |
||||
} |
||||
|
||||
// 预览和编辑窗口高度一致 |
||||
$("#wmd-preview").outerHeight($("#wmd-editarea").innerHeight()); |
||||
|
||||
return false; |
||||
}); |
||||
} |
||||
|
||||
if (isMarkdown) { |
||||
initMarkdown(); |
||||
} else { |
||||
var notice = $('<div class="message notice"><?php _e('这篇文章不是由Markdown语法创建的, 继续使用Markdown编辑它吗?'); ?> '
|
||||
+ '<button class="btn btn-xs primary yes"><?php _e('是'); ?></button> '
|
||||
+ '<button class="btn btn-xs no"><?php _e('否'); ?></button></div>')
|
||||
.hide().insertBefore(textarea).slideDown(); |
||||
|
||||
$('.yes', notice).click(function () { |
||||
notice.remove(); |
||||
$('<input type="hidden" name="markdown" value="1" />').appendTo('.submit'); |
||||
initMarkdown(); |
||||
}); |
||||
|
||||
$('.no', notice).click(function () { |
||||
notice.remove(); |
||||
}); |
||||
} |
||||
}); |
||||
</script> |
||||
<?php endif; ?> |
||||
|
@ -1,13 +0,0 @@ |
||||
<?php |
||||
include 'common.php'; |
||||
|
||||
$panel = $request->get('panel'); |
||||
$panelTable = unserialize($options->panelTable); |
||||
|
||||
if (!isset($panelTable['file']) || !in_array(urlencode($panel), $panelTable['file'])) { |
||||
throw new Typecho_Plugin_Exception(_t('页面不存在'), 404); |
||||
} |
||||
|
||||
list ($pluginName, $file) = explode('/', trim($panel, '/'), 2); |
||||
|
||||
require_once $options->pluginDir($pluginName) . '/' . $panel; |
@ -1,212 +0,0 @@ |
||||
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?> |
||||
<?php |
||||
if (isset($post) && $post instanceof Typecho_Widget && $post->have()) { |
||||
$fileParentContent = $post; |
||||
} else if (isset($page) && $page instanceof Typecho_Widget && $page->have()) { |
||||
$fileParentContent = $page; |
||||
} |
||||
|
||||
$phpMaxFilesize = function_exists('ini_get') ? trim(ini_get('upload_max_filesize')) : 0; |
||||
|
||||
if (preg_match("/^([0-9]+)([a-z]{1,2})$/i", $phpMaxFilesize, $matches)) { |
||||
$phpMaxFilesize = strtolower($matches[1] . $matches[2] . (1 == strlen($matches[2]) ? 'b' : '')); |
||||
} |
||||
?> |
||||
|
||||
<script src="<?php $options->adminStaticUrl('js', 'moxie.js?v=' . $suffixVersion); ?>"></script>
|
||||
<script src="<?php $options->adminStaticUrl('js', 'plupload.js?v=' . $suffixVersion); ?>"></script>
|
||||
<script> |
||||
$(document).ready(function() { |
||||
function updateAttacmentNumber () { |
||||
var btn = $('#tab-files-btn'), |
||||
balloon = $('.balloon', btn), |
||||
count = $('#file-list li .insert').length; |
||||
|
||||
if (count > 0) { |
||||
if (!balloon.length) { |
||||
btn.html($.trim(btn.html()) + ' '); |
||||
balloon = $('<span class="balloon"></span>').appendTo(btn); |
||||
} |
||||
|
||||
balloon.html(count); |
||||
} else if (0 == count && balloon.length > 0) { |
||||
balloon.remove(); |
||||
} |
||||
} |
||||
|
||||
$('.upload-area').bind({ |
||||
dragenter : function () { |
||||
$(this).parent().addClass('drag'); |
||||
}, |
||||
|
||||
dragover : function (e) { |
||||
$(this).parent().addClass('drag'); |
||||
}, |
||||
|
||||
drop : function () { |
||||
$(this).parent().removeClass('drag'); |
||||
}, |
||||
|
||||
dragend : function () { |
||||
$(this).parent().removeClass('drag'); |
||||
}, |
||||
|
||||
dragleave : function () { |
||||
$(this).parent().removeClass('drag'); |
||||
} |
||||
}); |
||||
|
||||
updateAttacmentNumber(); |
||||
|
||||
function fileUploadStart (file) { |
||||
$('<li id="' + file.id + '" class="loading">' |
||||
+ file.name + '</li>').appendTo('#file-list'); |
||||
} |
||||
|
||||
function fileUploadError (error) { |
||||
var file = error.file, code = error.code, word; |
||||
|
||||
switch (code) { |
||||
case plupload.FILE_SIZE_ERROR: |
||||
word = '<?php _e('文件大小超过限制'); ?>';
|
||||
break; |
||||
case plupload.FILE_EXTENSION_ERROR: |
||||
word = '<?php _e('文件扩展名不被支持'); ?>';
|
||||
break; |
||||
case plupload.FILE_DUPLICATE_ERROR: |
||||
word = '<?php _e('文件已经上传过'); ?>';
|
||||
break; |
||||
case plupload.HTTP_ERROR: |
||||
default: |
||||
word = '<?php _e('上传出现错误'); ?>';
|
||||
break; |
||||
} |
||||
|
||||
var fileError = '<?php _e('%s 上传失败'); ?>'.replace('%s', file.name),
|
||||
li, exist = $('#' + file.id); |
||||
|
||||
if (exist.length > 0) { |
||||
li = exist.removeClass('loading').html(fileError); |
||||
} else { |
||||
li = $('<li>' + fileError + '<br />' + word + '</li>').appendTo('#file-list'); |
||||
} |
||||
|
||||
li.effect('highlight', {color : '#FBC2C4'}, 2000, function () { |
||||
$(this).remove(); |
||||
}); |
||||
|
||||
// fix issue #341 |
||||
this.removeFile(file); |
||||
} |
||||
|
||||
var completeFile = null; |
||||
function fileUploadComplete (id, url, data) { |
||||
var li = $('#' + id).removeClass('loading').data('cid', data.cid) |
||||
.data('url', data.url) |
||||
.data('image', data.isImage) |
||||
.html('<input type="hidden" name="attachment[]" value="' + data.cid + '" />' |
||||
+ '<a class="insert" target="_blank" href="###" title="<?php _e('点击插入文件'); ?>">' + data.title + '</a><div class="info">' + data.bytes
|
||||
+ ' <a class="file" target="_blank" href="<?php $options->adminUrl('media.php'); ?>?cid='
|
||||
+ data.cid + '" title="<?php _e('编辑'); ?>"><i class="i-edit"></i></a>'
|
||||
+ ' <a class="delete" href="###" title="<?php _e('删除'); ?>"><i class="i-delete"></i></a></div>')
|
||||
.effect('highlight', 1000); |
||||
|
||||
attachInsertEvent(li); |
||||
attachDeleteEvent(li); |
||||
updateAttacmentNumber(); |
||||
|
||||
if (!completeFile) { |
||||
completeFile = data; |
||||
} |
||||
} |
||||
|
||||
$('#tab-files').bind('init', function () { |
||||
var uploader = new plupload.Uploader({ |
||||
browse_button : $('.upload-file').get(0), |
||||
url : '<?php $security->index('/action/upload' |
||||
. (isset($fileParentContent) ? '?cid=' . $fileParentContent->cid : '')); ?>', |
||||
runtimes : 'html5,flash,html4', |
||||
flash_swf_url : '<?php $options->adminStaticUrl('js', 'Moxie.swf'); ?>',
|
||||
drop_element : $('.upload-area').get(0), |
||||
filters : { |
||||
max_file_size : '<?php echo $phpMaxFilesize ?>',
|
||||
mime_types : [{'title' : '<?php _e('允许上传的文件'); ?>', 'extensions' : '<?php echo implode(',', $options->allowedAttachmentTypes); ?>'}],
|
||||
prevent_duplicates : true |
||||
}, |
||||
|
||||
init : { |
||||
FilesAdded : function (up, files) { |
||||
for (var i = 0; i < files.length; i ++) { |
||||
fileUploadStart(files[i]); |
||||
} |
||||
|
||||
completeFile = null; |
||||
uploader.start(); |
||||
}, |
||||
|
||||
UploadComplete : function () { |
||||
if (completeFile) { |
||||
Typecho.uploadComplete(completeFile); |
||||
} |
||||
}, |
||||
|
||||
FileUploaded : function (up, file, result) { |
||||
if (200 == result.status) { |
||||
var data = $.parseJSON(result.response); |
||||
|
||||
if (data) { |
||||
fileUploadComplete(file.id, data[0], data[1]); |
||||
uploader.removeFile(file); |
||||
return; |
||||
} |
||||
} |
||||
|
||||
fileUploadError.call(uploader, { |
||||
code : plupload.HTTP_ERROR, |
||||
file : file |
||||
}); |
||||
}, |
||||
|
||||
Error : function (up, error) { |
||||
fileUploadError.call(uploader, error); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
uploader.init(); |
||||
}); |
||||
|
||||
function attachInsertEvent (el) { |
||||
$('.insert', el).click(function () { |
||||
var t = $(this), p = t.parents('li'); |
||||
Typecho.insertFileToEditor(t.text(), p.data('url'), p.data('image')); |
||||
return false; |
||||
}); |
||||
} |
||||
|
||||
function attachDeleteEvent (el) { |
||||
var file = $('a.insert', el).text(); |
||||
$('.delete', el).click(function () { |
||||
if (confirm('<?php _e('确认要删除文件 %s 吗?'); ?>'.replace('%s', file))) {
|
||||
var cid = $(this).parents('li').data('cid'); |
||||
$.post('<?php $security->index('/action/contents-attachment-edit'); ?>',
|
||||
{'do' : 'delete', 'cid' : cid}, |
||||
function () { |
||||
$(el).fadeOut(function () { |
||||
$(this).remove(); |
||||
updateAttacmentNumber(); |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
return false; |
||||
}); |
||||
} |
||||
|
||||
$('#file-list li').each(function () { |
||||
attachInsertEvent(this); |
||||
attachDeleteEvent(this); |
||||
}); |
||||
}); |
||||
</script> |
||||
|