[wordpress插件] dbfile数据库文件

wordpress 插件 文章 2020-04-13 10:20 616 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

History

历史

- 2005-10-19: * added the possibility to hide dbfiles list in a post, by setting the custom field hideDbFiles to true              

 -2005-10-19:*通过将自定义字段hideDbFiles设置为true添加了隐藏帖子中的dbfiles列表的可能性              

* $wpURL is now replaced in dbfile.inc and dbfile.php with get_options('siteurl')              

* $ wpURL现在已在dbfile.inc和dbfile.php中替换为get_options('siteurl')              

* the post(s) of a file is now shown (with link) in "Manage Database Files"              

*文件的帖子现在显示在“管理数据库文件”中(带有链接)              

* install now requires user level 10.              

*现在安装需要用户级别10。              

* install now checks if the post2file table exists before creation              

*现在安装,创建前检查post2file表是否存在              

* install now checks if ALTER TABLE or CREATE TABLE should be used on files and post2file tables.

*现在安装,检查是否应在文件和post2file表上使用ALTER TABLE或CREATE TABLE。

- 2005-10-18: * a file can now be fetched using only the name.

-2005-10-18:*现在仅可以使用名称来提取文件。

If more than one file exists with the same name, the first encountered is returned.

如果存在多个同名文件,则返回第一个遇到的文件。

- 2005-10-13: * renamed all options from db_file* to dbfile_*              

-2005-10-13:*将所有选项从db_file *重命名为dbfile_ *              

* renamed db_post2file_table to dbfile_post2file_table              

*将db_post2file_table重命名为dbfile_post2file_table              

* checking of id is done in dbfile.inc instead of in dbfile.php              

* ID的检查是在dbfile.inc中完成的,而不是在dbfile.php中完成的              

* sortNo is disabled if no postID has been entered when editing a file              

*如果在编辑文件时未输入postID,则sortNo被禁用              

* added option dbfile_preview_types that controls what file types to preview when editing              

*添加了选项dbfile_preview_types,该选项控制编辑时预览的文件类型              

* added option dbfile_fileentry that controls the structure of a file list entry in a post with listPostLinks              

*添加选项dbfile_fileentry来控制具有listPostLinks的帖子中文件列表条目的结构              

* added hits to files table              

*将命中添加到文件表              

* added download counter + option to turn it on globally (default is off)

*添加了下载计数器+选项以全局将其打开(默认为关闭)

- 2005-10-12: * only images are previewed

-2005-10-12:*仅预览图像

- 2005-10-07: * added $trace flag to minimize debug/trace output if disabled.              

-2005-10-07:*添加了$ trace标志以最小化调试/跟踪输出(如果禁用)。              

* sortNo moved from files to post2file table

* sortNo从文件移至post2file表

- 2005-09-27: * added option for post2file table              

-2005-09-27:*为post2file表添加了选项              

* added post2file table in install              

*在安装中添加了post2file表              

* added relation post2file in receiveFile              

*在receiveFile中添加了关联post2file              

* requirements changed, added my production environment              

*要求已更改,添加了我的生产环境              

* moved all functions into dbfile class to avoid name clashes

*将所有函数移到dbfile类中,以避免名称冲突

- 2005-09-23: * added Requirements in readme.txt              

-2005-09-23:*在readme.txt中添加了要求              

* install/enabling the plugin now checks if the files table exists before trying to create it              

*安装/启用插件现在可以在尝试创建文件表之前检查文件表是否存在              

* SQL changed to be MySQL 4.0x compatible              

* SQL更改为与MySQL 4.0x兼容              

* more user friendly maximum upload size error message              

*更用户友好的最大上传大小错误消息              

* added postID and sortNo to table              

*添加postID和sortNo到表              

* added FilePostID and FileSortNo to upload page

*添加FilePostID和FileSortNo到上传页面

1.0 – 2005-09-20: initial release

1.0 – 2005-09-20:初始版本

Requirements

要求

This is the setup I have tested with.

这是我测试过的设置。

Please let me and the community know if you have got it working on other conjfigurations!

请让我和社区知道您是否可以将其用于其他配置!

Test environment:

测试环境:

Windows XP SP2 (http://www.microsoft.com/windowsxp)

Windows XP SP2(http://www.microsoft.com/windowsxp)

Apache httpd 2.0.54 (http://httpd.apache.org)

Apache httpd 2.0.54(http://httpd.apache.org)

PHP 5.0.4 (http://www.php.net)

PHP 5.0.4(http://www.php.net)

MySQL 4.1.13-nt (http://www.mysql.org)

MySQL 4.1.13-nt(http://www.mysql.org)

Wordpress 1.5.2 (http://www.wordpress.org)

WordPress 1.5.2(http://www.wordpress.org)

Production environment:

生产环境:

FreeBSD or OpenBSD (my hosting company wont give away exactly which of them I use)

FreeBSD或OpenBSD(我的托管公司不会确切提供我使用的那一个)

Apache httpd 1.3.33 (http://httpd.apache.org)

Apache httpd 1.3.33(http://httpd.apache.org)

PHP 4.x (http://www.php.net)

PHP 4.x(http://www.php.net)

MySQL 4.0.18 (http://www.mysql.org)

MySQL 4.0.18(http://www.mysql.org)

Wordpress 1.5.2 (http://www.wordpress.org)

WordPress 1.5.2(http://www.wordpress.org)

Upload a file

上传文件

    • Go to “Manage”, “Add Database File”.
    • 转到“管理”,“添加数据库文件”。

    • Optional: fill in a short description
    • 可选:填写简短说明

    • Optional: fill in post id, to associate the file with a post
    • 可选:填写帖子ID,以将文件与帖子相关联

    • Optional: fill in sort number to sort on when displaying files in a post (only enabled if you filled in a post id)
    • 可选:填写排序编号以在帖子中显示文件时进行排序(仅当您填写帖子ID时启用)

    • Click “Browse” and find the file you want to upload (select it and choose OK)
    • 单击“浏览”,找到您要上传的文件(选择它并选择“确定”)

    • Hit the “Submit” button
    • 点击“提交”按钮

    • You will be redirected to the “Database Files” page
    • 您将被重定向到“数据库文件”页面

    Manage files

    管理文件

      • Go to “Manage”, “Database Files”
      • 转到“管理”,“数据库文件”

      • If you haven’t uploaded any files, there will be no useful information here.

      • 如果您还没有上传任何文件,这里将没有有用的信息。

        Upload a file by following the instructions above.

      • 请按照上面的说明上传文件。

      • If you want to view a file, click “View”
      • 如果要查看文件,请单击“查看”

      • If you want to download a file, press “Download”
      • 如果要下载文件,请按“下载”

      • If you want to delete a file, click “Delete” and confirm with “OK”
      • 如果要删除文件,请单击“删除”并单击“确定”确认

      • If you want to edit a file, click “Edit”, and you will be presented with the upload page again.
      • 如果要编辑文件,请单击“编辑”,然后将再次显示上载页面。

      Uninstall

      卸载

        • Check what database and table the plugin is using, under Options, Database Files
        • 在“选项”下的“数据库文件”下,检查插件正在使用的数据库和表

        • Turn the plugin off in the Plugin Management page.
        • 在“插件管理”页面中关闭插件。

        • Delete the dbfiles directory in the WordPress plugin directory
        • 删除WordPress插件目录中的dbfiles目录

        • Optional: delete the files table mentioned in Options, Database Files, Destination database / Destination table
        • 可选:删除选项,数据库文件,目标数据库/目标表中提到的文件表

        • Optional: delete the options added in wp_options (see “Options added and used in wp_options” below)
        • 可选:删除wp_options中添加的选项(请参见下面的“ wp_options中添加和使用的选项”)

        Files

        文件

        This is how the structure should look when installed correctly:

        这是正确安装后结构的外观:

        /wordpress/plugins/dbfile/dbfile.inc – the db_file class with all functionality to access database files
                                  

        /wordpress/plugins/dbfile/dbfile.inc –具有访问数据库文件所有功能的db_file类
                                  

        dbfile.php – all actions (edit, view, get, delete) are handled via this file
                                  

        dbfile.php –通过此文件处理所有操作(编辑,查看,获取,删除)
                                  

        dbfiles.php – the plugin main activation file
                                  

        dbfiles.php –插件主激活文件
                                  

        LICENSE.TXT – GPL license
                                  

        LICENSE.TXT – GPL许可证
                                  

        readme.txt – this file

        readme.txt –此文件

        Tables

        表格

        The files table (defaults to wp_files in the WordPress database) consists of these fields:
         

        文件表(在WordPress数据库中默认为wp_files)包含以下字段:
         

        id – the id of the database file
         

        id –数据库文件的ID
         

        name – the name of the file
         

        名称–文件名
         

        mimeType – the mime type of the file, i.e. image/png for a .png file
         

        mimeType –文件的mime类型,即.png文件的image / png
         

        content – the actual file, stored as a blob – binary large object
         

        内容–实际文件,以斑点形式存储–二进制大对象
         

        description – a short description of the file
         

        description –文件的简短描述
         

        created – date and time when the file was uploaded (first time)
         

        创建-文件上传的日期和时间(第一次)
         

        modified – date and time when the file was modified/uploaded (after first time)
         

        Modifyed –修改/上传文件的日期和时间(第一次之后)
         

        hits – the number of times the file has been downloaded/viewed.

        点击数–文件被下载/查看的次数。

        This only increments if hit counting is turned on with the dbfile_use_hitcounter option.

        仅当使用dbfile_use_hitcounter选项打开命中计数时,此计数才会递增。

        The post2file table (defaults to wp_post2file in the WordPress database) consists of these fields:
         

        post2file表(在WordPress数据库中默认为wp_post2file)包含以下字段:
         

        relID – the relational id
         

        relID –关系ID
         

        postID – the id of the post record
         

        postID –帖子记录的ID
         

        dbfileID – the id of the dbfile record
         

        dbfileID – dbfile记录的ID
         

        sortNo – the sorting number used when displaying dbfiles in a post, to sort the entries

        sortNo –在帖子中显示dbfile时用于对条目进行排序的排序号

        For now, the dbfile plugin handles only one to one relation between a post and a dbfile.

        目前,dbfile插件仅处理帖子和dbfile之间的一对一关系。

        This is soon to be changed.

        这将很快改变。

        Options added and used in wp_options

        在wp_options中添加和使用的选项

        dbfile_use_fileupload – “1” to enable uploads, “0” to disable.

        dbfile_use_fileupload –“ 1”启用上载,“ 0”禁用。

        Default is “0”
         

        默认值为“ 0”
         

        dbfile_database – The name of the database to use for upload/download of files.
                          

        dbfile_database –用于上传/下载文件的数据库的名称。
                          

        Defaults to “wordpress” (or whatever you have named it).
         

        默认为“ wordpress”(或任何您命名的名称)。
         

        dbfile_table – The name of the table to use for upload/download of files.
                          

        dbfile_table –用于上传/下载文件的表的名称。
                          

        Defaults to “wp_files” (actually the wp_ part is dynamically fetched from your installation).
         

        默认为“ wp_files”(实际上wp_部分是从安装中动态获取的)。
         

        dbfile_post2file_table – The name of the table to use for relations between posts and db files.
                          

        dbfile_post2file_table –用于发布和db文件之间关系的表的名称。
                          

        Defaults to “wp_post2file” (the wp_ part is dynamically fetched from your installation).
         

        默认为“ wp_post2file”(wp_部分是从安装中动态获取的)。
         

        dbfile_upload_maxk – The maximum number of kilobytes that will be received when uploading.
                          

        dbfile_upload_maxk –上传时将接收的最大千字节数。
                          

        Defaults to 300
         

        默认为300
         

        dbfile_upload_allowedtypes – The file extensions that are allowed to be uploaded, separated by spaces.
                          

        dbfile_upload_allowedtypes –允许上传的文件扩展名,以空格分隔。
                          

        Defaults to “jpg jpeg gif png”
         

        默认为“ jpg jpeg gif png”
         

        dbfile_upload_minlevel – The minimum user level required to upload files.
                          

        dbfile_upload_minlevel –上载文件所需的最低用户级别。
                          

        Defaults to 6.
         

        默认为6。
         

        dbfile_preview_types – The file types that should be previewed when editing a file, separated with space, excluding the extension dot
                          

        dbfile_preview_types –编辑文件时应预览的文件类型,以空格分隔,但扩展名点除外
                          

        Defaults to jpg jpeg gif png
         

        默认为jpg jpeg gif png
         

        dbfile_entry – The structure of a dbfile entry in a post.

        dbfile_entry –帖子中dbfile条目的结构。

        Use %name and %link inside the string
                          

        在字符串中使用%name和%link
                          

        Defaults to

        默认为

      • %name
      • %name

        dbfile_use_hitcounter – Turn on hit counter by setting this to 1
                          

        dbfile_use_hitcounter –通过将其设置为1来打开命中计数器。
                          

        Defaults to 0

        默认为0

        Todo

        Todo

        As this is a new project, there are several items/bugs that could be fixed in the future:

        由于这是一个新项目,因此将来可能会修复多个项目/错误:

        * Localization

        *本地化

        * Check FIXMEs

        *检查FIXME

        * Security/SQL-injection?

        *安全性/ SQL注入?

        * Compression

        *压缩

        * Use the ORIGINAL created and modified of the file?

        *使用原始创建和修改的文件?

        Add a field “uploaded” to wp_files then.

        然后将一个字段“ uploaded”添加到wp_files。

        * Follow WordPress coding standards

        *遵循WordPress编码标准

        * Different files for the different actions?

        *不同文件的不同动作?

        adddbfile.php, editdbfile.php, admindbfiles.php?

        adddbfile.php,editdbfile.php,admindbfiles.php?

        * Add “read” and “edit” rights to files

        *为文件添加“读取”和“编辑”权限

        * Separate content from presentation better

        *更好地将内容与演示文稿分开

        * Remove hard coded links/paths

        *删除硬编码的链接/路径

        * More documentation

        *更多文档

        * Sortable table in Database File Management (see http://www.kryogenix.org/code/browser/sorttable/ for an example)

        *数据库文件管理中的可排序表(有关示例,请参见http://www.kryogenix.org/code/browser/sorttable/)

        * Nicer error messages for users (XHTML compliant)

        *为用户提供更好的错误消息(符合XHTML)

        * Integrate with the image/file browser in ChenPress/FCKeditor

        *与ChenPress / FCKeditor中的图像/文件浏览器集成

        * Caching (on/off) (cache files on filesystem?)

        *缓存(打开/关闭)(在文件系统上缓存文件吗?)

        * Add referrer checking, so external sites can not link directly (on/off)

        *添加引荐来源网址检查,使外部站点无法直接链接(打开/关闭)

        * Change the content field in the files table to LONGBLOB

        *将文件表中的内容字段更改为LONGBLOB

        * Export files from the database to the file system

        *将文件从数据库导出到文件系统

        * Rename files

        *重命名文件

安装步骤

    • Extract the files in the archive
    • 提取存档中的文件

    • Upload the extracted folder (dbfile) to your plugins folder, usually wp-content/plugins/
    • 将提取的文件夹(dbfile)上传到您的插件文件夹,通常为 wp-content / plugins /

    • Optionally: if you rename the dbfile folder, change the $pluginPath variable in dbfile.inc.
    • 可选:如果重命名dbfile文件夹,请在dbfile.inc中更改$ pluginPath变量。

    • Activate the plugin at the plugin screen.

    • 在插件屏幕上激活插件。

      The default table and options are set up automatically.

    • 默认表和选项是自动设置的。

    • Optional: modify the settings in the ‘Options’, ‘Database File Options’ pane
    • 可选:修改“选项”,“数据库文件选项”窗格中的设置

    • Finito!

    • 菲尼托!

      You are now ready to upload files!

    • 您现在可以上传文件了!

下载地址
https://downloads.wordpress.org/plugin/dbfile.zip
-EOF-

AI助手支持GPT4.0