本文整理汇总了PHP中UserUtil::cleanCache方法的典型用法代码示例。如果您正苦于以下问题:PHP UserUtil::cleanCache方法的具体用法?PHP UserUtil::cleanCache怎么用?PHP UserUtil::cleanCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserUtil
的用法示例。
在下文中一共展示了UserUtil::cleanCache方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionUpdate
public function actionUpdate()
{
$profileField = array("birthday", "bio", "telephone", "address", "qq");
$userField = array("mobile", "email");
$model = array();
foreach ($_POST as $key => $value) {
if (in_array($key, $profileField)) {
if ($key == "birthday" && !empty($value)) {
$value = strtotime($value);
}
$model["UserProfile"][$key] = StringUtil::filterCleanHtml($value);
} elseif (in_array($key, $userField)) {
$model["User"][$key] = StringUtil::filterCleanHtml($value);
}
}
foreach ($model as $modelObject => $value) {
$modelObject::model()->modify(Yii::app()->user->uid, $value);
}
UserUtil::cleanCache(Yii::app()->user->uid);
exit;
}
示例2: checkUserGroup
public function checkUserGroup($uid)
{
$uid = intval($uid);
$user = User::model()->fetchByUid($uid);
if (empty($user)) {
return 0;
}
$credits = $this->countCredit($uid, false);
$updateArray = array();
$groupId = $user["groupid"];
if (0 < $user["groupid"]) {
$group = UserGroup::model()->fetchByPk($user["groupid"]);
} else {
$group = array();
}
if ($user["credits"] != $credits) {
$updateArray["credits"] = $credits;
$user["credits"] = $credits;
}
$user["credits"] = $user["credits"] == "" ? 0 : $user["credits"];
$sendNotify = false;
if (empty($group) || !($group["creditshigher"] <= $user["credits"]) && $user["credits"] < $group["creditslower"]) {
$newGroup = UserGroup::model()->fetchByCredits($user["credits"]);
if (!empty($newGroup)) {
if ($user["groupid"] != $newGroup["gid"]) {
$updateArray["groupid"] = $groupId = $newGroup["gid"];
$sendNotify = true;
}
}
}
if ($updateArray) {
User::model()->modify($uid, $updateArray);
UserUtil::cleanCache($uid);
}
if ($sendNotify) {
Notify::model()->sendNotify($uid, "user_group_upgrade", array("{groupname}" => $newGroup["title"], "{url}" => Ibos::app()->urlManager->createUrl("user/home/credit", array("op" => "level", "uid" => $uid))));
}
return $groupId;
}
示例3: actionPersonal
public function actionPersonal()
{
$op = EnvUtil::getRequest("op");
if (!in_array($op, array("profile", "avatar", "history", "password", "skin", "remind"))) {
$op = "profile";
}
if (EnvUtil::submitCheck("userSubmit")) {
if (!$this->getIsMe()) {
throw new EnvException(Ibos::lang("Parameters error", "error"));
}
$data = $_POST;
if ($op == "profile") {
$profileField = array("birthday", "bio", "telephone", "address", "qq");
$userField = array("mobile", "email");
$model = array();
foreach ($_POST as $key => $value) {
if (in_array($key, $profileField)) {
if ($key == "birthday" && !empty($value)) {
$value = strtotime($value);
}
$model["UserProfile"][$key] = StringUtil::filterCleanHtml($value);
} elseif (in_array($key, $userField)) {
$model["User"][$key] = StringUtil::filterCleanHtml($value);
}
}
foreach ($model as $modelObject => $value) {
$modelObject::model()->modify($this->getUid(), $value);
}
} elseif ($op == "password") {
$user = $this->getUser();
$update = false;
if ($data["originalpass"] == "") {
$this->error(Ibos::lang("Original password require"));
} elseif (strcasecmp(md5(md5($data["originalpass"]) . $user["salt"]), $user["password"]) !== 0) {
$this->error(Ibos::lang("Password is not correct"));
} else {
if (!empty($data["newpass"]) && strcasecmp($data["newpass"], $data["newpass_confirm"]) !== 0) {
$this->error(Ibos::lang("Confirm password is not correct"));
} else {
$password = md5(md5($data["newpass"]) . $user["salt"]);
$update = User::model()->updateByUid($this->getUid(), array("password" => $password, "lastchangepass" => TIMESTAMP));
}
}
} elseif ($op == "remind") {
$remindSetting = array();
foreach (array("email", "sms", "app") as $field) {
if (!empty($data[$field])) {
foreach ($data[$field] as $id => $value) {
$remindSetting[$id][$field] = $value;
}
}
}
if (!empty($remindSetting)) {
$remindSetting = serialize($remindSetting);
} else {
$remindSetting = "";
}
UserProfile::model()->updateByPk($this->getUid(), array("remindsetting" => $remindSetting));
}
UserUtil::cleanCache($this->getUid());
$this->success(Ibos::lang("Save succeed", "message"), $this->createUrl("home/personal", array("op" => $op)));
} else {
if (in_array($op, array("avatar", "history", "password", "remind"))) {
if (!$this->getIsMe()) {
$this->error(Ibos::lang("Parameters error", "error"), $this->createUrl("home/index"));
}
}
$dataProvider = "get" . ucfirst($op);
$data = array("user" => $this->getUser());
if (method_exists($this, $dataProvider)) {
$data = array_merge($data, $this->{$dataProvider}());
}
$data["op"] = $op;
$this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Home"), "url" => $this->createUrl("home/index")), array("name" => Ibos::lang("Profile"))));
$this->render($op, $data);
}
}