本文整理汇总了PHP中PFUser::isAnonymous方法的典型用法代码示例。如果您正苦于以下问题:PHP PFUser::isAnonymous方法的具体用法?PHP PFUser::isAnonymous怎么用?PHP PFUser::isAnonymous使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PFUser
的用法示例。
在下文中一共展示了PFUser::isAnonymous方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createArtifact
/**
* Add an artefact in the tracker
*
* @param Tracker_IDisplayTrackerLayout $layout
* @param Codendi_Request $request
* @param PFUser $user
*
* @return Tracker_Artifact the new artifact
*/
private function createArtifact(Tracker_IDisplayTrackerLayout $layout, $request, $user)
{
$email = null;
if ($user->isAnonymous()) {
$email = $request->get('email');
}
$fields_data = $request->get('artifact');
$this->tracker->augmentDataFromRequest($fields_data);
return $this->artifact_factory->createArtifact($this->tracker, $fields_data, $user, $email);
}
示例2: createArtifact
private function createArtifact(PFUser $current_user)
{
$email = null;
if ($current_user->isAnonymous()) {
$email = $this->request->get('email');
}
$fields_data = $this->request->get('artifact');
$this->tracker->augmentDataFromRequest($fields_data);
return $this->tracker_artifact_factory->createArtifact($this->tracker, $fields_data, $current_user, $email);
}
示例3: doesRequestAppearToBeValid
private function doesRequestAppearToBeValid(Tracker_Artifact $artifact, array $fields_data, PFUser $submitter)
{
if ($submitter->isAnonymous() && !trim($submitter->getEmail())) {
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_artifact', 'email_required'));
return false;
}
if (!$this->fields_validator->validate($artifact, $fields_data)) {
return false;
}
return true;
}
示例4: getSwitchDisplayAvatarsURL
private function getSwitchDisplayAvatarsURL()
{
if ($this->user->isAnonymous()) {
return false;
}
$group_id = $this->milestone->getGroupId();
$planning_id = $this->milestone->getPlanningId();
$tracker_id = $this->milestone->getTrackerId();
$artifact_id = $this->milestone->getArtifactId();
$action = 'toggle_user_display_avatar';
$switch_display_username_url = CARDWALL_BASE_URL . '/?group_id=' . $group_id . '&planning_id=' . $planning_id . '&tracker_id=' . $tracker_id . '&aid=' . $artifact_id . '&action=' . $action;
return $switch_display_username_url;
}
示例5: getSaveOrRevert
private function getSaveOrRevert(PFUser $current_user, Tracker_Report $report, array $options_params, $report_can_be_modified)
{
if ($current_user->isAnonymous() || !$report_can_be_modified) {
return false;
}
if ($report->userCanUpdate($current_user)) {
$default_save = new Templating_Presenter_ButtonDropdownsOption('tracker_report_updater_save', $GLOBALS['Language']->getText('plugin_tracker_report', 'save'), false, '?' . http_build_query(array_merge($options_params, array('func' => Tracker_Report::ACTION_SAVE))));
$extra_save = array(new Templating_Presenter_ButtonDropdownsOptionWithModal('tracker_report_updater_saveas', $GLOBALS['Language']->getText('plugin_tracker_report', 'save_as'), false, '?' . http_build_query(array_merge($options_params, array('func' => Tracker_Report::ACTION_SAVEAS))) . '#tracker_report_updater_saveas-modal'));
} elseif (!$current_user->isAnonymous()) {
$default_save = new Templating_Presenter_ButtonDropdownsOptionWithModal('tracker_report_updater_saveas', $GLOBALS['Language']->getText('plugin_tracker_report', 'save_as'), false, '?' . http_build_query(array_merge($options_params, array('func' => Tracker_Report::ACTION_SAVEAS))) . '#tracker_report_updater_saveas-modal');
$extra_save = array();
}
return new Templating_Presenter_SplitButtonDropdowns('tracker_report_save_dropdown', 'btn-primary', $default_save, $extra_save);
}
示例6: getDeprecatedMessage
/**
* @return string
*/
public function getDeprecatedMessage()
{
if ($this->user->getPreference(PFUser::PREFERENCE_DISABLE_IE7_WARNING)) {
return;
}
$warning_message = $GLOBALS['Language']->getText('include_browser', 'ie7_deprecated');
if ($this->user->isAnonymous()) {
return $warning_message;
}
$url = '/account/disable_ie7_warning.php';
$csrf = new CSRFSynchronizerToken($url);
$form = '<form action="' . $url . '" method="POST" style="margin: 0">';
$form .= $csrf->fetchHTMLInput();
$form .= $warning_message;
$form .= '<button
type="submit"
class="btn btn-small btn-inverse"
>
' . $GLOBALS['Language']->getText('include_browser', 'ie7_deprecated_button') . '
</button>
</form>';
return $form;
}
示例7: process
public function process(Tracker_IDisplayTrackerLayout $layout, Codendi_Request $request, PFUser $current_user)
{
//TODO : check permissions on this action?
$comment_format = $this->artifact->validateCommentFormat($request, 'comment_formatnew');
$this->artifact->setUseArtifactPermissions($request->get('use_artifact_permissions') ? 1 : 0);
$fields_data = $request->get('artifact');
$fields_data['request_method_called'] = 'artifact-update';
$this->artifact->getTracker()->augmentDataFromRequest($fields_data);
unset($fields_data['request_method_called']);
try {
if ($current_user->isAnonymous()) {
$current_user->setEmail($request->get('email'));
}
$this->artifact->createNewChangeset($fields_data, $request->get('artifact_followup_comment'), $current_user, true, $comment_format);
$art_link = $this->artifact->fetchDirectLinkToArtifact();
$GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_tracker_index', 'update_success', array($art_link)), CODENDI_PURIFIER_LIGHT);
$redirect = $this->getRedirectUrlAfterArtifactUpdate($request);
$this->artifact->summonArtifactRedirectors($request, $redirect);
if ($request->isAjax()) {
$this->sendAjaxCardsUpdateInfo($current_user, $this->artifact, $this->form_element_factory);
} elseif ($request->existAndNonEmpty('from_overlay')) {
echo '<script>window.parent.tuleap.cardwall.cardsEditInPlace.validateEdition(' . $this->artifact->getId() . ')</script>';
return;
} else {
$GLOBALS['Response']->redirect($redirect->toUrl());
}
} catch (Tracker_NoChangeException $e) {
if ($request->isAjax()) {
$this->sendAjaxCardsUpdateInfo($current_user, $this->artifact, $this->form_element_factory);
} else {
$GLOBALS['Response']->addFeedback('info', $e->getMessage(), CODENDI_PURIFIER_LIGHT);
$render = new Tracker_Artifact_ReadOnlyRenderer($this->event_manager, $this->artifact, $this->form_element_factory, $layout);
$render->display($request, $current_user);
}
} catch (Tracker_Exception $e) {
if ($request->isAjax()) {
$this->sendAjaxCardsUpdateInfo($current_user, $this->artifact, $this->form_element_factory);
} else {
$GLOBALS['Response']->addFeedback('error', $e->getMessage());
$render = new Tracker_Artifact_ReadOnlyRenderer($this->event_manager, $this->artifact, $this->form_element_factory, $layout);
$render->display($request, $current_user);
}
}
}
示例8: fetch
/**
* Fetch content of the renderer
* @param array $matching_ids
* @param Request $request
* @return string
*/
public function fetch($matching_ids, $request, $report_can_be_modified, PFUser $user)
{
$html = '';
$this->initiateSession();
$readonly = !$report_can_be_modified || $user->isAnonymous();
if (!$readonly && $this->chart_to_edit) {
$html .= '<script type="text/javascript" src="/plugins/graphontrackersv5/dependencies.js"></script>';
$url = '?' . http_build_query(array('report' => $this->report->id, 'renderer' => $this->id));
$html .= '<p><a href="' . $url . '">« ' . $GLOBALS['Language']->getText('plugin_graphontrackersv5_include_report', 'return_renderer') . '</a></p>';
$html .= '<form action="' . $url . '" name="edit_chart_form" method="post">';
$html .= '<input type="hidden" name="func" VALUE="renderer" />';
$html .= '<input type="hidden" name="renderer_plugin_graphontrackersv5[edit_chart]" VALUE="' . $this->chart_to_edit->getId() . '" />';
$html .= '<table>';
$html .= '<thead>
<tr class="boxtable">
<th class="boxtitle">' . $GLOBALS['Language']->getText('plugin_graphontrackersv5_boxtable', 'chart_properties') . '</th>
<th class="boxtitle">' . $GLOBALS['Language']->getText('plugin_graphontrackersv5_boxtable', 'preview') . '</th>
</tr>
</thead>';
$html .= '<tbody><tr valign="top"><td>';
//{{{ Chart Properties
foreach ($this->chart_to_edit->getProperties() as $prop) {
$html .= '<p>' . $prop->render() . "</p>\n";
}
$html .= '<p style="text-align:center;"><input type="submit" name="renderer_plugin_graphontrackersv5[update_chart]" value="' . $GLOBALS['Language']->getText('global', 'btn_submit') . '" /></p>';
//}}}
$html .= '</td><td style="text-align:center">';
//{{{ Chart Preview
$html .= $this->chart_to_edit->getContent();
//}}}
$html .= '</tr>';
if ($help = $this->chart_to_edit->getHelp()) {
$html .= '<tr><td colspan="2" class="inline_help">' . $help . '</td></tr>';
}
$html .= '</tbody></table>';
$html .= '</form>';
} else {
$in_dashboard = false;
$html .= $this->fetchCharts($this->report->getMatchingIds(), $user, $in_dashboard, $readonly);
}
return $html;
}
示例9: createArtifact
/**
* Add an artefact in the tracker
*
* @param Tracker $tracker The tracker this artifact belongs to
* @param array $fields_data The data of the artifact to create
* @param PFUser $user The user that want to create the artifact
* @param string $email The email if the user is anonymous (null if anonymous)
* @param boolean $send_notification true if a notification must be sent, false otherwise
*
* @return Tracker_Artifact or false if an error occured
*/
public function createArtifact(Tracker $tracker, $fields_data, PFUser $user, $email, $send_notification = true)
{
$formelement_factory = Tracker_FormElementFactory::instance();
$fields_validator = new Tracker_Artifact_Changeset_InitialChangesetFieldsValidator($formelement_factory);
$changeset_creator = new Tracker_Artifact_Changeset_InitialChangesetCreator($fields_validator, $formelement_factory, new Tracker_Artifact_ChangesetDao(), $this, EventManager::instance());
$creator = new Tracker_ArtifactCreator($this, $fields_validator, $changeset_creator);
if ($user->isAnonymous()) {
$user->setEmail($email);
}
$submitted_on = $_SERVER['REQUEST_TIME'];
return $creator->create($tracker, $fields_data, $user, $submitted_on, $send_notification);
}
示例10: getLdapFromUser
/**
* Get LDAPResult object corresponding to a User object
*
* @param PFUser $user
* @return LDAPResult
*/
function getLdapFromUser($user)
{
if ($user && !$user->isAnonymous()) {
return $this->getLdapFromLdapId($user->getLdapId());
} else {
return false;
}
}
示例11: fetchFormattedMailUserInfo
private function fetchFormattedMailUserInfo(PFUser $user)
{
$hp = Codendi_HTMLPurifier::instance();
if ($user && !$user->isAnonymous()) {
$user_info = '<a href="mailto:' . $hp->purify($user->getEmail()) . '">' . $hp->purify($user->getRealName()) . ' (' . $hp->purify($user->getUserName()) . ')
</a>';
} else {
$user = UserManager::instance()->getUserAnonymous();
$user->setEmail($this->changeset->getEmail());
$user_info = $GLOBALS['Language']->getText('tracker_include_artifact', 'anon_user');
}
return $user_info;
}
示例12: assertProjectUGroupAndUserValidity
/**
* Test the status of the ugroup & the user
*
* @param PFUser $user User to test
*
* @return Void
*/
private function assertProjectUGroupAndUserValidity($user)
{
if (!$this->group_id) {
throw new Exception('Invalid group_id');
}
if (!$this->id) {
throw new UGroup_Invalid_Exception();
}
if ($user->isAnonymous()) {
throw new Exception('Invalid user');
}
}
示例13: updateDb
/**
* Update db entry of 'user' table with values in object
* @param PFUser $user
*/
public function updateDb(PFUser $user)
{
if (!$user->isAnonymous()) {
$old_user = $this->getUserByIdWithoutCache($user->getId());
$userRow = $user->toRow();
if ($user->getPassword() != '') {
$password_handler = PasswordHandlerFactory::getPasswordHandler();
if (!$password_handler->verifyHashPassword($user->getPassword(), $user->getUserPw()) || $password_handler->isPasswordNeedRehash($user->getUserPw())) {
// Update password
$userRow['clear_password'] = $user->getPassword();
}
}
if ($user->getLegacyUserPw() !== '' && !ForgeConfig::get('sys_keep_md5_hashed_password')) {
$userRow['user_pw'] = '';
}
$result = $this->getDao()->updateByRow($userRow);
if ($result) {
if ($user->isSuspended() || $user->isDeleted()) {
$this->getDao()->deleteAllUserSessions($user->getId());
}
$this->_getEventManager()->processEvent(Event::USER_MANAGER_UPDATE_DB, array('old_user' => $old_user, 'new_user' => &$user));
}
return $result;
}
return false;
}
示例14: userCanUpdate
public function userCanUpdate(PFUser $user)
{
if ($user->isAnonymous() || !$this->userCanView($user)) {
return false;
}
return true;
}
示例15: userCanUpdate
public function userCanUpdate(PFUser $user)
{
if ($user->isAnonymous()) {
return false;
}
return true;
}