Australian guest network development coding agreement

xiaoxiao2021-03-06  38

/ **

* Copyright (C) 2004 Beijing West Line Media Technology Co., Ltd.

* Author: Liu Zhenfei liuzf@pku.org.cn; Wang Chunsheng wwccss@263.net

* Produced: Beijing West Line Media Technology Co., Ltd. Technology Http://www.okooo.com

*

* This program is free software, you can follow the GNU General Public License Terms published in the Free Software Foundation

* Remove this procedure. Or use any update with the second edition of the license, or (according to your choice)

* Version.

*

* The purpose of publishing this program is to hope it is useful, but there is no guarantee. Even if it is not suitable for a specific purpose

* Guarantee. For more detailed information, please refer to the GNU universal public license.

*

* You should have received a copy of a GNU universal public license with a program. If not, write a letter to:

* The Free Software Foundation, INC.,

* 675 Mass AVE,

* Cambridge, Mao2139, USA

* Should also add how to keep in touch with you.

*

* Reference documentation: http://www.w3cn.org/Article/Step/2004/26.html, thank the original author.

*

* Welcome to "West Line Media Free Software Park": http://www.okooo.com/opensource/, we will release useful free software here.

* /

First, the file structure:

The entire website directory structure is as follows: (color example: first-level catalog secondary directory level three directory)

/ Root directory (such as: / home / www /, may vary.)

| --- Documents (Store developed document file)

| --- INCLUDE (stored in file)

| --- Class definition file, each class separately a file to define.)

| --- ClassFile1

| --- ClassFile2

| --- ..........

| --- Config.inc.php Storage System Parameter Settings Information.

| --- functions.inc.php public library file.

| ---- OtherFunction.inc.php Library files for other specific applications. Name according to the actual situation.

| --- setup.inc.php parameter variable initialization file. Other programs can directly contain this file.

| --- HTML

| --- Images (Store website image files, and establish the corresponding subdirectory according to the name of the column.)

| --- CHANNELNAME1 (Picture File) Store ChannelName1 Column)

| --- ChannelName2

| --- CSS (store website style sheet file)

| --- Include (files needed in the web page, such as JS teaching, etc.)

| --- ChannelName1 (stored the program file of the ChannelName1 column.)

| ---- ChannelName2

| --- ..........

| --- Admin (Managers for the entire site. This directory needs to be protected by various methods.)

| - -cache (Smarty Template generated cache file, directory permissions need to be writable.)

| --- Compile (SMARTY Template generated compilation, directory permissions need to be writable.)

| --- Smarty (Store smarty file)

| --- PEAR (stores PEAR files, optional. Because the system itself has pear ..)

| --- Templats (SMARTY template file, the directory structure corresponds to the HTML directory structure.)

| --- Images (Store website image files, and establish a corresponding subdirectory according to the name of the column.) | --- ChannelName1 (Picture File) of the ChannelName1 column)

| --- ChannelName2

| --- CSS (store website style sheet file)

| --- Include (files needed in the web page, such as JS teaching, etc.)

| --- ChannelName1 (stored the program file of the ChannelName1 column.)

| ---- ChannelName2

| --- ..........

Second, catalog, file naming conventions:

Directory, file naming is in English, the length is generally not more than 20 characters, and the name of the case is used. In addition to special circumstances, Chinese pinyin is used. For example: images, getusername.php changepassword.php

Third, the components of the PHP script file:

Each document is arranged in the following order: Document Description section, contains file parts, variable declarations, initializes, custom functions, and specific statements.

3.1 Document Description Part

At the beginning of each document, you want to include the number of this document, a brief description, and the author and final modification. Note When using phpDocument's annotation.

/ **

* Okoo.com Homepage (Simply Note)

*

* This file provides a shared function file applied to the website (detailed instructions).

* @file $ source $

* @package index (which module belonging to, can be divided according to the functionality of the program.)

* @Author Wang Chunsheng

* @version $ ID $

* /

?>

If the page is a pure web page, you can explain in the following form: Note that it starts with HTML annotation statements.

/ **

* Homepage (simple note)

*

* This file provides a shared function file applied to the website (detailed instructions).

* @file $ source $ * @Package INDEX

* @Author Wang Chunsheng

* @version $ ID $

* /

->

The $ ID $ ID $ will automatically replace the file basic information after CVS, which contains CVS information such as file name, date, and modifier.

3.2 Contains the file part:

The beginning of each document contains the included files used in this document.

For example: include ("setup.inc.php");

Note: If you use session, you need to put the session_start () function to the first sentence of the document.

3.3 Variable Description Part:

If there is a variable that requires a special statement, it is given here. It can be explained by the way of comment statements. such as:

// Username The user name of the user is currently logging in.

3.4 Custom Function Part:

If the current PHP script needs to define a function, this declare. Any of two functions for more than two documents are placed in the public library file, ie /include/functions.inc.php files.

Custom functions need to include the following sections: Function Description, Function Variable Description, Return Value Description.

Example:

/ **

* Database connection function (briefly)

*

* Linked to the database through this function and returns a trusted link identifier. (Detailed explanation)

* @Author Wang Chunsheng

* @version 1.0 * @global string database server (global variable declaration, no need to specify variables, order corresponding)

* @Global String Database Username

* @global string database password

* @global string database to use

* @Param String $ SQL connection successfully executed query statement, the default is empty. (Variable statement)

* @Return Array Returns the database connection information. (Return value description)

* /

Function Dbconnect ($ SQL = "")

{

Global $ DBHOST, $ DBUSER, $ DBUSERPWD, $ DBDATABASE

$ Connifo = array (); // Store connection information

$ Linkid = mysql_connect ($ DBHOST, $ DBUSER, $ dbuserpwd); / / Connect to the database, return connection ID

MySQL_SELECT_DB ($ dbdatabase); // Select the database

$ Results = mysql_query ($ SQL, $ LINKID); // Return Query Result ID

$ Connifo ["linkid" = $ linkID; // Save two IDs to array $ connInfo

$ Connifo ["resultid" = $ results;

RETURN $ connInfo; // Return Array $ ConnInfo

}

?>

3.5 File ends:

The following notes must be written in all text files (PHP, HTM, etc.):

PHP:

/ **

* $ Log $

* /

?>

HTM:

/ **

* $ Log $

* /

->

This comment will automatically replace the file modification record after CVS Checkout.

Fourth, program annotation conventions:

The documentation and function describes the form of phpdocument

The module illustrates the form of comments on the sentence. Description of each statement adopts the way to write.

Note to the file declaration and the function of the function Refer to the above format.

Here is the annotation format of class files.

/ **

* Data Record Points Display Class. (Brief Description of the entire class file)

*

* A class regarding the data paging display, you can select a page through a drop-down list. (Detailed explanation)

* @Package Include (the module name to which you belong)

* @Author Wang Chunsheng

* @version $ ID 2003-12-6 21:30 $

* /

Class Page

{

/ **

* Total number of records. (Statement to class properties.)

* @var int

* /

Var $ RectAl;

/ **

* The number of records per page is displayed.

* @var int

* /

Var $ RECPERPAGE;

/ **

* Total the total number of records of a certain condition query. (Instructions for the class method, the same as the description of the function)

*

* @Global Object $ dB database link information.

* /

Function GetRectotal ()

{

GLOBAL $ mysql;

..........

} ``

V. PHP statement writing format agreement:

IF ($ usrname = = "xxx" and $ password = = "xxx") {

Echo "Hello";

}

Else

{

echo "Oh";

}

Braces are divided into two columns, and the reason is convenient to define the range of braces.

The indentation uses four spaces without using the Tab key to indent.

The function name is spaced between the parameters. For example: $ linkid = mysql_connect ($ username, $ host)

6. Named mode of PHP variables follows the following principles:

(1) Size mixing: distinguishes on the form of uppercase mixing. For example: username

(2) If there is a word abbreviation, a capital form is used. Such as: SQL. At the same time, the word should be avoided, such as IMGFILE, can not directly determine the segmentation of the word, should be written into IMGFILE. The name of the class is similar to the variable naming, which is also used in cases in cases. Class properties adopt _ start, such as $ object -> _ var1

7. PHP function naming conventions:

The form of verb additive, verb lowercase, the name of the next name is spaced apart. If you need, you can increase your lowermill, and this time the verb is on the point. such as:

No prefix: getUsername

Prefix: sysgetusername

Eight, database change field naming conventions:

(1) Database, table, field naming is the same as the PHP variable, using case-write mixing, such as Database: Okooo

Table: UserList

Field: Username, Userpassword, Birthdate ...

(2) The keywords in the SQL query statement use capitalization. For example: Select * from userlist where ......

(3) Module Description Document If there is a database definition, follow the format:

Module name (such as: user table) table name (such as UserList)

Description of the table: System user table

Serial number

Field name

Field description

Field type, size

Is empty

Defaults

Key name

index

1

Scholarid

Scholar number

Smallint unsigned

NOT

Self-increasing

Y

Y

2

ScholarName

Scholar's name

VARCHAR (20)

NOT

N

Y

3

Sortid

Order

Tinyint unsigned

NOT

1

4

Scholarintro

Scholar profile

TEXT

NOT

N

Y

5

Images

Scholar picture

VARCHAR (79)

6

Adduaser

Adder

VARCHAR (30)

NOT

Seduce

Updatedate

Last update time

Datetime

0

Note: Description of some fields. Or your own design ideas.

If the database has been changed later, the document should be changed, keep synchronization.

Nine, CVS operational agreement:

(1) Plus $ ID $ and $ CVS TAG before and files, please refer to the Composite of the PHP Script File "section.

(2) When CVS Checkin must write a comment, the content of the comment must be the modification of this version, such as:

Add username check

* Fixed the password BUG

- Remove the ABCDE function

The detailed description is as follows:

1) Changes to the symbols, " " indicates the new function, "*" means the modification function, "-" means the function of the deletion;

2) Each change occupies a row; 3) There is a space before and after the symbol (" ", "-" and "*").

Ten, XHTML code specification

10.1 reference to the style sheet

Style sheets are called by external references, which is not recommended to newly defined in the page.

The form of display in the page element is not recommended to define by HTML code, and all the style sheets are unified.

For example, you want to display a red font, you can define this with an HTML code:

red font

But the best way is to define through style sheets.

Red field

This will focus on the definition of the website style to a style sheet file, if you modify the site, you can make it quickly. And if it is dispersed into each web file, it is very troublesome to change it.

10.2 indentation, refund

Network code indentation uses two spaces.

Because the page nested tag may be more, it is used to indent the code of the deepest layer to indent too much, so it uses two spaces to indent.

If the code in a row is too long, please go back.

Such as such a line of code

If multi-line similar code appears, the property is as aligned.

such as

The Type, Name and the Value property are more convenient to read it later.

For a plurality of properties of some mark, the order is as close as possible.

For example, the definition of the Table tag can be defined in the order below.

10.3 writing specification

10.3.1

All tags must have a corresponding end tag

Previously in HTML, you can open a number of labels, such as

and

  • without having to write the corresponding and to close them. But this is illegal in XHTML. XHTML requires a rigorous structure, and all labels must be closed. If it is a label that is not pair, it is closed at the label last adds "/" to close it. For example:
    web designer 10.3.2

    The names of all tags and attributes must use lowercase

    Unlike HTML, XHTML is sensitive to case, and <title> are different labels. XHTML requires all the names of all labels and properties to use lowercase. For example: <body> must be written in <body>. Calculation inclusions are also not recognized, usually Dreamweaver automatically generated attribute name "OnMouseOver" must also be modified to "OnMouseOver".</p> <p>10.3.3</p> <p>All markers must be reasonable nested</p> <p>10.3.4</p> <p>All attributes must be quoted ""</p> <p>In HTML, you don't need to add quotes to attribute values, but in XHTML, they must be an extension.</p> <p>10.3.5</p> <p>Give all attributes a value</p> <p>XHTML specifies that all attributes must have a value, and no value is repeated. E.g:</p> <p><TD NOWRAP> <input type = "checkbox" name = "shirt" value = "Medium" checked></p> <p>Must be modified to:</p> <p><TD NOWRAP = "NOWRAP"></p> <p><Input Type = "Checkbox" Name = "Shirt" value = "Medium" check = "checked"></p> <p></ td></p> <p>10.4 Table Single Volume Naming Convention</p> <p>The variable named in the form is named using a PHP, using the case interval. such as:</p> <p><form name = "loginform"></p> <p><Input Type = "text" name = "username" value = ">></p> <p><Input Type = "Password" Name = "Password" Value = ">></p> <p></ form></p> <p>10.5 References</p> <p>Web designer: http://www.w3cn.org/Article/Step/2004/26.html</p> <p>11. JavaScript code specification</p> <p>11.1 Directory file structure</p> <p>Website All public JS scripts are placed under the HTML / JS directory, naming according to the category, file names along the name of the PHP file, using the size of the case in size: such as functionsmain.js.</p> <p>If it is a third-party script, keep the original name unchanged.</p> <p>11.2 Variable Naming Convention</p> <p>Due to the case of JavaScript case, it is necessary to be careful when naming the variable. At the same time, in order to keep unity with the PHP program, JavaScript's variable naming is also in the form of case interval.</p> <p>If the JavaScript variable does not participate in the interaction with the server (ie, this variable does not pass it to the server) can also add prefixes in front, common prefixed table below. Variable named identifier:</p> <p>Type prefix</p> <p>Example</p> <p>Boolean BLN</p> <p>BLNFINISHED</p> <p>Byte BYT</p> <p>Bytletter</p> <p>Date DTM</p> <p>DTMBIRTHDAY</p> <p>Double precision DBL</p> <p>DBLRESULT</p> <p>Error message err</p> <p>ErrbadInput</p> <p>Interest INT</p> <p>INTBEENS</p> <p>Long integer LNG</p> <p>LNGDISTANCE</p> <p>Object OBJ</p> <p>Objfirst</p> <p>Single precision integer SNG</p> <p>SNGBalance</p> <p>String STR</p> <p>Strusename</p> <p>Object naming identifier</p> <p>Object name prefix</p> <p>Example</p> <p>Check box chk</p> <p>Chktotomatch</p> <p>List box LST</p> <p>LstProvince</p> <p>Text box txt</p> <p>TXTUSERNAME</p> <p>Button BTN</p> <p>Btnvote</p> <p>11.3 Function Name, Notes</p> <p>11.3.1</p> <p>The function name is in the form of verbs noun, the first letter lowercase. You can also increase the prefix.</p> <p>For example: function checkusername ()</p> <p>Increase the prefixed naming can be: function syscheckusername ()</p> <p>11.3.2</p> <p>Comment of the function takes along the standard of PHPDOC.</p> <p>such as:</p> <p>/ **</p> <p>* Displays An Confirmation Box Before To Submit A "Drop / Delete / ALTER" Query.</p> <p>* This function is caled while clying links</p> <p>*</p> <p>* @Author Wangcs <wwccss@263.net></p> <p>* @Param Object Strlink The Link</p> <p>* @Param Object StrsqlQuery The SQL Query to Submit</p> <p>* @Return Boolean WHETHER TO Run The Query or Not</p> <p>* /</p> <p>Function Confirmlink (Strlink, StrsqlQuery)</p> <p>{</p> <p>}</p> <p>11.4 code writing specification</p> <p>11.4.1</p> <p>Ind retreat: indentation uses four spaces to indent.</p> <p>11.4.2</p> <p>Each line is ended in ";";</p> <p>11.4.3</p> <p>Circulating, logic judges a row alone.</p> <p>11.4.4</p> <p>The similar part of the neighboring lines is aligned as much as possible.</p> <p>such as:</p> <p>/ **</p> <p>* Dynamically display the form.</p> <p>*</p> <p>* @Author Wang Chunsheng <wwccss@263.net></p> <p>* @Param Int ID Form Number.</p> <p>* @Param int Totalcount Total number of tables.</p> <p>* /</p> <p>Function ShowTable (ID, TOTALCOUNT)</p> <p>{</p> <p>For (i = 1; i <= totalcount; i )</p> <p>{</p> <p>IF (i == id)</p> <p>{</p> <p>Document.all ["Table" i] .style.display = "</p> <p>}</p> <p>Else</p> <p>{</p> <p>Document.all ["Table" i] .style.display = "none";</p> <p>}</p> <p>}</p> <p>}</p> <p>11.5 References</p> <p>11.5.1</p> <p>"Look at the instance VBScript"</p> <p>11.5.2</p> <p>. JS scripts in phpmyadmin.</p> <p>11.5.3</p> <p>JS script in TreeMenu. Twelve, modified records</p> <p>12.1</p> <p>2004-2-18</p> <p>Modify record: (Changelog)</p> <p>1. Modify the indentation into four spaces.</p> <p>2. Add the database definition format.</p> <p>12.2</p> <p>2004-3-11</p> <p>Modify record:</p> <p>3. Modify the components of the PHP document, add CVS Tag: $ ID $ and $ log $.</p> <p>4, increasing the CVS operational agreement.</p> <p>12.3</p> <p>2004-6-17</p> <p>Modify record:</p> <p>The attributes of the 6.3 class begin with the underscore.</p> <p>7 Modify the agreement of the PHP function name.</p> <p>12.4</p> <p>2004-11-16</p> <p>Modify record:</p> <p>Change the organization of this document to outline.</p> <p>Increase the code specification of XHTML.</p> <p>Increase the JavaScript code specification.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-68319.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="68319" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.057</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'nonwrJdg3wp3eaKk4rUjUIpF7FiSR4tyHRMuzBzVbaRXMiCq_2B4GWFuHejtY1V3X3T1MtM7f9oPXr_2F7dGe2zUJw_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>