dolibarr  x.y.z
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 // Do not check anti CSRF attack test
37 if (!defined('NOREQUIREMENU')) {
38  define('NOREQUIREMENU', '1');
39 }
40 // If there is no need to load and show top and left menu
41 if (!defined("NOLOGIN")) {
42  define("NOLOGIN", '1');
43 }
44 if (!defined('NOIPCHECK')) {
45  define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
46 }
47 if (!defined('NOBROWSERNOTIF')) {
48  define('NOBROWSERNOTIF', '1');
49 }
50 
51 include_once '../../../main.inc.php'; // Load $user and permissions
52 
53 $action = GETPOST('action', 'aZ09');
54 $id = GETPOST('id', 'int');
55 $email = GETPOST('email', 'alphanohtml');
56 
57 
58 /*
59  * View
60  */
61 
62 top_httphead();
63 
64 if ($action == 'getContacts') {
65  $return = array(
66  'contacts' => array(),
67  'error' => '',
68  );
69 
70  if (!empty($email)) {
71  require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
72 
73  $ticket = new Ticket($db);
74  $contacts = $ticket->searchContactByEmail($email);
75  if (is_array($contacts)) {
76  $return['contacts'] = $contacts;
77  } else {
78  $return['error'] = $ticket->errorsToString();
79  }
80  }
81 
82  echo json_encode($return);
83  exit();
84 }
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
Definition: main.inc.php:1436
Class to generate the form for creating a new ticket.