| @@ 101-114 (lines=14) @@ | ||
| 98 | * |
|
| 99 | * @return string|null |
|
| 100 | */ |
|
| 101 | public function getSessionIdFromHeader($headers) |
|
| 102 | { |
|
| 103 | if (!$headers) { |
|
| 104 | return null; |
|
| 105 | } |
|
| 106 | ||
| 107 | preg_match("/mautic_session_id=(.+?);/", $headers, $matches); |
|
| 108 | ||
| 109 | if (isset($matches[1])) { |
|
| 110 | return $matches[1]; |
|
| 111 | } |
|
| 112 | ||
| 113 | return null; |
|
| 114 | } |
|
| 115 | ||
| 116 | /** |
|
| 117 | * Finds the Mautic Contact ID hash in the response header |
|
| @@ 124-137 (lines=14) @@ | ||
| 121 | * |
|
| 122 | * @return string|null |
|
| 123 | */ |
|
| 124 | public function getContactIdFromHeader($headers, $sessionId) |
|
| 125 | { |
|
| 126 | if (!$headers || !$sessionId) { |
|
| 127 | return null; |
|
| 128 | } |
|
| 129 | ||
| 130 | preg_match("/$sessionId=(.+?);/", $headers, $matches); |
|
| 131 | ||
| 132 | if (isset($matches[1])) { |
|
| 133 | return (int) $matches[1]; |
|
| 134 | } |
|
| 135 | ||
| 136 | return null; |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * Prepares data for CURL request based on provided form data, $_COOKIE and $_SERVER |
|