本文整理汇总了PHP中can_write函数的典型用法代码示例。如果您正苦于以下问题:PHP can_write函数的具体用法?PHP can_write怎么用?PHP can_write使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了can_write函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: canEdit
/**
* @param Contact $user
* @return boolean
*/
function canEdit(Contact $user) {
$userId = $user->getId();
$creatorId = $this->getCreatedById();
$object = $this->getRelObject();
if (!$object instanceof ContentDataObject) {
return false;
}
return can_write($user, $object->getMembers(), $object->getObjectTypeId()) && ($user->isAdministrator() || $userId == $creatorId);
} // canEdit
示例2: canEdit
/**
* Returns true if $user can edit this email
*
* @param User $user
* @return boolean
*/
function canEdit(User $user)
{
return can_write($user, $this);
// return $this->getAccount()->getUserId() == $user->getId() || $user->isAdministrator();
}
示例3: canEdit
/**
* Check if specific user can edit this file
*
* @access public
* @param User $user
* @return boolean
*/
function canEdit(User $user)
{
return can_write($user, $this);
}
示例4: canEdit
/**
* Empty implementation of static method. Update tag permissions are check by the taggable
* object, not tag itself
*
* @param User $user
* @return boolean
*/
function canEdit(User $user)
{
$userId = $user->getId();
$creatorId = $this->getCreatedById();
return can_write($user, $this) && ($user->isAdministrator() || $userId == $creatorId);
}
示例5: canEdit
/**
* Check if specific user can edit this report
*
* @access public
* @param Contact $user
* @return boolean
*/
function canEdit(Contact $user)
{
return can_write($user, $this->getMembers(), $this->manager()->getObjectTypeId());
}
示例6: canEdit
/**
* Returns true if $user can edit this email
*
* @param Contact $user
* @return boolean
*/
function canEdit(Contact $user) {
$account = $this->getAccount();
if ($account) {
return (
$account->getContactId() == logged_user()->getId() ||
can_write($user, $this->getMembers(), $this->getObjectTypeId())
);
}else{
return can_write($user, $this->getMembers(), $this->getObjectTypeId());
}
}
示例7: canCheckin
function canCheckin(Contact $user)
{
return $this->isCheckedOut() && can_write($user, $this->getMembers(), $this->getObjectTypeId()) && ($user->isAdministrator() || $user->isModerator() || $user->getId() == $this->getCheckedOutById());
}
示例8: canEdit
/**
* Check if specific user can edit this contact
*
* @access public
* @param User $user
* @return boolean
*/
function canEdit(User $user)
{
if ($this->getUserId()) {
// a contact that has a user assigned to it can be modified by anybody that can manage security (this is: users and permissions) or the user himself.
return can_manage_contacts($user, true) || can_manage_security($user) || $this->getUserId() == $user->getId() || can_write($user, $this);
} else {
return can_manage_contacts($user, true) || can_write($user, $this);
}
}
示例9: wget
/**
* http download a file from the given url and save it into the given filename
* @param string $url url
* @param string $path filename (eg: /tmp/toto.txt)
* @access public
* @return void
*/
function wget($url, $path)
{
if (!can_write($path)) {
return false;
}
$from = @fopen($url, 'rb');
$to = @fopen($path, 'w');
$error = false;
while (!feof($from) && !$error) {
$buffer = @fread($from, 1024);
if ($buffer === FALSE || fwrite($to, $buffer) === FALSE) {
$error = true;
}
}
fclose($to);
fclose($from);
if ($error) {
unlink($to);
}
return !$error;
}
示例10: canAddComment
/**
* Check if specific user can comment this message
*
* @access public
* @param void
* @return boolean
*/
function canAddComment(User $user)
{
return can_write($user, $this);
}
示例11: canEdit
/**
* Empty implementation of static method. Update tag permissions are check by the taggable
* object, not tag itself
*
* @param User $user
* @return boolean
*/
function canEdit(Contact $user) {
return can_write($user,$this);
} // canEdit
示例12: canChangeStatus
/**
* Can chagne status of this milestone (completed / open)
*
* @access public
* @param User $user
* @return boolean
*/
function canChangeStatus(User $user)
{
return can_write($user, $this);
}
示例13: canEdit
/**
* Returns true if $user can edit this email
*
* @param Contact $user
* @return boolean
*/
function canEdit(Contact $user)
{
$account = $this->getAccount();
$members = $this->getMembers();
$persons_dim = Dimensions::findByCode('feng_persons');
$tmp = array();
foreach ($members as $m) {
if (!$persons_dim instanceof Dimension || $m->getDimensionId() != $persons_dim->getId()) {
$tmp[] = $m;
}
}
$members = $tmp;
if ($account instanceof MailAccount) {
// if classified
if (count($members) > 0) {
return $account->getContactId() == logged_user()->getId() || can_write($user, $members, $this->getObjectTypeId());
} else {
$macs = MailAccountContacts::instance()->count(array('`account_id` = ? AND `contact_id` = ? AND `can_edit` = 1', $account->getId(), $user->getId()));
return $account->getContactId() == logged_user()->getId() || $macs > 0;
}
} else {
if (count($members) > 0) {
return can_write($user, $members, $this->getObjectTypeId());
} else {
return false;
}
}
}
示例14: canAddComment
/**
* Check if specific user can comment this webpage
*
* @access public
* @param void
* @return boolean
*/
function canAddComment(Contact $user) {
return can_write($user, $this->getMembers(), $this->getObjectTypeId());
} // canAddComment
示例15: canUpdateOptions
/**
* Check if $user can update webpage options
*
* @param User $user
* @return boolean
*/
function canUpdateOptions(User $user)
{
return can_write($user, $this);
}