Skip to content

Commit

Permalink
Changed EOL to CRLF
Browse files Browse the repository at this point in the history
  • Loading branch information
tomolimo committed Oct 16, 2023
1 parent e5ccb43 commit 78ead76
Show file tree
Hide file tree
Showing 36 changed files with 2,016 additions and 2,016 deletions.
76 changes: 38 additions & 38 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
40 changes: 20 additions & 20 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
94 changes: 47 additions & 47 deletions ajax/asynchronousdatas.php
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
<?php
if (strpos($_SERVER['PHP_SELF'], "asynchronousdatas.php")) {
$AJAX_INCLUDE = 1;
define('GLPI_ROOT', '../../..');
include (GLPI_ROOT."/inc/includes.php");
Html::header_nocache();
}

if (!defined('GLPI_ROOT')) {
die("Can not access directly to this file");
}

include_once dirname(__FILE__)."/../inc/crontaskaction.class.php";
if (isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD']=='OPTIONS') {
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: POST");
header("Access-Control-Allow-Headers: Content-Type");
} else {
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");

if (isset($_SERVER['REQUEST_METHOD'])) {
switch ($_SERVER['REQUEST_METHOD']) {
case 'POST' :
$request_body = file_get_contents('php://input');
$datas = json_decode($request_body, true);

$asyncdata = new PluginProcessmakerCrontaskaction;
if (isset($datas['id']) && $asyncdata->getFromDB( $datas['id'] ) && $asyncdata->fields['state'] == PluginProcessmakerCrontaskaction::WAITING_DATA) {
$initialdatas = json_decode($asyncdata->fields['postdata'], true);
$initialdatas['form'] = array_merge( $initialdatas['form'], $datas['form'] );
$postdata = json_encode($initialdatas, JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE);
$asyncdata->update( [ 'id' => $datas['id'], 'state' => PluginProcessmakerCrontaskaction::DATA_READY, 'postdata' => $postdata ] );
$ret = [ 'code' => '0', 'message' => 'Done' ];
} else {
$ret = [ 'code' => '2', 'message' => 'Case is not existing, or state is not WAITING_DATA' ];
}

break;
default:
$ret = [ 'code' => '1', 'message' => 'Method '.$_SERVER['REQUEST_METHOD'].' not supported' ];
}

echo json_encode( $ret, JSON_HEX_APOS | JSON_HEX_QUOT );

}
}
<?php
if (strpos($_SERVER['PHP_SELF'], "asynchronousdatas.php")) {
$AJAX_INCLUDE = 1;
define('GLPI_ROOT', '../../..');
include (GLPI_ROOT."/inc/includes.php");
Html::header_nocache();
}

if (!defined('GLPI_ROOT')) {
die("Can not access directly to this file");
}

include_once dirname(__FILE__)."/../inc/crontaskaction.class.php";
if (isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD']=='OPTIONS') {
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: POST");
header("Access-Control-Allow-Headers: Content-Type");
} else {
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");

if (isset($_SERVER['REQUEST_METHOD'])) {
switch ($_SERVER['REQUEST_METHOD']) {
case 'POST' :
$request_body = file_get_contents('php://input');
$datas = json_decode($request_body, true);

$asyncdata = new PluginProcessmakerCrontaskaction;
if (isset($datas['id']) && $asyncdata->getFromDB( $datas['id'] ) && $asyncdata->fields['state'] == PluginProcessmakerCrontaskaction::WAITING_DATA) {
$initialdatas = json_decode($asyncdata->fields['postdata'], true);
$initialdatas['form'] = array_merge( $initialdatas['form'], $datas['form'] );
$postdata = json_encode($initialdatas, JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE);
$asyncdata->update( [ 'id' => $datas['id'], 'state' => PluginProcessmakerCrontaskaction::DATA_READY, 'postdata' => $postdata ] );
$ret = [ 'code' => '0', 'message' => 'Done' ];
} else {
$ret = [ 'code' => '2', 'message' => 'Case is not existing, or state is not WAITING_DATA' ];
}

break;
default:
$ret = [ 'code' => '1', 'message' => 'Method '.$_SERVER['REQUEST_METHOD'].' not supported' ];
}

echo json_encode( $ret, JSON_HEX_APOS | JSON_HEX_QUOT );

}
}
178 changes: 89 additions & 89 deletions ajax/dropdownProcesses.php
Original file line number Diff line number Diff line change
@@ -1,89 +1,89 @@
<?php

// ----------------------------------------------------------------------
// Original Author of file: Olivier Moron
// Purpose of file: to return list of processes which can be started by end-user
// ----------------------------------------------------------------------

// Direct access to file
if (strpos($_SERVER['PHP_SELF'], "dropdownProcesses.php")) {
include ("../../../inc/includes.php");
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
}

if (!defined('GLPI_ROOT')) {
die("Can not access directly to this file");
}


Session::checkLoginUser();

if (isset($_REQUEST["entity_restrict"])
&& !is_array($_REQUEST["entity_restrict"])
&& (substr($_REQUEST["entity_restrict"], 0, 1) === '[')
&& (substr($_REQUEST["entity_restrict"], -1) === ']')) {
$_REQUEST["entity_restrict"] = json_decode($_REQUEST["entity_restrict"]);
$_REQUEST["entity_restrict"] = $_REQUEST["entity_restrict"][0];
}

// Security
if (!($item = getItemForItemtype($_REQUEST['itemtype']))) {
exit();
}

$one_item = -1;
if (isset($_POST['_one_id'])) {
$one_item = $_POST['_one_id'];
}
// Count real items returned
$count = 0;

if (!isset($_REQUEST['emptylabel']) || ($_REQUEST['emptylabel'] == '')) {
$_REQUEST['emptylabel'] = Dropdown::EMPTY_VALUE;
}

$search="";
if (!empty($_REQUEST['searchText'])) {
$search = ['LIKE', Search::makeTextSearchValue($_REQUEST['searchText'])];
}

$processes = [];

// Empty search text : display first
if (empty($_REQUEST['searchText'])) {
if ($_REQUEST['display_emptychoice']) {
if (($one_item < 0) || ($one_item == 0)) {
array_push($processes, ['id' => 0,
'text' => $_REQUEST['emptylabel']]);
}
}
}

$processall = (isset($_REQUEST['specific_tags']['process_restrict']) && !$_REQUEST['specific_tags']['process_restrict']);
$count_cases_per_item = isset($_REQUEST['specific_tags']['count_cases_per_item']) ? $_REQUEST['specific_tags']['count_cases_per_item'] : [];

$result = PluginProcessmakerProcess::getSqlSearchResult(false, $search);

//if ($DB->numrows($result)) {
// while ($data = $DB->fetch_array($result)) {
//if ($result->numrows()) {
foreach ($result as $data) {
$process_entities = PluginProcessmakerProcess::getEntitiesForProfileByProcess($data["id"], $_SESSION['glpiactiveprofile']['id'], true);
$can_add = $data['max_cases_per_item'] == 0 || !isset($count_cases_per_item[$data["id"]]) || $count_cases_per_item[$data["id"]] < $data['max_cases_per_item'];
if ($processall
|| ($data['maintenance'] != 1
&& in_array( $_REQUEST["entity_restrict"], $process_entities)
&& $can_add) ) {

array_push( $processes, ['id' => $data["id"],
'text' => $data["name"]
]);
$count++;
}
}
//}

$ret['results'] = $processes;
$ret['count'] = $count;
echo json_encode($ret);
<?php

// ----------------------------------------------------------------------
// Original Author of file: Olivier Moron
// Purpose of file: to return list of processes which can be started by end-user
// ----------------------------------------------------------------------

// Direct access to file
if (strpos($_SERVER['PHP_SELF'], "dropdownProcesses.php")) {
include ("../../../inc/includes.php");
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
}

if (!defined('GLPI_ROOT')) {
die("Can not access directly to this file");
}


Session::checkLoginUser();

if (isset($_REQUEST["entity_restrict"])
&& !is_array($_REQUEST["entity_restrict"])
&& (substr($_REQUEST["entity_restrict"], 0, 1) === '[')
&& (substr($_REQUEST["entity_restrict"], -1) === ']')) {
$_REQUEST["entity_restrict"] = json_decode($_REQUEST["entity_restrict"]);
$_REQUEST["entity_restrict"] = $_REQUEST["entity_restrict"][0];
}

// Security
if (!($item = getItemForItemtype($_REQUEST['itemtype']))) {
exit();
}

$one_item = -1;
if (isset($_POST['_one_id'])) {
$one_item = $_POST['_one_id'];
}
// Count real items returned
$count = 0;

if (!isset($_REQUEST['emptylabel']) || ($_REQUEST['emptylabel'] == '')) {
$_REQUEST['emptylabel'] = Dropdown::EMPTY_VALUE;
}

$search="";
if (!empty($_REQUEST['searchText'])) {
$search = ['LIKE', Search::makeTextSearchValue($_REQUEST['searchText'])];
}

$processes = [];

// Empty search text : display first
if (empty($_REQUEST['searchText'])) {
if ($_REQUEST['display_emptychoice']) {
if (($one_item < 0) || ($one_item == 0)) {
array_push($processes, ['id' => 0,
'text' => $_REQUEST['emptylabel']]);
}
}
}

$processall = (isset($_REQUEST['specific_tags']['process_restrict']) && !$_REQUEST['specific_tags']['process_restrict']);
$count_cases_per_item = isset($_REQUEST['specific_tags']['count_cases_per_item']) ? $_REQUEST['specific_tags']['count_cases_per_item'] : [];

$result = PluginProcessmakerProcess::getSqlSearchResult(false, $search);

//if ($DB->numrows($result)) {
// while ($data = $DB->fetch_array($result)) {
//if ($result->numrows()) {
foreach ($result as $data) {
$process_entities = PluginProcessmakerProcess::getEntitiesForProfileByProcess($data["id"], $_SESSION['glpiactiveprofile']['id'], true);
$can_add = $data['max_cases_per_item'] == 0 || !isset($count_cases_per_item[$data["id"]]) || $count_cases_per_item[$data["id"]] < $data['max_cases_per_item'];
if ($processall
|| ($data['maintenance'] != 1
&& in_array( $_REQUEST["entity_restrict"], $process_entities)
&& $can_add) ) {

array_push( $processes, ['id' => $data["id"],
'text' => $data["name"]
]);
$count++;
}
}
//}

$ret['results'] = $processes;
$ret['count'] = $count;
echo json_encode($ret);
Loading

0 comments on commit 78ead76

Please sign in to comment.