本文整理汇总了PHP中Ubirimi\Util::getClientIP方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::getClientIP方法的具体用法?PHP Util::getClientIP怎么用?PHP Util::getClientIP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ubirimi\Util
的用法示例。
在下文中一共展示了Util::getClientIP方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
Util::checkUserIsLoggedInAndRedirect();
$clientSettings = $this->getRepository(UbirimiClient::class)->getSettings($session->get('client/id'));
$timeTrackingDefaultUnit = $session->get('yongo/settings/time_tracking_default_unit');
$projectId = $request->request->get('project_id');
$issueId = $request->request->get('issue_id');
$attachIdsToBeKept = $request->request->get('attach_ids');
$fieldTypes = $request->request->get('field_types');
$fieldValues = $request->request->get('field_values');
$fieldTypesCustom = $request->request->get('field_types_custom');
$fieldValuesCustom = $request->request->get('field_values_custom');
if (!is_array($attachIdsToBeKept)) {
$attachIdsToBeKept = array();
}
$issueSystemFieldsData = array();
$issueCustomFieldsData = array();
for ($i = 0; $i < count($fieldTypes); $i++) {
if ($fieldValues[$i] != 'null' && $fieldValues[$i] != '') {
$issueSystemFieldsData[$fieldTypes[$i]] = $fieldValues[$i];
} else {
$issueSystemFieldsData[$fieldTypes[$i]] = null;
}
}
for ($i = 0; $i < count($fieldTypesCustom); $i++) {
if ($fieldValuesCustom[$i] != 'null' && $fieldValuesCustom[$i] != '') {
$issueCustomFieldsData[$fieldTypesCustom[$i]] = $fieldValuesCustom[$i];
} else {
$issueCustomFieldsData[$fieldTypesCustom[$i]] = null;
}
}
if (!$projectId) {
$projectId = $issueSystemFieldsData['project'];
}
$project = $this->getRepository(YongoProject::class)->getById($projectId);
if (array_key_exists(Field::FIELD_ASSIGNEE_CODE, $issueSystemFieldsData)) {
// assignee field is placed on screen
if ($issueSystemFieldsData[Field::FIELD_ASSIGNEE_CODE] == -1) {
$issueSystemFieldsData[Field::FIELD_ASSIGNEE_CODE] = null;
}
} else {
// put the assignee as the project default assignee
$issueSystemFieldsData[Field::FIELD_ASSIGNEE_CODE] = $project['lead_id'];
}
$issueSystemFieldsData['helpdesk_flag'] = 0;
if ($session->get("selected_product_id") == SystemProduct::SYS_PRODUCT_HELP_DESK) {
$issueSystemFieldsData['helpdesk_flag'] = 1;
}
$issueSystemFieldsData['user_reported_ip'] = Util::getClientIP();
$issue = UbirimiContainer::get()['issue']->save($project, $issueSystemFieldsData, $issueId, $timeTrackingDefaultUnit, $projectId, $issueCustomFieldsData, $attachIdsToBeKept, $clientSettings, $session->get('user/id'), $session->get('client/id'));
$issueEvent = new IssueEvent($issue, $project, IssueEvent::STATUS_NEW);
$this->getLogger()->addInfo('ADD Yongo issue ' . $project['code'] . '-' . $issue['nr'], $this->getLoggerContext());
UbirimiContainer::get()['dispatcher']->dispatch(YongoEvents::YONGO_ISSUE, $issueEvent);
UbirimiContainer::get()['dispatcher']->dispatch(YongoEvents::YONGO_ISSUE_EMAIL, $issueEvent);
// clean the search information
$session->remove('array_ids');
$session->remove('last_search_parameters');
return new Response('New Issue Created <a href="/yongo/issue/' . $issue['id'] . '">' . $project['code'] . '-' . $issue['nr'] . '</a>');
}