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


PHP UserUtil::getUserProfile方法代码示例

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


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

示例1: updateSession

 public function updateSession()
 {
     static $updated = false;
     if (!$updated) {
         $global = Ibos::app()->setting->toArray();
         if (!Ibos::app()->user->isGuest) {
             if (isset($global["cookie"]["ulastactivity"])) {
                 $userLastActivity = StringUtil::authCode($global["cookie"]["ulastactivity"], "DECODE");
             } else {
                 $userLastActivity = UserUtil::getUserProfile("lastactivity");
                 MainUtil::setCookie("ulastactivity", StringUtil::authCode($userLastActivity, "ENCODE"), 31536000);
             }
         }
         $onlineTimeSpan = 10;
         $lastOnlineUpdate = $this->var["lastolupdate"];
         $onlineTimeOffset = $lastOnlineUpdate ? $lastOnlineUpdate : $userLastActivity;
         $allowUpdateOnlineTime = $onlineTimeSpan * 60 < TIMESTAMP - $onlineTimeOffset;
         if (!Ibos::app()->user->isGuest && $allowUpdateOnlineTime) {
             $updateStatus = OnlineTime::model()->updateOnlineTime(Ibos::app()->user->uid, $onlineTimeSpan, $onlineTimeSpan, TIMESTAMP);
             if ($updateStatus === false) {
                 $onlineTime = new OnlineTime();
                 $onlineTime->uid = Ibos::app()->user->uid;
                 $onlineTime->thismonth = $onlineTimeSpan;
                 $onlineTime->total = $onlineTimeSpan;
                 $onlineTime->lastupdate = $global["timestamp"];
                 $onlineTime->save();
             }
             $this->setKey("lastolupdate", TIMESTAMP);
         }
         $this->var["invisible"] = UserUtil::getUserProfile("invisible");
         foreach ($this->var as $key => $value) {
             if (Ibos::app()->user->hasState($key) && $key != "lastactivity") {
                 $this->setKey($key, Ibos::app()->user->{$key});
             }
         }
         Ibos::app()->session->update();
         if (!Ibos::app()->user->isGuest) {
             $updateStatusField = array("lastip" => $global["clientip"], "lastactivity" => TIMESTAMP, "lastvisit" => TIMESTAMP, "invisible" => 1);
             if (21600 < TIMESTAMP - $userLastActivity) {
                 if ($onlineTimeSpan && 43200 < TIMESTAMP - $userLastActivity) {
                     $onlineTime = OnlineTime::model()->fetchByPk(Ibos::app()->user->uid);
                     UserCount::model()->updateByPk(Ibos::app()->user->uid, array("oltime" => round(intval($onlineTime["total"]) / 60)));
                 }
                 MainUtil::setCookie("ulastactivity", StringUtil::authCode(TIMESTAMP, "ENCODE"), 31536000);
                 UserStatus::model()->updateByPk(Ibos::app()->user->uid, $updateStatusField);
             }
         }
         $updated = true;
     }
     return $updated;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:51,代码来源:ICSession.php

示例2: updateUserCount

 public function updateUserCount($creditArr, $uids = 0, $checkGroup = true, $ruletxt = "")
 {
     if (Ibos::app()->user->isGuest) {
         return null;
     }
     $setting = Ibos::app()->setting->toArray();
     if (!$uids) {
         $uids = intval(Ibos::app()->user->uid);
     }
     $uids = is_array($uids) ? $uids : array($uids);
     if ($uids && ($creditArr || $this->_extraSql)) {
         if ($this->_extraSql) {
             $creditArr = array_merge($creditArr, $this->_extraSql);
         }
         $sql = array();
         $allowkey = array("extcredits1", "extcredits2", "extcredits3", "extcredits4", "extcredits5", "oltime", "attachsize");
         $creditRemind = $setting["setting"]["creditremind"] && Ibos::app()->user->uid && $uids == array(Ibos::app()->user->uid);
         if ($creditRemind) {
             if (!isset($setting["cookiecredits"])) {
                 $setting["cookiecredits"] = !empty($_COOKIE["creditnotice"]) ? explode("D", $_COOKIE["creditremind"]) : array_fill(0, 6, 0);
                 for ($i = 1; $i <= 5; $i++) {
                     $setting["cookiecreditsbase"][$i] = UserUtil::getUserProfile("extcredits" . $i);
                 }
             }
             if ($ruletxt) {
                 $setting["cookiecreditsrule"][$ruletxt] = $ruletxt;
             }
         }
         foreach ($creditArr as $key => $value) {
             if (!empty($key) && $value && in_array($key, $allowkey)) {
                 $sql[$key] = $value;
                 if ($creditRemind && substr($key, 0, 10) == "extcredits") {
                     $i = substr($key, 10);
                     $setting["cookiecredits"][$i] += $value;
                 }
             }
         }
         if ($creditRemind) {
             MainUtil::setCookie("creditremind", implode("D", $setting["cookiecredits"]) . "D" . Ibos::app()->user->uid);
             MainUtil::setCookie("creditbase", "0D" . implode("D", $setting["cookiecreditsbase"]));
             if (!empty($setting["cookiecreditsrule"])) {
                 MainUtil::setCookie("creditrule", strip_tags(implode("\t", $setting["cookiecreditsrule"])));
             }
         }
         Ibos::app()->setting->copyFrom($setting);
         if ($sql) {
             UserCount::model()->increase($uids, $sql);
         }
         if ($checkGroup && count($uids) == 1) {
             $this->checkUserGroup($uids[0]);
         }
         $this->setExtraSql(array());
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:54,代码来源:CreditUtil.php


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