Discuz 7.2 highlights -PHP papers pit father ucc representative uc_client representative uc_server ucs directory directory type: Code style pit father index: Comments: DZ code is good, but its style is rather painful for code maintenance. Assignment expression should have been avoided in the judgment of the intention to avoid the habit after a logical comparison operation mistakenly written assignment operator and increase the debug difficult, but on the contrary solid wood cabinets do not like to use the DZ intermediate variables solid wood cabinets tend to be variable assignment expressions used directly to determine IF. Fu Kang Shengxing estimate procedures solid wood cabinets are used ape widescreen display, so they are quite stingy wrap, mankind solid wood cabinets has been able to stop a statement can exceed the 19-inch 16: 9 widescreen LCD many, many like the Yellow River flooding out of control through solid wood cabinets the Yangtze River ~ Parentheses are not strictly for use, IF / ELSEIF / WHILE / FOREACH parentheses immediately behind without adding solid wood cabinets a space, though without affecting the results, but for non-function calls between the keyword and the brackets or leave it empty. -------------------------------------------------- -------------------------------------------------- --------------------- Type: emoticons pit father index: Code: http: //yourdomain/faq.php action = faq & id = 5 & messageid = 32 Comments?: cry emoticons codes: \ '(correct should be:' (, build a table in SQL code problems solid wood cabinets ----------------------- solid wood cabinets when inserting data. -------------------------------------------------- -------------------------------------------------- - Type: code style pit father index: Code: include / global.func.php ~ 400 function forumperm ($ permstr) {global $ groupid, $ extgroupids; $ groupidarray = array ($ groupid); foreach (explode ("\ t ", $ extgroupids) as $ extgroupid) {if ($ extgroupid = intval (trim ($ extgroupid))) {<------------ assignment or judgment? too easy to confuse people $ groupidarray [ ] = $ extgroupid;}}}
-------------------------------------------------- -------------------------------------------------- ! --------------------- Type: Variable type pit father Index: Code: include / newreply.inc.php 240 $ parseurloff = empty ($ parseurloff);
Comments: will lead to an empty string variable non-int. Because mysql more lenient standard for SQL support is poor, enter a value for the field type is not strictly checksum: If you are int type field, solid wood cabinets you enter a null character so will automatically give you converted to 0. But right after the transplant solid wood cabinets unfavorable for the development of the individual in the future may not be good technically. solid wood cabinets Similar wording is mysql LIMIT, both support LIMIT {[offset,] row_count} format also supports LIMIT {row_count OFFSET offset} standard, but most people only know the former using the latter does not know the standard format. -------------------------------------------------- -------------------------------------------------- --------------------- Type: Undefined variable (Undefined Variable / Index) pit father Index: Code: multiple. To ucs / view / default solid wood cabinets template file under htm majority. Undefined index: allowadminlog ---- Modified: ucs / view / default / admin_admin.htm Modified: ucs / view / default / admin_feed.htm Modified: ucs / view / default / admin_mail.htm Modified: ucs / view / default / admin_note .htm <li> <input type = "checkbox" name = "allowadminlog" value = "1" class = "checkbox" {if $ admin [allowadminlog]} checked = "checked" {/ if} /> {lang admin_allow_log} </ li>
Comments: PHP weakly typed language, variables are not pre-declaration solid wood cabinets to use, easy to use. However, when the operation will lead to undefined variables PHP throws solid wood cabinets a Notice, this is not Suansha errors in PHP, but it will bring some unexpected DZ debugging problems: DZ ajax exchange using XML as the format, I do not know js coding problem or XML itself is the problem, if you open php.ini display_error switch, the current station page calls ajax operations encounter PHP will throw an error log message reception, firebug in XML error but more often than not prompt a display common.js OK error (eg Error: s is NULL, $ is not exists and the like). Thought solid wood cabinets it was not familiar with JS code is, in fact, rooted in the PHP code is not rigorous, strict and complicated XML format. Ajax website personally solid wood cabinets feel better solid wood cabinets using JSON over XML, either background or foreground program processing output JS code to parse the data. For PHP array, an echo json_encode ($ array) JSON format information can quickly return to the front; and a reception JS eval "{data}" command solid wood cabinets to resolve immediately as JS variable object (for security reasons, we do not recommend the use of eval to resolve, then you can use if you are using jQuery $ .ajax () the dataType: json or direct solid wood cabinets $ .getJSON () to get the array variable directly).
-------------------------------------------------- -------------------------------------------------- --------------------- Type: Undefined variable pit father Index: code: pm.php = $ 47 pmstatus = uc_pm_checknew ($ discuz_uid, 4); $ ! filter = empty ($ filter) && in_array ($ filter, array ('newpm', 'privatepm', 'announcepm')) $ filter:? ($ pmstatus ['newpm'] 'newpm':? 'privatepm') ;
Comments: No return value $ pmstatus ['newpm'] to determine the effectiveness --------------------------------- -------------------------------------------------- -------------------------------------- Type: Undefined variable pit father solid wood cabinets Index: code: pm.php = 61 foreach ($ ucdata ['data'] as $ pm) {....}
Comment: Not for $ ucdata variable 'data' button to make a judgment on the direct and effective to start the cycle, the equivalent of a variable that may not exist to access and iteration. The problem is called line49 uc_pm_list () for $ ucdata assignment, but ucc / control solid wood cabinets / pm.php: onls () function returns the value of the $ result uninitialized 'data' keys. Although PHP is that if the type, but whatever the outcome, the return value of a function to be a judge and then operate it. Will be less lazy few lines of code, debugging solid wood cabinets and maintenance time can spend time on more. -------------------------------------------------- -------------------------------------------------- --------------------- Type: Variable wrong pit father Index: code:. memcp.php line264 $ styleid = empty ($ styleidnew) $ styleid:? $ styleidnew;
-------------------------------------------------- -------------------------------------------------- --------------------- Type: variables pit father Index: code: include / global.func.php 1514 updateprompt () function in the $ db-> query ("UPDATE {$ tablepre} members SET prompt = prompt ^ 1 WHERE uid = '$ discuz_uid' AND prompt = prompt | 1", 'UNBUFFERED');
Comments: The function does not declare global variables $ discuz_uid FIX: Use $ uid alternative ---------------------------------- -------------------------------------------------- ------------------------------------- solid wood cabinets Type: variables pit father Index: code: admin / member = 990:.. $ db-> query ("INSERT INTO {$ tablepre} medallog solid wood cabinets (uid, medalid, type, dateline, expiration, status) VALUES ('$ uid', '" solid wood cabinets $ modmedal [medalid] " ',' 0 ',' solid wood cabinets $ timestamp ',' solid wood cabinets ',' $ medalstatus') ")" $ modmedal ['expiration'].. ";
Comments: $ modmedal [medalid] lack of single quotes. DZ have adopted solid wood cabinets the use of an array variable manner without the single quotes in double quotes, such as "... $ modmedal [medalid]" without the use of cumbersome braces but safer way "... {$ modmedal ['medalid' ]} ", rarely used the example string concatenation methods. Do this with a mosaic, the results so much force of habit or use the access without single quotes. solid wood cabinets Maybe, solid wood cabinets maybe small Gejia classes late at night, blurred vision, did not see the two small dots around the thought is in the range of double quotes. Good code is used to reduce the number of errors can sometimes also facilitate rapid debug. For example, use as little as possible in the judgment of the assignment expression, in the subsequent or prior to such use plus spaces. No. mosaic string. The latter advantage is that when there is a small double-click with the mouse variable correctly solid wood cabinets selected the desired range.
FIX: The key variable name with single quotes $ modmedal ['medalid'] --------------------------------- solid wood cabinets -------------------------------------------------- -------------------------------------- Type: Variable type pit father Index: code: include / global.func.php = 1339 $ db-> query ("UPDATE {$ tablepre} sessions SET uid = '$ discuz_uid', username = '$ disc
No comments:
Post a Comment