dolibarr  16.0.1
ajax.php
Go to the documentation of this file.
1 <?php
24 if (!defined('NOTOKENRENEWAL')) {
25  define('NOTOKENRENEWAL', '1'); // Disables token renewal
26 }
27 if (!defined('NOREQUIREHTML')) {
28  define('NOREQUIREHTML', '1');
29 }
30 if (!defined('NOREQUIREAJAX')) {
31  define('NOREQUIREAJAX', '1');
32 }
33 if (!defined('NOREQUIRESOC')) {
34  define('NOREQUIRESOC', '1');
35 }
36 if (!defined('NOCSRFCHECK')) {
37  define('NOCSRFCHECK', '1');
38 }
39 // Do not check anti CSRF attack test
40 if (!defined('NOREQUIREMENU')) {
41  define('NOREQUIREMENU', '1');
42 }
43 // If there is no need to load and show top and left menu
44 if (!defined("NOLOGIN")) {
45  define("NOLOGIN", '1');
46 }
47 if (!defined('NOIPCHECK')) {
48  define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
49 }
50 if (!defined('NOBROWSERNOTIF')) {
51  define('NOBROWSERNOTIF', '1');
52 }
53 
54 include_once '../../../main.inc.php'; // Load $user and permissions
55 
56 $action = GETPOST('action', 'aZ09');
57 $id = GETPOST('id', 'int');
58 $email = GETPOST('email', 'alphanohtml');
59 
60 
61 /*
62  * View
63  */
64 
65 top_httphead();
66 
67 if ($action == 'getContacts') {
68  $return = array(
69  'contacts' => array(),
70  'error' => '',
71  );
72 
73  if (!empty($email)) {
74  require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
75 
76  $ticket = new Ticket($db);
77  $contacts = $ticket->searchContactByEmail($email);
78  if (is_array($contacts)) {
79  $return['contacts'] = $contacts;
80  } else {
81  $return['error'] = $ticket->errorsToString();
82  }
83  }
84 
85  echo json_encode($return);
86  exit();
87 }
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage ticket.
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype= 'text/html', $forcenocache=0)
Show HTTP header.
Definition: main.inc.php:1403