/** * @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
/** * 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(); }
/** * Check if specific user can edit this file * * @access public * @param User $user * @return boolean */ function canEdit(User $user) { return can_write($user, $this); }
/** * 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); }
/** * 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()); }
/** * 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()); } }
function canCheckin(Contact $user) { return $this->isCheckedOut() && can_write($user, $this->getMembers(), $this->getObjectTypeId()) && ($user->isAdministrator() || $user->isModerator() || $user->getId() == $this->getCheckedOutById()); }
/** * 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); } }
/** * 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; }
/** * Check if specific user can comment this message * * @access public * @param void * @return boolean */ function canAddComment(User $user) { return can_write($user, $this); }
/** * 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
/** * Can chagne status of this milestone (completed / open) * * @access public * @param User $user * @return boolean */ function canChangeStatus(User $user) { return can_write($user, $this); }
/** * 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; } } }
/** * 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
/** * Check if $user can update webpage options * * @param User $user * @return boolean */ function canUpdateOptions(User $user) { return can_write($user, $this); }
static function canWrite($bookId = null) { self::includeBasic(); $file_id = self::ogBookId(); if ($file_id == null) { return false; } if ($bookId != self::getGelsheetBookId($file_id)) { return false; } $file = ProjectFiles::findById($file_id); if (!$file instanceof ProjectFile) { return false; } return can_write(self::getCompanyWebsite()->getLoggedUser(), $file); }
/** * Can chagne status of this milestone (completed / open) * * @access public * @param Contact $contact * @return boolean */ function canChangeStatus(Contact $contact) { return can_write($contact, $this->getMembers(), $this->getObjectTypeId()); }
/** * Check if specific user can edit this contact * * @access public * @param User $user * @return boolean */ function canEdit(Contact $user) { if ($this->isUser()) { // 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_security($user) && ($this->getUserType() > $user->getUserType() || $user->isAdministrator()) || $this->getObjectId() == $user->getObjectId(); } if ($this->isOwnerCompany()) { return can_manage_configuration($user); } return can_manage_contacts($user) || can_write($user, $this->getMembers(), $this->getObjectTypeId()); }
<div class="objectComments" id="<?php echo $random; ?> objectComments" style="<?php echo $countComments > 0 ? '' : 'display:none'; ?> "> <?php if (is_array($comments) && count($comments)) { $counter = 0; foreach ($comments as $comment) { $counter++; $options = array(); if ($comment->canEdit(logged_user()) && !$__comments_object->isTrashed()) { if ($comment->getCreatedById() == logged_user()->getId() || can_write(logged_user(), $comment->getRelObject()->getMembers(), $comment->getObjectTypeId())) { $options[] = '<a class="internalLink" href="' . $comment->getEditUrl() . '">' . lang('edit') . '</a>'; } if ($comment->canLinkObject(logged_user())) { $options[] = render_link_to_object($comment, lang('link objects'), true); } } if ($comment->canDelete(logged_user()) && !$__comments_object->isTrashed()) { $options[] = '<a class="internalLink" href="' . $comment->getDeleteUrl() . '" onclick="return confirm(\'' . escape_single_quotes(lang('confirm move to trash')) . '\')">' . lang('move to trash') . '</a>'; } ?> <div class="comment <?php echo $counter % 2 ? 'even' : 'odd'; ?> " id="comment<?php echo $comment->getId();
return $message; } function versionPhpCheck() { if (version_compare(PHP_VERSION, '5.4.2') >= 0) { return "Pass"; } elseif (version_compare(PHP_VERSION, '5.3.0', '>=') && version_compare(PHP_VERSION, '5.4.1', '<=')) { return "Warning"; } else { return "Fail"; } } $bool = array(true => "Pass", false => "Fail"); $version = versionPhpCheck(); $extensions = get_loaded_extensions(); $writeable = can_write(); $openssl = in_array('openssl', $extensions); $pdo_sqlite = in_array('pdo_sqlite', $extensions); $curl = in_array('curl', $extensions); $curl_version = curl_version(); ?> <h2>Checks php proxy requirements</h2> <small>* Run this page from a web server directory that includes the proxy.php file</small><br/> <small>* It's recommended to remove this file from web server once all below tests pass</small> <br/><br/> <p>Manually test the web server's configuration by clicking <a href="proxy.config">here</a>. If the proxy configuration file (proxy.config) displays or gets downloaded, the server is <u>not</u> configured properly to use this proxy (see guide for more details).<br/><br/> <div class="requirements-div"> <table>
/** * Check if specific user can add task to this list * * @param Contact $user * @return boolean */ function canAddSubTask(Contact $user) { return can_write($user, $this->getMembers(), $this->getObjectTypeId()); }
/** * Check if specific user can comment this message * * @access public * @param void * @return boolean */ function canAddComment(Contact $contact) { return can_write($contact, $this->getMembers(), $this->getObjectTypeId()); }
/** * @param Contact $user * @return boolean */ function canEdit(Contact $user) { $userId = $user->getId(); $creatorId = $this->getCreatedById(); $object = $this->getRelObject(); return can_write($user, $object->getMembers(), $object->getObjectTypeId()) && ($user->isAdministrator() || $userId == $creatorId); }
function canCheckin(User $user) { return $this->isCheckedOut() && can_write($user, $this) && ($user->isAdministrator() || $user->getId() == $this->getCheckedOutById()); }
/** * Check if specific user can add task to this list * * @param User $user * @return boolean */ function canAddSubTask(User $user) { return can_write($user, $this); }