当前位置: 首页>>代码示例>>PHP>>正文


PHP JUser::store方法代码示例

本文整理汇总了PHP中JUser::store方法的典型用法代码示例。如果您正苦于以下问题:PHP JUser::store方法的具体用法?PHP JUser::store怎么用?PHP JUser::store使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JUser的用法示例。


在下文中一共展示了JUser::store方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 /**
  * If table key (id) is NULL : inserts new rows
  * otherwise updates existing row in the database tables
  *
  * Can be overridden or overloaded by the child classes
  *
  * @param  boolean  $updateNulls  TRUE: null object variables are also updated, FALSE: not.
  * @return boolean                TRUE if successful otherwise FALSE
  */
 function store($updateNulls = false)
 {
     global $_CB_framework, $_CB_database, $ueConfig;
     $this->id = (int) $this->id;
     if (checkJversion() == 2) {
         $this->gids = is_array($this->gids) ? $this->gids : array($this->gid);
         $this->gid = (int) $_CB_framework->acl->getBackwardsCompatibleGid($this->gids);
     } else {
         $this->gid = (int) $this->gid;
         $this->gids = array($this->gid);
     }
     $isNew = $this->id == 0;
     $oldUsername = null;
     $oldGid = null;
     $oldGids = array();
     $oldBlock = null;
     if (!$isNew) {
         // get actual username to update sessions in case:
         $sql = 'SELECT ' . $_CB_database->NameQuote($this->_cmsUserTableUsername) . (checkJversion() < 2 ? ', ' . $_CB_database->NameQuote($this->_cmsUserTableGid) : null) . ', ' . $_CB_database->NameQuote('block') . ' FROM ' . $_CB_database->NameQuote($this->_cmsUserTable) . ' WHERE ' . $_CB_database->NameQuote($this->_cmsUserTableKey) . ' = ' . (int) $this->user_id;
         $_CB_database->setQuery($sql);
         $oldEntry = null;
         if ($_CB_database->loadObject($oldEntry)) {
             $oldUsername = $oldEntry->username;
             if (checkJversion() == 2) {
                 $gids = array_values((array) JFactory::getAcl()->getGroupsByUser($this->id, false));
                 foreach ($gids as $k => $v) {
                     $gids[$k] = (string) $v;
                 }
                 $oldGids = $gids;
                 $oldGid = (int) $_CB_framework->acl->getBackwardsCompatibleGid($oldGids);
             } else {
                 $oldGid = (int) $oldEntry->gid;
                 $oldGids = array($oldEntry->gid);
             }
             $oldBlock = $oldEntry->block;
         }
     }
     // insure usertype is in sync with gid:
     /*
      * This could be a better method:
     		if ( checkJversion() == 1 ) {
     			$gdataArray								=	$_CB_framework->acl->get_group_data( (int) $this->gid, 'ARO' );
     			if ( $gdataArray ) {
     				$this->usertype						=	$gdataArray[3];
     			} else {
     				user_error( sprintf( 'comprofilerUser::store: gacl:get_group_data: for user_id %d, name of group_id %d not found in acl groups table.', $this->id, $this->gid ), E_USER_WARNING );
     				$this->usertype						=	'Registered';
     			}
     		} else {
     			$this->usertype							=	$_CB_framework->acl->get_group_name( (int) $gid, 'ARO' );
     		}
     */
     if (checkJversion() == 2) {
         $this->usertype = null;
     } else {
         if (checkJversion() == 1) {
             $query = 'SELECT name' . "\n FROM #__core_acl_aro_groups" . "\n WHERE id = " . (int) $this->gid;
         } else {
             $query = 'SELECT name' . "\n FROM #__core_acl_aro_groups" . "\n WHERE group_id = " . (int) $this->gid;
         }
         $_CB_database->setQuery($query);
         $this->usertype = $_CB_database->loadResult();
     }
     if (!$isNew && $this->confirmed == 0 && $this->cbactivation == '' && $ueConfig['reg_confirmation'] != 0) {
         $this->_setActivationCode();
     }
     // creates CMS and CB objects:
     $this->_mapUsers();
     // remove the previous email set in bindSafely() and needed for checkSafely():
     unset($this->_original_email);
     // stores first into CMS to get id of user if new:
     if (is_callable(array($this->_cmsUser, 'store'))) {
         $result = $this->_cmsUser->store($updateNulls);
         if (!$result) {
             $this->_error = $this->_cmsUser->getError();
         }
     } else {
         if (checkJversion() == 2) {
             $this->_cmsUser->groups = $this->gids;
         }
         $result = $this->_cmsUser->save();
         // Joomla 1.5 native
         if (!$result) {
             $this->_error = $this->_cmsUser->getError();
             if (class_exists('JText')) {
                 $this->_error = JText::_($this->_error);
             }
         }
     }
     if ($result) {
         // synchronize id and user_id:
//.........这里部分代码省略.........
开发者ID:rogatnev-nikita,项目名称:cloudinterpreter,代码行数:101,代码来源:cb.tables.php


注:本文中的JUser::store方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。