XOOPS Cube Legacy base repository
Revision | b031b35ad9683e6211895229475de9e3bf143b2c (tree) |
---|---|
Zeit | 2011-11-16 22:04:56 |
Autor | nbuy <nbuy@704c...> |
Commiter | nbuy |
single quote using for speedup
git-svn-id: https://xoopscube.svn.sourceforge.net/svnroot/xoopscube/Package_Legacy/trunk@1051 704cf05f-ae62-4b0e-a484-234ee0250e75
@@ -68,11 +68,11 @@ function xoops_error($message, $title='', $style='errorMsg') | ||
68 | 68 | $renderTarget =& $renderSystem->createRenderTarget('main'); |
69 | 69 | |
70 | 70 | $renderTarget->setAttribute('legacy_module', 'legacy'); |
71 | - $renderTarget->setTemplateName("legacy_xoops_error.html"); | |
71 | + $renderTarget->setTemplateName('legacy_xoops_error.html'); | |
72 | 72 | |
73 | - $renderTarget->setAttribute("style", $style); | |
74 | - $renderTarget->setAttribute("title", $title); | |
75 | - $renderTarget->setAttribute("message", $message); | |
73 | + $renderTarget->setAttribute('style', $style); | |
74 | + $renderTarget->setAttribute('title', $title); | |
75 | + $renderTarget->setAttribute('message', $message); | |
76 | 76 | |
77 | 77 | $renderSystem->render($renderTarget); |
78 | 78 |
@@ -90,10 +90,10 @@ function xoops_result($message, $title='') | ||
90 | 90 | $renderTarget =& $renderSystem->createRenderTarget('main'); |
91 | 91 | |
92 | 92 | $renderTarget->setAttribute('legacy_module', 'legacy'); |
93 | - $renderTarget->setTemplateName("legacy_xoops_result.html"); | |
93 | + $renderTarget->setTemplateName('legacy_xoops_result.html'); | |
94 | 94 | |
95 | - $renderTarget->setAttribute("title", $title); | |
96 | - $renderTarget->setAttribute("message", $message); | |
95 | + $renderTarget->setAttribute('title', $title); | |
96 | + $renderTarget->setAttribute('message', $message); | |
97 | 97 | |
98 | 98 | $renderSystem->render($renderTarget); |
99 | 99 |
@@ -119,14 +119,14 @@ function xoops_confirm($hiddens, $action, $message, $submit = '', $addToken = tr | ||
119 | 119 | $renderTarget =& $renderSystem->createRenderTarget('main'); |
120 | 120 | |
121 | 121 | $renderTarget->setAttribute('legacy_module', 'legacy'); |
122 | - $renderTarget->setTemplateName("legacy_xoops_confirm.html"); | |
122 | + $renderTarget->setTemplateName('legacy_xoops_confirm.html'); | |
123 | 123 | |
124 | - $renderTarget->setAttribute("action", $action); | |
125 | - $renderTarget->setAttribute("message", $message); | |
126 | - $renderTarget->setAttribute("hiddens", $hiddens); | |
127 | - $renderTarget->setAttribute("submit", $submit); | |
128 | - $renderTarget->setAttribute("tokenName", $token->getTokenName()); | |
129 | - $renderTarget->setAttribute("tokenValue", $token->getTokenValue()); | |
124 | + $renderTarget->setAttribute('action', $action); | |
125 | + $renderTarget->setAttribute('message', $message); | |
126 | + $renderTarget->setAttribute('hiddens', $hiddens); | |
127 | + $renderTarget->setAttribute('submit', $submit); | |
128 | + $renderTarget->setAttribute('tokenName', $token->getTokenName()); | |
129 | + $renderTarget->setAttribute('tokenValue', $token->getTokenValue()); | |
130 | 130 | |
131 | 131 | $renderSystem->render($renderTarget); |
132 | 132 |
@@ -161,12 +161,12 @@ function xoops_refcheck($docheck=1) | ||
161 | 161 | return true; |
162 | 162 | } |
163 | 163 | |
164 | -function xoops_getUserTimestamp($time, $timeoffset="") | |
164 | +function xoops_getUserTimestamp($time, $timeoffset='') | |
165 | 165 | { |
166 | 166 | global $xoopsConfig, $xoopsUser; |
167 | 167 | if ($timeoffset == '') { |
168 | 168 | if ($xoopsUser) { |
169 | - $timeoffset = $xoopsUser->getVar("timezone_offset"); | |
169 | + $timeoffset = $xoopsUser->getVar('timezone_offset', 'n'); | |
170 | 170 | } else { |
171 | 171 | $timeoffset = $xoopsConfig['default_TZ']; |
172 | 172 | } |
@@ -178,7 +178,7 @@ function xoops_getUserTimestamp($time, $timeoffset="") | ||
178 | 178 | /* |
179 | 179 | * Function to display formatted times in user timezone |
180 | 180 | */ |
181 | -function formatTimestamp($time, $format="l", $timeoffset="") | |
181 | +function formatTimestamp($time, $format='l', $timeoffset='') | |
182 | 182 | { |
183 | 183 | global $xoopsConfig, $xoopsUser; |
184 | 184 | $usertimestamp = xoops_getUserTimestamp($time, $timeoffset); |
@@ -188,13 +188,13 @@ function formatTimestamp($time, $format="l", $timeoffset="") | ||
188 | 188 | /* |
189 | 189 | * Function to display formatted times in user timezone |
190 | 190 | */ |
191 | -function formatTimestampGMT($time, $format="l", $timeoffset="") | |
191 | +function formatTimestampGMT($time, $format='l', $timeoffset='') | |
192 | 192 | { |
193 | 193 | global $xoopsConfig, $xoopsUser; |
194 | 194 | |
195 | 195 | if ($timeoffset == '') { |
196 | 196 | if ($xoopsUser) { |
197 | - $timeoffset = $xoopsUser->getVar("timezone_offset"); | |
197 | + $timeoffset = $xoopsUser->getVar('timezone_offset', 'n'); | |
198 | 198 | } else { |
199 | 199 | $timeoffset = $xoopsConfig['default_TZ']; |
200 | 200 | } |
@@ -204,7 +204,7 @@ function formatTimestampGMT($time, $format="l", $timeoffset="") | ||
204 | 204 | return _formatTimeStamp($usertimestamp, $format); |
205 | 205 | } |
206 | 206 | |
207 | -function _formatTimeStamp($time, $format="l") | |
207 | +function _formatTimeStamp($time, $format='l') | |
208 | 208 | { |
209 | 209 | switch (strtolower($format)) { |
210 | 210 | case 's': |
@@ -214,10 +214,10 @@ function _formatTimeStamp($time, $format="l") | ||
214 | 214 | $datestring = _MEDIUMDATESTRING; |
215 | 215 | break; |
216 | 216 | case 'mysql': |
217 | - $datestring = "Y-m-d H:i:s"; | |
217 | + $datestring = 'Y-m-d H:i:s'; | |
218 | 218 | break; |
219 | 219 | case 'rss': |
220 | - $datestring = "r"; | |
220 | + $datestring = 'r'; | |
221 | 221 | break; |
222 | 222 | case 'l': |
223 | 223 | $datestring = _DATESTRING; |
@@ -248,13 +248,13 @@ function userTimeToServerTime($timestamp, $userTZ=null) | ||
248 | 248 | |
249 | 249 | function xoops_makepass() { |
250 | 250 | $makepass = ''; |
251 | - $syllables = array("er","in","tia","wol","fe","pre","vet","jo","nes","al","len","son","cha","ir","ler","bo","ok","tio","nar","sim","ple","bla","ten","toe","cho","co","lat","spe","ak","er","po","co","lor","pen","cil","li","ght","wh","at","the","he","ck","is","mam","bo","no","fi","ve","any","way","pol","iti","cs","ra","dio","sou","rce","sea","rch","pa","per","com","bo","sp","eak","st","fi","rst","gr","oup","boy","ea","gle","tr","ail","bi","ble","brb","pri","dee","kay","en","be","se"); | |
251 | + $syllables = array('er','in','tia','wol','fe','pre','vet','jo','nes','al','len','son','cha','ir','ler','bo','ok','tio','nar','sim','ple','bla','ten','toe','cho','co','lat','spe','ak','er','po','co','lor','pen','cil','li','ght','wh','at','the','he','ck','is','mam','bo','no','fi','ve','any','way','pol','iti','cs','ra','dio','sou','rce','sea','rch','pa','per','com','bo','sp','eak','st','fi','rst','gr','oup','boy','ea','gle','tr','ail','bi','ble','brb','pri','dee','kay','en','be','se'); | |
252 | 252 | srand((double)microtime()*1000000); |
253 | 253 | for ($count = 1; $count <= 4; $count++) { |
254 | 254 | if (rand()%10 == 1) { |
255 | - $makepass .= sprintf("%0.0f",(rand()%50)+1); | |
255 | + $makepass .= sprintf('%0.0f',(rand()%50)+1); | |
256 | 256 | } else { |
257 | - $makepass .= sprintf("%s",$syllables[rand()%62]); | |
257 | + $makepass .= sprintf('%s',$syllables[rand()%62]); | |
258 | 258 | } |
259 | 259 | } |
260 | 260 | return $makepass; |
@@ -265,14 +265,14 @@ function xoops_makepass() { | ||
265 | 265 | */ |
266 | 266 | function OpenWaitBox() |
267 | 267 | { |
268 | - echo "<div id='waitDiv' style='position:absolute;left:40%;top:50%;visibility:hidden;text-align: center;'> | |
269 | - <table cellpadding='6' border='2' class='bg2'> | |
268 | + echo '<div id="waitDiv" style="position:absolute;left:40%;top:50%;visibility:hidden;text-align: center;"> | |
269 | + <table cellpadding="6" border="2" class="bg2"> | |
270 | 270 | <tr> |
271 | - <td align='center'><b><big>" ._FETCHING."</big></b><br /><img src='".XOOPS_URL."/images/await.gif' alt='' /><br />" ._PLEASEWAIT."</td> | |
271 | + <td align="center"><b><big>' ._FETCHING.'</big></b><br /><img src="'.XOOPS_URL.'/images/await.gif" alt="" /><br />' ._PLEASEWAIT.'</td> | |
272 | 272 | </tr> |
273 | 273 | </table> |
274 | 274 | </div> |
275 | - <script type='text/javascript'> | |
275 | + <script type="text/javascript"> | |
276 | 276 | <!--// |
277 | 277 | var DHTML = (document.getElementById || document.all || document.layers); |
278 | 278 | function ap_getObj(name) { |
@@ -289,7 +289,7 @@ function OpenWaitBox() | ||
289 | 289 | return; |
290 | 290 | } |
291 | 291 | var x = ap_getObj(div); |
292 | - x.visibility = (flag) ? 'visible' : 'hidden'; | |
292 | + x.visibility = (flag) ? "visible" : "hidden"; | |
293 | 293 | if (!document.getElementById) { |
294 | 294 | if (document.layers) { |
295 | 295 | x.left=280/2; |
@@ -297,29 +297,29 @@ function OpenWaitBox() | ||
297 | 297 | } |
298 | 298 | return true; |
299 | 299 | } |
300 | - ap_showWaitMessage('waitDiv', 1); | |
300 | + ap_showWaitMessage("waitDiv", 1); | |
301 | 301 | //--> |
302 | - </script>"; | |
302 | + </script>'; | |
303 | 303 | } |
304 | 304 | |
305 | 305 | function CloseWaitBox() |
306 | 306 | { |
307 | - echo "<script type='text/javascript'> | |
307 | + echo '<script type="text/javascript"> | |
308 | 308 | <!--// |
309 | - ap_showWaitMessage('waitDiv', 0); | |
309 | + ap_showWaitMessage("waitDiv", 0); | |
310 | 310 | //--> |
311 | 311 | </script> |
312 | - "; | |
312 | + '; | |
313 | 313 | } |
314 | 314 | |
315 | 315 | function checkEmail($email,$antispam = false) |
316 | 316 | { |
317 | - if (!$email || !preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i",$email)){ | |
317 | + if (!$email || !preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i',$email)){ | |
318 | 318 | return false; |
319 | 319 | } |
320 | 320 | if ($antispam) { |
321 | - $email = str_replace("@", " at ", $email); | |
322 | - $email = str_replace(".", " dot ", $email); | |
321 | + $email = str_replace('@', ' at ', $email); | |
322 | + $email = str_replace('.', ' dot ', $email); | |
323 | 323 | return $email; |
324 | 324 | } else { |
325 | 325 | return true; |
@@ -330,7 +330,7 @@ function formatURL($url) | ||
330 | 330 | { |
331 | 331 | $url = trim($url); |
332 | 332 | if ($url != '') { |
333 | - if ((!preg_match("/^http[s]*:\/\//i", $url)) && (!preg_match("/^ftp*:\/\//i", $url)) && (!preg_match("/^ed2k*:\/\//i", $url)) ) { | |
333 | + if ((!preg_match('/^http[s]*:\/\//i', $url)) && (!preg_match('/^ftp*:\/\//i', $url)) && (!preg_match('/^ed2k*:\/\//i', $url)) ) { | |
334 | 334 | $url = 'http://'.$url; |
335 | 335 | } |
336 | 336 | } |
@@ -404,7 +404,7 @@ function xoops_getbanner() | ||
404 | 404 | function redirect_header($url, $time = 3, $message = '', $addredirect = true) |
405 | 405 | { |
406 | 406 | global $xoopsConfig, $xoopsRequestUri; |
407 | - if (preg_match("/[\\0-\\31]/", $url) || preg_match("/^(javascript|vbscript|about):/i", $url)) { | |
407 | + if (preg_match('/[\\0-\\31]/', $url) || preg_match('/^(javascript|vbscript|about):/i', $url)) { | |
408 | 408 | $url = XOOPS_URL; |
409 | 409 | } |
410 | 410 | if (!defined('XOOPS_CPFUNC_LOADED')) { |
@@ -532,7 +532,7 @@ function xoops_getcss($theme = '') | ||
532 | 532 | $uagent = xoops_getenv('HTTP_USER_AGENT'); |
533 | 533 | if (stristr($uagent, 'mac')) { |
534 | 534 | $str_css = 'styleMAC.css'; |
535 | - } elseif (preg_match("/MSIE ([0-9]\.[0-9]{1,2})/i", $uagent)) { | |
535 | + } elseif (preg_match('/MSIE ([0-9]\.[0-9]{1,2})/i', $uagent)) { | |
536 | 536 | $str_css = 'style.css'; |
537 | 537 | } else { |
538 | 538 | $str_css = 'styleNN.css'; |
@@ -551,10 +551,10 @@ function &getMailer() | ||
551 | 551 | { |
552 | 552 | global $xoopsConfig; |
553 | 553 | $ret = null; |
554 | - require_once XOOPS_ROOT_PATH."/class/xoopsmailer.php"; | |
555 | - if ( file_exists(XOOPS_ROOT_PATH."/language/".$xoopsConfig['language']."/xoopsmailerlocal.php") ) { | |
556 | - require_once XOOPS_ROOT_PATH."/language/".$xoopsConfig['language']."/xoopsmailerlocal.php"; | |
557 | - if ( XC_CLASS_EXISTS("XoopsMailerLocal") ) { | |
554 | + require_once XOOPS_ROOT_PATH.'/class/xoopsmailer.php'; | |
555 | + if ( file_exists(XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/xoopsmailerlocal.php') ) { | |
556 | + require_once XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/xoopsmailerlocal.php'; | |
557 | + if ( XC_CLASS_EXISTS('XoopsMailerLocal') ) { | |
558 | 558 | $ret = new XoopsMailerLocal(); |
559 | 559 | return $ret; |
560 | 560 | } |
@@ -602,7 +602,7 @@ function &xoops_getmodulehandler($name = null, $module_dir = null, $optional = f | ||
602 | 602 | if (!isset($module_dir)) { |
603 | 603 | //if a module is loaded |
604 | 604 | if (is_object($GLOBALS['xoopsModule'])) { |
605 | - $module_dir = $GLOBALS['xoopsModule']->getVar('dirname'); | |
605 | + $module_dir = $GLOBALS['xoopsModule']->getVar('dirname', 'n'); | |
606 | 606 | } else { |
607 | 607 | trigger_error('No Module is loaded', E_USER_ERROR); |
608 | 608 | } |
@@ -646,9 +646,9 @@ function xoops_getrank($rank_id =0, $posts = 0) | ||
646 | 646 | $myts =& MyTextSanitizer::getInstance(); |
647 | 647 | $rank_id = (int)$rank_id; |
648 | 648 | if ($rank_id != 0) { |
649 | - $sql = "SELECT rank_title AS title, rank_image AS image, rank_id AS id FROM ".$db->prefix('ranks')." WHERE rank_id = ".$rank_id; | |
649 | + $sql = 'SELECT rank_title AS title, rank_image AS image, rank_id AS id FROM '.$db->prefix('ranks').' WHERE rank_id = '.$rank_id; | |
650 | 650 | } else { |
651 | - $sql = "SELECT rank_title AS title, rank_image AS image, rank_id AS id FROM ".$db->prefix('ranks')." WHERE rank_min <= ".$posts." AND rank_max >= ".$posts." AND rank_special = 0"; | |
651 | + $sql = 'SELECT rank_title AS title, rank_image AS image, rank_id AS id FROM '.$db->prefix('ranks').' WHERE rank_min <= '.$posts.' AND rank_max >= '.$posts.' AND rank_special = 0'; | |
652 | 652 | } |
653 | 653 | $rank = $db->fetchArray($db->query($sql)); |
654 | 654 | $rank['title'] = $myts->makeTboxData4Show($rank['title']); |
@@ -742,7 +742,7 @@ function xoops_comment_delete($module_id, $item_id) | ||
742 | 742 | for ($i = 0; $i < $count; $i++) { |
743 | 743 | if (false != $comment_handler->delete($comments[$i])) { |
744 | 744 | // store poster ID and deleted post number into array for later use |
745 | - $poster_id = $comments[$i]->getVar('com_uid'); | |
745 | + $poster_id = $comments[$i]->getVar('com_uid', 'n'); | |
746 | 746 | if ($poster_id != 0) { |
747 | 747 | $deleted_num[$poster_id] = !isset($deleted_num[$poster_id]) ? 1 : ($deleted_num[$poster_id] + 1); |
748 | 748 | } |
@@ -753,7 +753,7 @@ function xoops_comment_delete($module_id, $item_id) | ||
753 | 753 | // update user posts |
754 | 754 | $com_poster = $member_handler->getUser($user_id); |
755 | 755 | if (is_object($com_poster)) { |
756 | - $member_handler->updateUserByField($com_poster, 'posts', $com_poster->getVar('posts') - $post_num); | |
756 | + $member_handler->updateUserByField($com_poster, 'posts', $com_poster->getVar('posts', 'n') - $post_num); | |
757 | 757 | } |
758 | 758 | } |
759 | 759 | return true; |