本文整理汇总了PHP中Archive::isPublic方法的典型用法代码示例。如果您正苦于以下问题:PHP Archive::isPublic方法的具体用法?PHP Archive::isPublic怎么用?PHP Archive::isPublic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Archive
的用法示例。
在下文中一共展示了Archive::isPublic方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPlan
/**
* Return the text of this user's plan.
* @param ts Timestamp of the requested plan
* @public
* @returns Plan
*/
function getPlan(&$user, $ts = null)
{
if (!isset($ts)) {
if ($user->getUserID() != $this->userID) {
$this->addView();
Archive::addView($this->userID, $this->lastUpdate);
/* check for mutual snitch registration */
if ($user->getSnitch() && $this->snitch) {
$this->addSnitchView($user);
}
}
if (!isset($this->plan)) {
$query = "SELECT content FROM plans WHERE uid=" . $this->userID;
/* execute the query */
$result = $this->dbh->query($query);
if (isset($result) && !DB::isError($result)) {
$row = $result->fetchRow();
$this->plan = $row['content'];
} else {
return PLANWORLD_ERROR;
}
}
return $this->plan;
} else {
/* fetch it from the archives */
if (Archive::isPublic($this->userID, $ts) || $user->getUserID() == $this->userID) {
if ($user->getUserID() != $this->userID) {
Archive::addView($this->userID, $ts);
}
return Archive::getEntry($this->userID, $ts);
} else {
return "<strong>Error:</strong> You are not authorized to view this entry.";
}
}
}
示例2: isPrivate
/**
* bool Archive::isPrivate ($uid, $ts)
* returns whether $uid's entry at $ts is private
*/
function isPrivate($uid, $ts)
{
$perm = Archive::isPublic($uid, $ts);
if (!Archive::isError($perm)) {
return !$perm;
} else {
return $perm;
}
}