本文整理汇总了PHP中UserData::readUser方法的典型用法代码示例。如果您正苦于以下问题:PHP UserData::readUser方法的具体用法?PHP UserData::readUser怎么用?PHP UserData::readUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserData
的用法示例。
在下文中一共展示了UserData::readUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
} elseif ($srkEnv->reqURLLength == 2 && $srkEnv->reqURL[2] == 'github') {
require_once $srkEnv->appPath . '/modules/thirdpartylogin/github.php';
$loginRes = GithubLogin::fetchInfo();
if ($loginRes) {
srkRender('error', array('error' => array('status' => -1, 'stack' => $loginRes)));
} else {
header("Location: /");
}
} elseif ($srkEnv->reqURLLength >= 2 && $srkEnv->reqURL[2] == 'query') {
if ($srkEnv->reqURLLength == 3 && $srkEnv->reqURL[3] == 'whoami') {
$userId = $_SESSION['userId'];
if (!isset($userId)) {
srkSend((object) array('error' => 'not logged in'));
} else {
srkSend((object) array('userId' => $userId));
}
} elseif ($srkEnv->reqURLLength == 4 && $srkEnv->reqURL[4] == 'avatarurl') {
$user = new UserData();
$user->readUser($srkEnv->reqURL[3]);
if ($user->getField('source') == 'local') {
$resURL = 'http://cn.gravatar.com/avatar/' . md5($user->getField('email')) . '?s=100&d=mm&r=g';
} else {
$resURL = $user->getField('avatarURL');
}
srkSend((object) array('url' => $resURL));
} elseif ($srkEnv->reqURLLength == 4) {
$user = new UserData();
$user->readUser($srkEnv->reqURL[3]);
srkSend((object) array('data' => $user->getField($srkEnv->reqURL[4])));
}
}
示例2: srkSend
if ($srkEnv->reqURL[2] == 'query' && $srkEnv->reqMethod == 'POST') {
if ($srkEnv->reqURLLength == 3 && ($srkEnv->reqURL[3] = 'recent')) {
srkSend((object) array('list' => commentLoadRecent(8)));
} elseif ($srkEnv->reqURLLength == 4 && ($srkEnv->reqURL[3] = 'pen')) {
$penId = $srkEnv->reqURL[4];
$retList = commentLoadAll($penId);
srkSend((object) array('list' => $retList));
} elseif ($srkEnv->reqURLLength == 5 && $srkEnv->reqURL[3] == 'content') {
$penId = $srkEnv->reqURL[4];
$commentId = $srkEnv->reqURL[5];
$contentFileName = $srkEnv->penPath . '/' . $penId . '/comment/' . $commentId . '/content.html';
srkSend((object) array('content' => commentLoadContent($penId, $commentId), 'commentId' => $commentId));
}
} elseif ($srkEnv->reqURLLength == 2 && $srkEnv->reqURL[2] == 'post' && $srkEnv->reqMethod == 'POST') {
$user = new UserData();
$user->readUser($_SESSION['userId']);
if ($user->status != 'normal') {
srkSend((object) array('error' => 'Please log in first'));
} else {
if ($err = commentPost($user)) {
if (is_string($err)) {
srkSend((object) array('error' => $err));
} else {
srkSend((object) array('error' => "System error"));
}
} else {
srkSend((object) array('error' => false));
}
}
}
}