• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

XOOPS Cube Legacy base repository


Commit MetaInfo

修訂8037be6a45736884c2ae624bde90c300242024b2 (tree)
時間2011-11-16 22:02:10
作者nbuy <nbuy@704c...>
Commiternbuy

Log Message

revise for speedup

git-svn-id: https://xoopscube.svn.sourceforge.net/svnroot/xoopscube/Package_Legacy/trunk@1050 704cf05f-ae62-4b0e-a484-234ee0250e75

Change Summary

差異

--- a/html/kernel/block.php
+++ b/html/kernel/block.php
@@ -172,34 +172,23 @@ class XoopsBlock extends XoopsObject
172172 if ( $this->getVar('block_type', 'N') != 'C' ) {
173173 // get block display function
174174 $show_func = $this->getVar('show_func', 'N');
175- if ( !$show_func ) {
176- return $ret;
177- }
175+ if ( !$show_func ) return $ret;
178176 // must get lang files b4 execution of the function
179177 if ( file_exists($path = XOOPS_ROOT_PATH.'/modules/'.($dirname = $this->getVar('dirname', 'N')).'/blocks/'.$this->getVar('func_file', 'N')) ) {
180178 $root=&XCube_Root::getSingleton();
181179 $root->mLanguageManager->loadBlockMessageCatalog($dirname);
182180
183181 require_once $path;
184- $options = explode('|', $this->getVar('options', 'N'));
185182 if ( function_exists($show_func) ) {
186183 // execute the function
187- $block = $show_func($options);
188- if ( !$block ) {
189- return $ret;
190- }
191- } else {
192- return $ret;
193- }
194- } else {
195- return $ret;
196- }
184+ $block = $show_func(explode('|', $this->getVar('options', 'N')));
185+ if ( !$block ) return $ret;
186+ } else return $ret;
187+ } else return $ret;
197188 } else {
198189 // it is a custom block, so just return the contents
199190 $block['content'] = $this->getContent('S',$this->getVar('c_type', 'N'));
200- if (empty($block['content'])) {
201- return $ret;
202- }
191+ if (empty($block['content'])) return $ret;
203192 }
204193 return $block;
205194 }
@@ -251,9 +240,9 @@ class XoopsBlock extends XoopsObject
251240 if (!$edit_func) {
252241 return false;
253242 }
254- if (file_exists($path = XOOPS_ROOT_PATH.'/modules/'.$this->getVar('dirname', 'N').'/blocks/'.$this->getVar('func_file', 'N'))) {
243+ if (file_exists($path = XOOPS_ROOT_PATH.'/modules/'.($dirname=$this->getVar('dirname', 'N')).'/blocks/'.$this->getVar('func_file', 'N'))) {
255244 $root =& XCube_Root::getSingleton();
256- $root->mLanguageManager->loadBlockMessageCatalog($this->getVar('dirname'));
245+ $root->mLanguageManager->loadBlockMessageCatalog($dirname);
257246
258247 include_once $path;
259248 $options = explode('|', $this->getVar('options', 'N'));
--- a/html/kernel/configitem.php
+++ b/html/kernel/configitem.php
@@ -144,7 +144,7 @@ class XoopsConfigItem extends XoopsObject
144144 */
145145 function &getConfValueForOutput()
146146 {
147- switch ($this->getVar('conf_valuetype', 'N')) {
147+ switch ($this->getVar('conf_valuetype')) {
148148 case 'int':
149149 $ret = (int)$this->getVar('conf_value', 'N');
150150 return $ret;
@@ -343,11 +343,12 @@ class XoopsConfigItemHandler extends XoopsObjectHandler
343343 $ret = false;
344344 $id = (int)$id;
345345 if ($id > 0) {
346- $sql = 'SELECT * FROM '.$this->db->prefix('config').' WHERE conf_id='.$id;
347- if ($result = $this->db->query($sql)) {
348- $numrows = $this->db->getRowsNum($result);
346+ $db = &$this->db;
347+ $sql = 'SELECT * FROM '.$db->prefix('config').' WHERE conf_id='.$id;
348+ if ($result = $db->query($sql)) {
349+ $numrows = $db->getRowsNum($result);
349350 if ($numrows == 1) {
350- $myrow = $this->db->fetchArray($result);
351+ $myrow = $db->fetchArray($result);
351352 $config =new XoopsConfigItem();
352353 $config->assignVars($myrow);
353354 $ret =& $config;
@@ -377,17 +378,18 @@ class XoopsConfigItemHandler extends XoopsObjectHandler
377378 foreach ($config->cleanVars as $k => $v) {
378379 ${$k} = $v;
379380 }
381+ $db = &$this->db;
380382 if ($config->isNew()) {
381- $conf_id = $this->db->genId('config_conf_id_seq');
382- $sql = sprintf("INSERT INTO %s (conf_id, conf_modid, conf_catid, conf_name, conf_title, conf_value, conf_desc, conf_formtype, conf_valuetype, conf_order) VALUES (%u, %u, %u, %s, %s, %s, %s, %s, %s, %u)", $this->db->prefix('config'), $conf_id, $conf_modid, $conf_catid, $this->db->quoteString($conf_name), $this->db->quoteString($conf_title), $this->db->quoteString($conf_value), $this->db->quoteString($conf_desc), $this->db->quoteString($conf_formtype), $this->db->quoteString($conf_valuetype), $conf_order);
383+ $conf_id = $db->genId('config_conf_id_seq');
384+ $sql = sprintf('INSERT INTO %s (conf_id, conf_modid, conf_catid, conf_name, conf_title, conf_value, conf_desc, conf_formtype, conf_valuetype, conf_order) VALUES (%u, %u, %u, %s, %s, %s, %s, %s, %s, %u)', $db->prefix('config'), $conf_id, $conf_modid, $conf_catid, $db->quoteString($conf_name), $db->quoteString($conf_title), $db->quoteString($conf_value), $db->quoteString($conf_desc), $db->quoteString($conf_formtype), $db->quoteString($conf_valuetype), $conf_order);
383385 } else {
384- $sql = sprintf("UPDATE %s SET conf_modid = %u, conf_catid = %u, conf_name = %s, conf_title = %s, conf_value = %s, conf_desc = %s, conf_formtype = %s, conf_valuetype = %s, conf_order = %u WHERE conf_id = %u", $this->db->prefix('config'), $conf_modid, $conf_catid, $this->db->quoteString($conf_name), $this->db->quoteString($conf_title), $this->db->quoteString($conf_value), $this->db->quoteString($conf_desc), $this->db->quoteString($conf_formtype), $this->db->quoteString($conf_valuetype), $conf_order, $conf_id);
386+ $sql = sprintf('UPDATE %s SET conf_modid = %u, conf_catid = %u, conf_name = %s, conf_title = %s, conf_value = %s, conf_desc = %s, conf_formtype = %s, conf_valuetype = %s, conf_order = %u WHERE conf_id = %u', $db->prefix('config'), $conf_modid, $conf_catid, $db->quoteString($conf_name), $db->quoteString($conf_title), $db->quoteString($conf_value), $db->quoteString($conf_desc), $db->quoteString($conf_formtype), $db->quoteString($conf_valuetype), $conf_order, $conf_id);
385387 }
386- if (!$result = $this->db->query($sql)) {
388+ if (!$result = $db->query($sql)) {
387389 return false;
388390 }
389391 if (empty($conf_id)) {
390- $conf_id = $this->db->getInsertId();
392+ $conf_id = $db->getInsertId();
391393 }
392394 $config->assignVar('conf_id', $conf_id);
393395 return true;
@@ -404,7 +406,7 @@ class XoopsConfigItemHandler extends XoopsObjectHandler
404406 if (strtolower(get_class($config)) != 'xoopsconfigitem') {
405407 return false;
406408 }
407- $sql = sprintf("DELETE FROM %s WHERE conf_id = %u", $this->db->prefix('config'), $config->getVar('conf_id'));
409+ $sql = sprintf('DELETE FROM %s WHERE conf_id = %u', $this->db->prefix('config'), $config->getVar('conf_id'));
408410 if (!$result = $this->db->query($sql)) {
409411 return false;
410412 }
@@ -456,15 +458,16 @@ class XoopsConfigItemHandler extends XoopsObjectHandler
456458 function getCount($criteria = null)
457459 {
458460 $limit = $start = 0;
459- $sql = 'SELECT * FROM '.$this->db->prefix('config');
461+ $db = &$this->db;
462+ $sql = 'SELECT * FROM '.$db->prefix('config');
460463 if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
461464 $sql .= ' '.$criteria->renderWhere();
462465 }
463- $result =& $this->db->query($sql);
466+ $result = $db->query($sql);
464467 if (!$result) {
465468 return false;
466469 }
467- list($count) = $this->db->fetchRow($result);
470+ list($count) = $db->fetchRow($result);
468471 return $count;
469472 }
470473 }
--- a/html/kernel/configoption.php
+++ b/html/kernel/configoption.php
@@ -180,9 +180,9 @@ class XoopsConfigOptionHandler extends XoopsObjectHandler
180180 }
181181 if ($confoption->isNew()) {
182182 $confop_id = $this->db->genId('configoption_confop_id_seq');
183- $sql = sprintf("INSERT INTO %s (confop_id, confop_name, confop_value, conf_id) VALUES (%u, %s, %s, %u)", $this->db->prefix('configoption'), $confop_id, $this->db->quoteString($confop_name), $this->db->quoteString($confop_value), $conf_id);
183+ $sql = sprintf('INSERT INTO %s (confop_id, confop_name, confop_value, conf_id) VALUES (%u, %s, %s, %u)', $this->db->prefix('configoption'), $confop_id, $this->db->quoteString($confop_name), $this->db->quoteString($confop_value), $conf_id);
184184 } else {
185- $sql = sprintf("UPDATE %s SET confop_name = %s, confop_value = %s WHERE confop_id = %u", $this->db->prefix('configoption'), $this->db->quoteString($confop_name), $this->db->quoteString($confop_value), $confop_id);
185+ $sql = sprintf('UPDATE %s SET confop_name = %s, confop_value = %s WHERE confop_id = %u', $this->db->prefix('configoption'), $this->db->quoteString($confop_name), $this->db->quoteString($confop_value), $confop_id);
186186 }
187187 if (!$result = $this->db->query($sql)) {
188188 return false;
@@ -205,7 +205,7 @@ class XoopsConfigOptionHandler extends XoopsObjectHandler
205205 if (strtolower(get_class($confoption)) != 'xoopsconfigoption') {
206206 return false;
207207 }
208- $sql = sprintf("DELETE FROM %s WHERE confop_id = %u", $this->db->prefix('configoption'), $confoption->getVar('confop_id'));
208+ $sql = sprintf('DELETE FROM %s WHERE confop_id = %u', $this->db->prefix('configoption'), $confoption->getVar('confop_id', 'n'));
209209 if (!$result = $this->db->query($sql)) {
210210 return false;
211211 }
--- a/html/kernel/group.php
+++ b/html/kernel/group.php
@@ -104,12 +104,13 @@ class XoopsGroupHandler extends XoopsObjectHandler
104104 {
105105 $ret = false;
106106 if ((int)$id > 0) {
107- $sql = 'SELECT * FROM '.$this->db->prefix('groups').' WHERE groupid='.$id;
108- if ($result = $this->db->query($sql)) {
109- $numrows = $this->db->getRowsNum($result);
107+ $db = &$this->db;
108+ $sql = 'SELECT * FROM '.$db->prefix('groups').' WHERE groupid='.$id;
109+ if ($result = $db->query($sql)) {
110+ $numrows = $db->getRowsNum($result);
110111 if ($numrows == 1) {
111112 $group = new XoopsGroup();
112- $group->assignVars($this->db->fetchArray($result));
113+ $group->assignVars($db->fetchArray($result));
113114 $ret =& $group;
114115 }
115116 }
@@ -137,18 +138,15 @@ class XoopsGroupHandler extends XoopsObjectHandler
137138 foreach ($group->cleanVars as $k => $v) {
138139 ${$k} = $v;
139140 }
141+ $db = &$this->db;
140142 if ($group->isNew()) {
141- $groupid = $this->db->genId('group_groupid_seq');
142- $sql = sprintf("INSERT INTO %s (groupid, name, description, group_type) VALUES (%u, %s, %s, %s)", $this->db->prefix('groups'), $groupid, $this->db->quoteString($name), $this->db->quoteString($description), $this->db->quoteString($group_type));
143+ $groupid = $db->genId('group_groupid_seq');
144+ $sql = sprintf('INSERT INTO %s (groupid, name, description, group_type) VALUES (%u, %s, %s, %s)', $db->prefix('groups'), $groupid, $db->quoteString($name), $db->quoteString($description), $db->quoteString($group_type));
143145 } else {
144- $sql = sprintf("UPDATE %s SET name = %s, description = %s, group_type = %s WHERE groupid = %u", $this->db->prefix('groups'), $this->db->quoteString($name), $this->db->quoteString($description), $this->db->quoteString($group_type), $groupid);
145- }
146- if (!$result = $this->db->query($sql)) {
147- return false;
148- }
149- if (empty($groupid)) {
150- $groupid = $this->db->getInsertId();
146+ $sql = sprintf("UPDATE %s SET name = %s, description = %s, group_type = %s WHERE groupid = %u", $db->prefix('groups'), $db->quoteString($name), $db->quoteString($description), $db->quoteString($group_type), $groupid);
151147 }
148+ if (!$result = $db->query($sql)) return false;
149+ if (empty($groupid)) $groupid = $db->getInsertId();
152150 $group->assignVar('groupid', $groupid);
153151 return true;
154152 }
@@ -161,10 +159,8 @@ class XoopsGroupHandler extends XoopsObjectHandler
161159 */
162160 function delete(&$group)
163161 {
164- if (strtolower(get_class($group)) != 'xoopsgroup') {
165- return false;
166- }
167- $sql = sprintf("DELETE FROM %s WHERE groupid = %u", $this->db->prefix('groups'), $group->getVar('groupid'));
162+ if (strtolower(get_class($group)) != 'xoopsgroup') return false;
163+ $sql = sprintf('DELETE FROM %s WHERE groupid = %u', $this->db->prefix('groups'), $group->getVar('groupid'));
168164 if (!$result = $this->db->query($sql)) {
169165 return false;
170166 }
@@ -182,17 +178,18 @@ class XoopsGroupHandler extends XoopsObjectHandler
182178 {
183179 $ret = array();
184180 $limit = $start = 0;
185- $sql = 'SELECT * FROM '.$this->db->prefix('groups');
181+ $db = &$this->db;
182+ $sql = 'SELECT * FROM '.$db->prefix('groups');
186183 if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
187184 $sql .= ' '.$criteria->renderWhere();
188185 $limit = $criteria->getLimit();
189186 $start = $criteria->getStart();
190187 }
191- $result = $this->db->query($sql, $limit, $start);
188+ $result = $db->query($sql, $limit, $start);
192189 if (!$result) {
193190 return $ret;
194191 }
195- while ($myrow = $this->db->fetchArray($result)) {
192+ while ($myrow = $db->fetchArray($result)) {
196193 $group =new XoopsGroup();
197194 $group->assignVars($myrow);
198195 if (!$id_as_key) {
@@ -265,12 +262,13 @@ class XoopsMembershipHandler extends XoopsObjectHandler
265262 {
266263 $ret = false;
267264 if ((int)$id > 0) {
268- $sql = 'SELECT * FROM '.$this->db->prefix('groups_users_link').' WHERE linkid='.$id;
269- if ($result = $this->db->query($sql)) {
270- $numrows = $this->db->getRowsNum($result);
265+ $db = &$this->db;
266+ $sql = 'SELECT * FROM '.$db->prefix('groups_users_link').' WHERE linkid='.$id;
267+ if ($result = $db->query($sql)) {
268+ $numrows = $db->getRowsNum($result);
271269 if ($numrows == 1) {
272270 $mship =new XoopsMembership();
273- $mship->assignVars($this->db->fetchArray($result));
271+ $mship->assignVars($db->fetchArray($result));
274272 $ret =& $mship;
275273 }
276274 }
@@ -298,18 +296,15 @@ class XoopsMembershipHandler extends XoopsObjectHandler
298296 foreach ($mship->cleanVars as $k => $v) {
299297 ${$k} = $v;
300298 }
299+ $db = &$this->db;
301300 if ($mship->isNew()) {
302- $linkid = $this->db->genId('groups_users_link_linkid_seq');
303- $sql = sprintf("INSERT INTO %s (linkid, groupid, uid) VALUES (%u, %u, %u)", $this->db->prefix('groups_users_link'), $linkid, $groupid, $uid);
301+ $linkid = $db->genId('groups_users_link_linkid_seq');
302+ $sql = sprintf("INSERT INTO %s (linkid, groupid, uid) VALUES (%u, %u, %u)", $db->prefix('groups_users_link'), $linkid, $groupid, $uid);
304303 } else {
305- $sql = sprintf("UPDATE %s SET groupid = %u, uid = %u WHERE linkid = %u", $this->db->prefix('groups_users_link'), $groupid, $uid, $linkid);
306- }
307- if (!$result = $this->db->query($sql)) {
308- return false;
309- }
310- if (empty($linkid)) {
311- $linkid = $this->db->getInsertId();
304+ $sql = sprintf("UPDATE %s SET groupid = %u, uid = %u WHERE linkid = %u", $db->prefix('groups_users_link'), $groupid, $uid, $linkid);
312305 }
306+ if (!$result = $db->query($sql)) return false;
307+ if (empty($linkid)) $linkid = $this->db->getInsertId();
313308 $mship->assignVar('linkid', $linkid);
314309 return true;
315310 }
@@ -325,10 +320,8 @@ class XoopsMembershipHandler extends XoopsObjectHandler
325320 if (strtolower(get_class($mship)) != 'xoopsmembership') {
326321 return false;
327322 }
328- $sql = sprintf("DELETE FROM %s WHERE linkid = %u", $this->db->prefix('groups_users_link'), $groupm->getVar('linkid'));
329- if (!$result = $this->db->query($sql)) {
330- return false;
331- }
323+ $sql = sprintf('DELETE FROM %s WHERE linkid = %u', $this->db->prefix('groups_users_link'), $groupm->getVar('linkid'));
324+ if (!$result = $this->db->query($sql)) return false;
332325 return true;
333326 }
334327
@@ -343,17 +336,18 @@ class XoopsMembershipHandler extends XoopsObjectHandler
343336 {
344337 $ret = array();
345338 $limit = $start = 0;
346- $sql = 'SELECT * FROM '.$this->db->prefix('groups_users_link');
339+ $db = &$this->db;
340+ $sql = 'SELECT * FROM '.$db->prefix('groups_users_link');
347341 if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
348342 $sql .= ' '.$criteria->renderWhere();
349343 $limit = $criteria->getLimit();
350344 $start = $criteria->getStart();
351345 }
352- $result = $this->db->query($sql, $limit, $start);
346+ $result = $db->query($sql, $limit, $start);
353347 if (!$result) {
354348 return $ret;
355349 }
356- while ($myrow = $this->db->fetchArray($result)) {
350+ while ($myrow = $db->fetchArray($result)) {
357351 $mship = new XoopsMembership();
358352 $mship->assignVars($myrow);
359353 if (!$id_as_key) {
@@ -374,15 +368,16 @@ class XoopsMembershipHandler extends XoopsObjectHandler
374368 */
375369 function getCount($criteria = null)
376370 {
377- $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('groups_users_link');
371+ $db = &$this->db;
372+ $sql = 'SELECT COUNT(*) FROM '.$db->prefix('groups_users_link');
378373 if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
379374 $sql .= ' '.$criteria->renderWhere();
380375 }
381- $result = $this->db->query($sql);
376+ $result = $db->query($sql);
382377 if (!$result) {
383378 return 0;
384379 }
385- list($count) = $this->db->fetchRow($result);
380+ list($count) = $db->fetchRow($result);
386381 return $count;
387382 }
388383
@@ -398,9 +393,7 @@ class XoopsMembershipHandler extends XoopsObjectHandler
398393 if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
399394 $sql .= ' '.$criteria->renderWhere();
400395 }
401- if (!$result = $this->db->query($sql)) {
402- return false;
403- }
396+ if (!$result = $this->db->query($sql)) return false;
404397 return true;
405398 }
406399
@@ -415,13 +408,12 @@ class XoopsMembershipHandler extends XoopsObjectHandler
415408 function &getGroupsByUser($uid)
416409 {
417410 $ret = array();
418- $sql = 'SELECT groupid FROM '.$this->db->prefix('groups_users_link').' WHERE uid='.(int)$uid;
419- $result = $this->db->query($sql);
420- if (!$result) {
421- return $ret;
422- }
423- while ($myrow = $this->db->fetchArray($result)) {
424- $ret[] = $myrow['groupid'];
411+ $db = &$this->db;
412+ $sql = 'SELECT groupid FROM '.$db->prefix('groups_users_link').' WHERE uid='.(int)$uid;
413+ $result = $db->query($sql);
414+ if (!$result) return $ret;
415+ while (list($groupid) = $db->fetchRow($result)) {
416+ $ret[] = $groupid;
425417 }
426418 return $ret;
427419 }
@@ -439,14 +431,13 @@ class XoopsMembershipHandler extends XoopsObjectHandler
439431 function &getUsersByGroup($groupid, $limit=0, $start=0)
440432 {
441433 $ret = array();
442- $sql = 'SELECT uid FROM ' . $this->db->prefix('groups_users_link') . ' WHERE groupid='.(int)$groupid;
434+ $db = &$this->db;
435+ $sql = 'SELECT uid FROM ' . $db->prefix('groups_users_link') . ' WHERE groupid='.(int)$groupid;
443436
444- $result = $this->db->query($sql, $limit, $start);
445- if (!$result) {
446- return $ret;
447- }
448- while ($myrow = $this->db->fetchArray($result)) {
449- $ret[] = $myrow['uid'];
437+ $result = $db->query($sql, $limit, $start);
438+ if (!$result) return $ret;
439+ while (list($uid) = $db->fetchRow($result)) {
440+ $ret[] = $uid;
450441 }
451442 return $ret;
452443 }
@@ -459,8 +450,9 @@ class XoopsMembershipHandler extends XoopsObjectHandler
459450 $ret = array();
460451
461452 $groupid = (int)$groupid;
462- $usersTable = $this->db->prefix('users');
463- $linkTable = $this->db->prefix('groups_users_link');
453+ $db = &$this->db;
454+ $usersTable = $db->prefix('users');
455+ $linkTable = $db->prefix('groups_users_link');
464456
465457 $sql = "SELECT u.uid FROM ${usersTable} u LEFT JOIN ${linkTable} g ON u.uid=g.uid," .
466458 "${usersTable} u2 LEFT JOIN ${linkTable} g2 ON u2.uid=g2.uid AND g2.groupid=${groupid} " .
@@ -468,12 +460,10 @@ class XoopsMembershipHandler extends XoopsObjectHandler
468460 "AND (g2.groupid = ${groupid} OR g2.groupid IS NULL) " .
469461 "AND u.uid = u2.uid AND g2.uid IS NULL GROUP BY u.uid";
470462
471- $result = $this->db->query($sql, $limit, $start);
472- if (!$result) {
473- return $ret;
474- }
475- while ($myrow = $this->db->fetchArray($result)) {
476- $ret[] = $myrow['uid'];
463+ $result = $db->query($sql, $limit, $start);
464+ if (!$result) return $ret;
465+ while (list($uid) = $db->fetchRow($result)) {
466+ $ret[] = $uid;
477467 }
478468 return $ret;
479469 }
--- a/html/kernel/groupperm.php
+++ b/html/kernel/groupperm.php
@@ -165,12 +165,13 @@ class XoopsGroupPermHandler extends XoopsObjectHandler
165165 {
166166 $ret = false;
167167 if ((int)$id > 0) {
168- $sql = sprintf("SELECT * FROM %s WHERE gperm_id = %u", $this->db->prefix('group_permission'), $id);
169- if ($result = $this->db->query($sql)) {
170- $numrows = $this->db->getRowsNum($result);
168+ $db = &$this->db;
169+ $sql = sprintf('SELECT * FROM %s WHERE gperm_id = %u', $db->prefix('group_permission'), $id);
170+ if ($result = $db->query($sql)) {
171+ $numrows = $db->getRowsNum($result);
171172 if ( $numrows == 1 ) {
172173 $perm =new XoopsGroupPerm();
173- $perm->assignVars($this->db->fetchArray($result));
174+ $perm->assignVars($db->fetchArray($result));
174175 $ret =& $perm;
175176 }
176177 }
@@ -200,18 +201,15 @@ class XoopsGroupPermHandler extends XoopsObjectHandler
200201 foreach ($perm->cleanVars as $k => $v) {
201202 ${$k} = $v;
202203 }
204+ $db = &$this->db;
203205 if ($perm->isNew()) {
204- $gperm_id = $this->db->genId('group_permission_gperm_id_seq');
205- $sql = sprintf("INSERT INTO %s (gperm_id, gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES (%u, %u, %u, %u, %s)", $this->db->prefix('group_permission'), $gperm_id, $gperm_groupid, $gperm_itemid, $gperm_modid, $this->db->quoteString($gperm_name));
206+ $gperm_id = $db->genId('group_permission_gperm_id_seq');
207+ $sql = sprintf('INSERT INTO %s (gperm_id, gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES (%u, %u, %u, %u, %s)', $db->prefix('group_permission'), $gperm_id, $gperm_groupid, $gperm_itemid, $gperm_modid, $db->quoteString($gperm_name));
206208 } else {
207- $sql = sprintf("UPDATE %s SET gperm_groupid = %u, gperm_itemid = %u, gperm_modid = %u WHERE gperm_id = %u", $this->db->prefix('group_permission'), $gperm_groupid, $gperm_itemid, $gperm_modid, $gperm_id);
208- }
209- if (!$result = $this->db->query($sql)) {
210- return false;
211- }
212- if (empty($gperm_id)) {
213- $gperm_id = $this->db->getInsertId();
209+ $sql = sprintf('UPDATE %s SET gperm_groupid = %u, gperm_itemid = %u, gperm_modid = %u WHERE gperm_id = %u', $db->prefix('group_permission'), $gperm_groupid, $gperm_itemid, $gperm_modid, $gperm_id);
214210 }
211+ if (!$result = $db->query($sql)) return false;
212+ if (empty($gperm_id)) $gperm_id = $this->db->getInsertId();
215213 $perm->assignVar('gperm_id', $gperm_id);
216214 return true;
217215 }
@@ -247,17 +245,18 @@ class XoopsGroupPermHandler extends XoopsObjectHandler
247245 {
248246 $ret = array();
249247 $limit = $start = 0;
250- $sql = 'SELECT * FROM '.$this->db->prefix('group_permission');
248+ $db = &$this->db;
249+ $sql = 'SELECT * FROM '.$db->prefix('group_permission');
251250 if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
252251 $sql .= ' '.$criteria->renderWhere();
253252 $limit = $criteria->getLimit();
254253 $start = $criteria->getStart();
255254 }
256- $result = $this->db->query($sql, $limit, $start);
255+ $result = $db->query($sql, $limit, $start);
257256 if (!$result) {
258257 return $ret;
259258 }
260- while ($myrow = $this->db->fetchArray($result)) {
259+ while ($myrow = $db->fetchArray($result)) {
261260 $perm =new XoopsGroupPerm();
262261 $perm->assignVars($myrow);
263262 if (!$id_as_key) {
@@ -279,15 +278,16 @@ class XoopsGroupPermHandler extends XoopsObjectHandler
279278 */
280279 function getCount($criteria = null)
281280 {
282- $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('group_permission');
281+ $db = &$this->db;
282+ $sql = 'SELECT COUNT(*) FROM '.$db->prefix('group_permission');
283283 if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
284284 $sql .= ' '.$criteria->renderWhere();
285285 }
286- $result = $this->db->query($sql);
286+ $result = $db->query($sql);
287287 if (!$result) {
288288 return 0;
289289 }
290- list($count) = $this->db->fetchRow($result);
290+ list($count) = $db->fetchRow($result);
291291 return $count;
292292 }
293293
--- a/html/kernel/user.php
+++ b/html/kernel/user.php
@@ -151,11 +151,10 @@ class XoopsUser extends XoopsObject
151151 $member_handler =& xoops_gethandler('member');
152152 $user =& $member_handler->getUser($userid);
153153 if (is_object($user)) {
154- $ts =& MyTextSanitizer::getInstance();
155154 if ( $usereal ) {
156- return $ts->htmlSpecialChars($user->getVar('name'));
155+ return $user->getVar('name');
157156 } else {
158- return $ts->htmlSpecialChars($user->getVar('uname'));
157+ return $user->getVar('uname');
159158 }
160159 }
161160 }
@@ -270,7 +269,7 @@ class XoopsUser extends XoopsObject
270269 {
271270 if (!isset($this->_isOnline)) {
272271 $onlinehandler =& xoops_gethandler('online');
273- $this->_isOnline = ($onlinehandler->getCount(new Criteria('online_uid', $this->getVar('uid'))) > 0) ? true : false;
272+ $this->_isOnline = ($onlinehandler->getCount(new Criteria('online_uid', $this->getVar('uid', 'N'))) > 0) ? true : false;
274273 }
275274 return $this->_isOnline;
276275 }
@@ -288,7 +287,7 @@ class XoopsUser extends XoopsObject
288287 */
289288 function uid()
290289 {
291- return $this->getVar("uid");
290+ return $this->getVar('uid');
292291 }
293292
294293 /**