1 |
efrain |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
declare(strict_types=1);
|
|
|
4 |
|
|
|
5 |
namespace LeadersLinked\Controller;
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
use Laminas\Mvc\Controller\AbstractActionController;
|
283 |
www |
9 |
|
1 |
efrain |
10 |
use Laminas\View\Model\JsonModel;
|
|
|
11 |
use LeadersLinked\Model\Page;
|
|
|
12 |
use LeadersLinked\Mapper\NotificationMapper;
|
|
|
13 |
use LeadersLinked\Mapper\PageMapper;
|
|
|
14 |
use LeadersLinked\Mapper\UserMapper;
|
|
|
15 |
use LeadersLinked\Mapper\ConnectionMapper;
|
|
|
16 |
|
|
|
17 |
use LeadersLinked\Mapper\PostMapper;
|
|
|
18 |
use LeadersLinked\Model\Post;
|
|
|
19 |
|
|
|
20 |
use LeadersLinked\Mapper\FeedMapper;
|
|
|
21 |
use LeadersLinked\Model\Feed;
|
|
|
22 |
use LeadersLinked\Model\User;
|
|
|
23 |
use LeadersLinked\Model\Connection;
|
|
|
24 |
use LeadersLinked\Mapper\NetworkMapper;
|
|
|
25 |
use LeadersLinked\Library\Functions;
|
|
|
26 |
use LeadersLinked\Model\Network;
|
|
|
27 |
|
257 |
efrain |
28 |
use LeadersLinked\Library\ExternalCredentials;
|
341 |
www |
29 |
use Nullix\CryptoJsAes\CryptoJsAes;
|
345 |
www |
30 |
use LeadersLinked\Library\Storage;
|
257 |
efrain |
31 |
|
1 |
efrain |
32 |
class HomeController extends AbstractActionController
|
|
|
33 |
{
|
|
|
34 |
/**
|
|
|
35 |
*
|
|
|
36 |
* @var \Laminas\Db\Adapter\AdapterInterface
|
|
|
37 |
*/
|
|
|
38 |
private $adapter;
|
|
|
39 |
|
|
|
40 |
/**
|
|
|
41 |
*
|
|
|
42 |
* @var \LeadersLinked\Cache\CacheInterface
|
|
|
43 |
*/
|
|
|
44 |
private $cache;
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
/**
|
|
|
48 |
*
|
|
|
49 |
* @var \Laminas\Log\LoggerInterface
|
|
|
50 |
*/
|
|
|
51 |
private $logger;
|
|
|
52 |
|
|
|
53 |
/**
|
|
|
54 |
*
|
|
|
55 |
* @var array
|
|
|
56 |
*/
|
|
|
57 |
private $config;
|
|
|
58 |
|
|
|
59 |
|
|
|
60 |
/**
|
|
|
61 |
*
|
|
|
62 |
* @var \Laminas\Mvc\I18n\Translator
|
|
|
63 |
*/
|
|
|
64 |
private $translator;
|
|
|
65 |
|
|
|
66 |
|
|
|
67 |
/**
|
|
|
68 |
*
|
|
|
69 |
* @param \Laminas\Db\Adapter\AdapterInterface $adapter
|
|
|
70 |
* @param \LeadersLinked\Cache\CacheInterface $cache
|
|
|
71 |
* @param \Laminas\Log\LoggerInterface LoggerInterface $logger
|
|
|
72 |
* @param array $config
|
|
|
73 |
* @param \Laminas\Mvc\I18n\Translator $translator
|
|
|
74 |
*/
|
|
|
75 |
public function __construct($adapter, $cache, $logger, $config, $translator)
|
|
|
76 |
{
|
|
|
77 |
$this->adapter = $adapter;
|
|
|
78 |
$this->cache = $cache;
|
|
|
79 |
$this->logger = $logger;
|
|
|
80 |
$this->config = $config;
|
|
|
81 |
$this->translator = $translator;
|
|
|
82 |
}
|
341 |
www |
83 |
|
|
|
84 |
public function cryptoAction()
|
|
|
85 |
{
|
|
|
86 |
header('Content-type: text/plain');
|
|
|
87 |
|
|
|
88 |
|
343 |
www |
89 |
$email = '{"ct":"eZd1aD5p3miv+UsN/7CfAst+8U/Tu4de/n5Rmaf/VsicEYlJG3DH4JvRoxCUwcSA","iv":"8abe13978c33e8701857c6377f09864c","s":"cb61b5d25010408b"}';
|
|
|
90 |
$password = '{"ct":"v5maMXocpQT5Jr02vBzXhw==","iv":"a2f8244c89dd690c60ded5f49092d552","s":"522aeee2356f0677"}';
|
341 |
www |
91 |
$aes = 'HP8Rc6vBnr2CJyVG';
|
|
|
92 |
|
|
|
93 |
echo "Email = $email \r\n";
|
|
|
94 |
echo "Password = $password \r\n";
|
|
|
95 |
echo "AES = $aes \r\n\r\n";
|
|
|
96 |
|
|
|
97 |
$emailDecrypt = CryptoJsAes::decrypt($email, $aes);
|
|
|
98 |
$passwordDecrypt = CryptoJsAes::decrypt($password, $aes);
|
|
|
99 |
|
|
|
100 |
echo "EmailDecrypt = $emailDecrypt \r\n";
|
|
|
101 |
echo "PasswordDecrypt = $passwordDecrypt \r\n";
|
|
|
102 |
|
|
|
103 |
exit;
|
|
|
104 |
}
|
1 |
efrain |
105 |
|
333 |
www |
106 |
|
|
|
107 |
public function storageAction()
|
|
|
108 |
{
|
|
|
109 |
$currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
|
|
|
110 |
$currentNetwork = $currentNetworkPlugin->getNetwork();
|
|
|
111 |
|
|
|
112 |
$request = $this->getRequest();
|
|
|
113 |
if ($request->isGet()) {
|
|
|
114 |
|
|
|
115 |
$code = $this->params()->fromRoute('code');
|
|
|
116 |
if(empty($code)) {
|
|
|
117 |
$data = [
|
|
|
118 |
'success' => false,
|
|
|
119 |
'data' => 'ERROR_STORAGE_CODE_INVALID'
|
|
|
120 |
];
|
|
|
121 |
|
|
|
122 |
return new JsonModel($data);
|
|
|
123 |
}
|
|
|
124 |
|
|
|
125 |
$storageFileMapper = \LeadersLinked\Mapper\StorageFileMapper::getInstance($this->adapter);
|
|
|
126 |
$storageFile = $storageFileMapper->fetchOneByCode($code);
|
|
|
127 |
|
|
|
128 |
|
|
|
129 |
|
|
|
130 |
if($storageFile) {
|
|
|
131 |
|
|
|
132 |
|
|
|
133 |
if(file_exists($storageFile->path)) {
|
|
|
134 |
|
|
|
135 |
// Try to open file
|
|
|
136 |
if (!is_readable($storageFile->path)) {
|
|
|
137 |
return $this->getResponse()->setStatusCode(500);
|
|
|
138 |
}
|
|
|
139 |
|
|
|
140 |
// Get file size in bytes.
|
|
|
141 |
$fileSize = filesize($storageFile->path);
|
|
|
142 |
|
|
|
143 |
// Get MIME type of the file.
|
|
|
144 |
$mimeType = mime_content_type($storageFile->path);
|
|
|
145 |
if($mimeType===false) {
|
|
|
146 |
$mimeType = 'application/octet-stream';
|
|
|
147 |
}
|
|
|
148 |
|
|
|
149 |
$fileContent = file_get_contents($storageFile->path);
|
|
|
150 |
|
|
|
151 |
$response = $this->getResponse();
|
|
|
152 |
$headers = $response->getHeaders();
|
|
|
153 |
$headers->addHeaderLine('Content-type: ' . $mimeType);
|
|
|
154 |
$headers->addHeaderLine('Content-length: ' . $fileSize);
|
|
|
155 |
|
|
|
156 |
if($fileContent!==false) {
|
|
|
157 |
$response->setContent($fileContent);
|
|
|
158 |
return $response;
|
|
|
159 |
} else {
|
|
|
160 |
$this->getResponse()->setStatusCode(500);
|
|
|
161 |
return;
|
|
|
162 |
}
|
|
|
163 |
} else {
|
|
|
164 |
return $this->getResponse()->setStatusCode(404);
|
|
|
165 |
}
|
|
|
166 |
|
|
|
167 |
} else {
|
|
|
168 |
return $this->getResponse()->setStatusCode(404);
|
|
|
169 |
}
|
|
|
170 |
|
|
|
171 |
|
|
|
172 |
|
|
|
173 |
|
|
|
174 |
|
|
|
175 |
|
|
|
176 |
|
|
|
177 |
} else {
|
|
|
178 |
$data = [
|
|
|
179 |
'success' => false,
|
|
|
180 |
'data' => 'ERROR_METHOD_NOT_ALLOWED'
|
|
|
181 |
];
|
|
|
182 |
|
|
|
183 |
return new JsonModel($data);
|
|
|
184 |
}
|
|
|
185 |
}
|
1 |
efrain |
186 |
|
|
|
187 |
|
|
|
188 |
public function indexAction()
|
|
|
189 |
{
|
|
|
190 |
/*
|
|
|
191 |
if(!empty($this->config['leaderslinked.runmode.autologin'])) {
|
|
|
192 |
|
|
|
193 |
$currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
|
|
|
194 |
$currentNetwork = $currentNetworkPlugin->getNetwork();
|
|
|
195 |
|
|
|
196 |
$authService = new AuthenticationService();
|
|
|
197 |
if(!$authService->hasIdentity()) {
|
|
|
198 |
$adapter = new AuthEmailAdapter($this->adapter);
|
|
|
199 |
$adapter->setData('santiago.olivera@leaderslinked.com', $currentNetwork->id);
|
|
|
200 |
|
|
|
201 |
$authService->authenticate($adapter);
|
|
|
202 |
}
|
|
|
203 |
}
|
257 |
efrain |
204 |
/*
|
1 |
efrain |
205 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
|
|
206 |
if ($currentUserPlugin->hasIdentity()) {
|
|
|
207 |
return $this->redirect()->toRoute('dashboard');
|
|
|
208 |
} else {
|
|
|
209 |
return $this->redirect()->toRoute('signin');
|
|
|
210 |
}*/
|
|
|
211 |
|
|
|
212 |
$currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
|
|
|
213 |
$currentNetwork = $currentNetworkPlugin->getNetwork();
|
|
|
214 |
|
|
|
215 |
$request = $this->getRequest();
|
|
|
216 |
if ($request->isGet()) {
|
|
|
217 |
|
|
|
218 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
|
|
219 |
|
|
|
220 |
if (empty($_SESSION['aes'])) {
|
|
|
221 |
$_SESSION['aes'] = Functions::generatePassword(16);
|
|
|
222 |
}
|
|
|
223 |
|
|
|
224 |
if ($this->config['leaderslinked.runmode.sandbox']) {
|
|
|
225 |
$site_key = $this->config['leaderslinked.google_captcha.sandbox_site_key'];
|
|
|
226 |
} else {
|
|
|
227 |
$site_key = $this->config['leaderslinked.google_captcha.production_site_key'];
|
|
|
228 |
}
|
|
|
229 |
|
|
|
230 |
$access_usign_social_networks = $this->config['leaderslinked.runmode.access_usign_social_networks'];
|
|
|
231 |
|
|
|
232 |
|
|
|
233 |
|
|
|
234 |
$sandbox = $this->config['leaderslinked.runmode.sandbox'];
|
|
|
235 |
if ($sandbox) {
|
|
|
236 |
$google_map_key = $this->config['leaderslinked.google_map.sandbox_api_key'];
|
|
|
237 |
} else {
|
|
|
238 |
$google_map_key = $this->config['leaderslinked.google_map.production_api_key'];
|
|
|
239 |
}
|
257 |
efrain |
240 |
|
|
|
241 |
|
|
|
242 |
|
1 |
efrain |
243 |
|
257 |
efrain |
244 |
$data = [
|
1 |
efrain |
245 |
'site_key' => $site_key,
|
|
|
246 |
'google_map_key' => $google_map_key,
|
|
|
247 |
'aes' => $_SESSION['aes'],
|
|
|
248 |
'defaultNetwork' => $currentNetwork->default,
|
|
|
249 |
'is_logged_in' => $currentUserPlugin->hasIdentity() ? true : false,
|
7 |
efrain |
250 |
'access_usign_social_networks' => $access_usign_social_networks && $currentNetwork && $currentNetwork->default == Network::DEFAULT_YES ? 'y' : 'n',
|
257 |
efrain |
251 |
];
|
1 |
efrain |
252 |
|
257 |
efrain |
253 |
if($currentNetwork->default == Network::DEFAULT_YES) {
|
|
|
254 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
|
|
255 |
if ($currentUserPlugin->hasIdentity()) {
|
|
|
256 |
$externalCredentials = ExternalCredentials::getInstancia($this->config, $this->adapter);
|
|
|
257 |
$externalCredentials->getUserBy($currentUserPlugin->getUserId());
|
|
|
258 |
|
|
|
259 |
if($currentNetwork->xmpp_active) {
|
|
|
260 |
$data['xmpp_domain'] = $currentNetwork->xmpp_domain;
|
|
|
261 |
$data['xmpp_hostname'] = $currentNetwork->xmpp_hostname;
|
|
|
262 |
$data['xmpp_port'] = $currentNetwork->xmpp_port;
|
|
|
263 |
$data['xmpp_username'] = $externalCredentials->getUsernameXmpp();
|
|
|
264 |
$data['xmpp_password'] = $externalCredentials->getPasswordXmpp();
|
283 |
www |
265 |
$data['inmail_username'] = $externalCredentials->getUsernameInmail();
|
|
|
266 |
$data['inmail_password'] = $externalCredentials->getPasswordInmail();
|
257 |
efrain |
267 |
}
|
|
|
268 |
}
|
|
|
269 |
}
|
|
|
270 |
|
|
|
271 |
return new JsonModel($data);
|
|
|
272 |
|
1 |
efrain |
273 |
|
|
|
274 |
} else {
|
|
|
275 |
$data = [
|
|
|
276 |
'success' => false,
|
|
|
277 |
'data' => 'ERROR_METHOD_NOT_ALLOWED'
|
|
|
278 |
];
|
|
|
279 |
|
|
|
280 |
return new JsonModel($data);
|
|
|
281 |
}
|
|
|
282 |
|
|
|
283 |
}
|
|
|
284 |
|
|
|
285 |
|
|
|
286 |
|
|
|
287 |
|
|
|
288 |
public function privacyPolicyAction()
|
|
|
289 |
{
|
|
|
290 |
|
|
|
291 |
|
|
|
292 |
|
|
|
293 |
|
|
|
294 |
$pageCode = Page::PAGE_CODE_PRIVACY_POLICY;
|
|
|
295 |
|
|
|
296 |
$currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
|
|
|
297 |
$currentNetwork = $currentNetworkPlugin->getNetwork();
|
|
|
298 |
|
|
|
299 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
|
|
300 |
|
|
|
301 |
$pageMapper = PageMapper::getInstance($this->adapter);
|
|
|
302 |
$page = $pageMapper->fetchOneByCodeAndNetworkId($pageCode, $currentNetwork->id);
|
|
|
303 |
|
|
|
304 |
if (!$page) {
|
|
|
305 |
$networkMapper = NetworkMapper::getInstance($this->adapter);
|
|
|
306 |
$network = $networkMapper->fetchOneByDefault();
|
|
|
307 |
|
|
|
308 |
$pageDefault = $pageMapper->fetchOneByCodeAndNetworkId($pageCode, $network->id);
|
|
|
309 |
if ($pageDefault) {
|
|
|
310 |
$page = new Page();
|
|
|
311 |
$page->network_id = $currentNetwork->id;
|
|
|
312 |
$page->code = $pageDefault->code;
|
|
|
313 |
$page->content = $pageDefault->content;
|
|
|
314 |
$page->fixed = $pageDefault->fixed;
|
|
|
315 |
$page->page_default_id = $pageDefault->id;
|
|
|
316 |
$page->title = $pageDefault->title;
|
|
|
317 |
$page->status = $pageDefault->status;
|
|
|
318 |
$page->type = $pageDefault->type;
|
|
|
319 |
$page->url = $pageDefault->url;
|
|
|
320 |
|
|
|
321 |
$pageMapper->insert($page);
|
|
|
322 |
}
|
|
|
323 |
}
|
|
|
324 |
|
|
|
325 |
return new JsonModel([
|
|
|
326 |
'success' => true,
|
|
|
327 |
'data' => [
|
|
|
328 |
'title' => $page->title,
|
|
|
329 |
'content' => $page->content
|
|
|
330 |
]
|
|
|
331 |
]);
|
|
|
332 |
|
|
|
333 |
}
|
|
|
334 |
|
|
|
335 |
public function cookiesAction()
|
|
|
336 |
{
|
|
|
337 |
|
|
|
338 |
$pageCode = Page::PAGE_CODE_COOKIES;
|
|
|
339 |
|
|
|
340 |
$currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
|
|
|
341 |
$currentNetwork = $currentNetworkPlugin->getNetwork();
|
|
|
342 |
|
|
|
343 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
|
|
344 |
|
|
|
345 |
$pageMapper = PageMapper::getInstance($this->adapter);
|
|
|
346 |
$page = $pageMapper->fetchOneByCodeAndNetworkId($pageCode, $currentNetwork->id);
|
|
|
347 |
|
|
|
348 |
if (!$page) {
|
|
|
349 |
$networkMapper = NetworkMapper::getInstance($this->adapter);
|
|
|
350 |
$network = $networkMapper->fetchOneByDefault();
|
|
|
351 |
|
|
|
352 |
$pageDefault = $pageMapper->fetchOneByCodeAndNetworkId($pageCode, $network->id);
|
|
|
353 |
if ($pageDefault) {
|
|
|
354 |
$page = new Page();
|
|
|
355 |
$page->network_id = $currentNetwork->id;
|
|
|
356 |
$page->code = $pageDefault->code;
|
|
|
357 |
$page->content = $pageDefault->content;
|
|
|
358 |
$page->fixed = $pageDefault->fixed;
|
|
|
359 |
$page->page_default_id = $pageDefault->id;
|
|
|
360 |
$page->title = $pageDefault->title;
|
|
|
361 |
$page->status = $pageDefault->status;
|
|
|
362 |
$page->type = $pageDefault->type;
|
|
|
363 |
$page->url = $pageDefault->url;
|
|
|
364 |
|
|
|
365 |
$pageMapper->insert($page);
|
|
|
366 |
}
|
|
|
367 |
}
|
|
|
368 |
|
|
|
369 |
return new JsonModel([
|
|
|
370 |
'success' => true,
|
|
|
371 |
'data' => [
|
|
|
372 |
'title' => $page->title,
|
|
|
373 |
'content' => $page->content
|
|
|
374 |
]
|
|
|
375 |
]);
|
|
|
376 |
}
|
|
|
377 |
|
|
|
378 |
public function professionalismPolicyAction()
|
|
|
379 |
{
|
|
|
380 |
$pageCode = Page::PAGE_CODE_PROFESSIONALISM_POLICY;
|
|
|
381 |
|
|
|
382 |
$currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
|
|
|
383 |
$currentNetwork = $currentNetworkPlugin->getNetwork();
|
|
|
384 |
|
|
|
385 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
|
|
386 |
|
|
|
387 |
|
|
|
388 |
$pageMapper = PageMapper::getInstance($this->adapter);
|
|
|
389 |
$page = $pageMapper->fetchOneByCodeAndNetworkId($pageCode, $currentNetwork->id);
|
|
|
390 |
|
|
|
391 |
if (!$page) {
|
|
|
392 |
$networkMapper = NetworkMapper::getInstance($this->adapter);
|
|
|
393 |
$network = $networkMapper->fetchOneByDefault();
|
|
|
394 |
|
|
|
395 |
$pageDefault = $pageMapper->fetchOneByCodeAndNetworkId($pageCode, $network->id);
|
|
|
396 |
if ($pageDefault) {
|
|
|
397 |
$page = new Page();
|
|
|
398 |
$page->network_id = $currentNetwork->id;
|
|
|
399 |
$page->code = $pageDefault->code;
|
|
|
400 |
$page->content = $pageDefault->content;
|
|
|
401 |
$page->fixed = $pageDefault->fixed;
|
|
|
402 |
$page->page_default_id = $pageDefault->id;
|
|
|
403 |
$page->title = $pageDefault->title;
|
|
|
404 |
$page->status = $pageDefault->status;
|
|
|
405 |
$page->type = $pageDefault->type;
|
|
|
406 |
$page->url = $pageDefault->url;
|
|
|
407 |
|
|
|
408 |
$pageMapper->insert($page);
|
|
|
409 |
}
|
|
|
410 |
}
|
|
|
411 |
|
|
|
412 |
return new JsonModel([
|
|
|
413 |
'success' => true,
|
|
|
414 |
'data' => [
|
|
|
415 |
'title' => $page->title,
|
|
|
416 |
'content' => $page->content
|
|
|
417 |
]
|
|
|
418 |
]);
|
|
|
419 |
}
|
|
|
420 |
|
|
|
421 |
|
|
|
422 |
public function termsAndConditionsAction()
|
|
|
423 |
{
|
|
|
424 |
$pageCode = Page::PAGE_CODE_TERMS_AND_CONDITIONS;
|
|
|
425 |
|
|
|
426 |
$currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
|
|
|
427 |
$currentNetwork = $currentNetworkPlugin->getNetwork();
|
|
|
428 |
|
|
|
429 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
|
|
430 |
|
|
|
431 |
|
|
|
432 |
$pageMapper = PageMapper::getInstance($this->adapter);
|
|
|
433 |
$page = $pageMapper->fetchOneByCodeAndNetworkId($pageCode, $currentNetwork->id);
|
|
|
434 |
|
|
|
435 |
if (!$page) {
|
|
|
436 |
$networkMapper = NetworkMapper::getInstance($this->adapter);
|
|
|
437 |
$network = $networkMapper->fetchOneByDefault();
|
|
|
438 |
|
|
|
439 |
$pageDefault = $pageMapper->fetchOneByCodeAndNetworkId($pageCode, $network->id);
|
|
|
440 |
if ($pageDefault) {
|
|
|
441 |
$page = new Page();
|
|
|
442 |
$page->network_id = $currentNetwork->id;
|
|
|
443 |
$page->code = $pageDefault->code;
|
|
|
444 |
$page->content = $pageDefault->content;
|
|
|
445 |
$page->fixed = $pageDefault->fixed;
|
|
|
446 |
$page->page_default_id = $pageDefault->id;
|
|
|
447 |
$page->title = $pageDefault->title;
|
|
|
448 |
$page->status = $pageDefault->status;
|
|
|
449 |
$page->type = $pageDefault->type;
|
|
|
450 |
$page->url = $pageDefault->url;
|
|
|
451 |
|
|
|
452 |
$pageMapper->insert($page);
|
|
|
453 |
}
|
|
|
454 |
}
|
|
|
455 |
|
|
|
456 |
return new JsonModel([
|
|
|
457 |
'success' => true,
|
|
|
458 |
'data' => [
|
|
|
459 |
'title' => $page->title,
|
|
|
460 |
'content' => $page->content
|
|
|
461 |
]
|
|
|
462 |
]);
|
|
|
463 |
}
|
|
|
464 |
|
|
|
465 |
public function checkSessionAction()
|
|
|
466 |
{
|
|
|
467 |
|
|
|
468 |
$request = $this->getRequest();
|
|
|
469 |
if ($request->isGet()) {
|
|
|
470 |
|
|
|
471 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
|
|
472 |
if (!$currentUserPlugin->hasIdentity()) {
|
|
|
473 |
//$flashMessenger = $this->plugin('FlashMessenger');
|
|
|
474 |
//$flashMessenger->addErrorMessage('ERROR_SESSION_NOT_FOUND');
|
|
|
475 |
|
|
|
476 |
$response = [
|
|
|
477 |
'success' => false,
|
|
|
478 |
'data' => [
|
|
|
479 |
'message' => '', //ERROR_SESSION_NOT_FOUND',
|
|
|
480 |
'url' => $this->url()->fromRoute('signout')
|
|
|
481 |
]
|
|
|
482 |
];
|
|
|
483 |
|
|
|
484 |
return new JsonModel($response);
|
|
|
485 |
}
|
|
|
486 |
|
|
|
487 |
$currentUser = $currentUserPlugin->getUser();
|
|
|
488 |
|
|
|
489 |
|
|
|
490 |
if ($currentUser->last_activity_on) {
|
|
|
491 |
$last_activity_on = strtotime($currentUser->last_activity_on);
|
|
|
492 |
} else {
|
|
|
493 |
$last_activity_on = strtotime('-1 day');
|
|
|
494 |
}
|
|
|
495 |
|
|
|
496 |
$expiry_time = $last_activity_on + $this->config['leaderslinked.security.last_activity_expired'];
|
|
|
497 |
if (time() > $expiry_time) {
|
|
|
498 |
//$flashMessenger = $this->plugin('FlashMessenger');
|
|
|
499 |
//$flashMessenger->addErrorMessage('ERROR_SESSION_EXPIRED');
|
|
|
500 |
|
|
|
501 |
$response = [
|
|
|
502 |
'success' => false,
|
|
|
503 |
'data' => [
|
|
|
504 |
'message' => 'ERROR_SESSION_EXPIRED',
|
|
|
505 |
'url' => $this->url()->fromRoute('signout')
|
|
|
506 |
]
|
|
|
507 |
];
|
|
|
508 |
} else {
|
|
|
509 |
$notificationMapper = NotificationMapper::getInstance($this->adapter);
|
|
|
510 |
$total_notifications = $notificationMapper->fetchUnreadNotificationsCount($currentUser->id);
|
|
|
511 |
|
283 |
www |
512 |
/*
|
1 |
efrain |
513 |
$messageMapper = MessageMapper::getInstance($this->adapter);
|
283 |
www |
514 |
$total_messages = $messageMapper->fetchCountUnreadMessagesReceiverId($currentUser->id);*/
|
|
|
515 |
|
|
|
516 |
$total_messages = 0;
|
1 |
efrain |
517 |
$response = [
|
|
|
518 |
'success' => true,
|
|
|
519 |
'data' => [
|
|
|
520 |
'total_notifications' => $total_notifications,
|
|
|
521 |
'total_messages' => $total_messages
|
|
|
522 |
]
|
|
|
523 |
];
|
|
|
524 |
}
|
|
|
525 |
} else {
|
|
|
526 |
$response = [
|
|
|
527 |
'success' => false,
|
|
|
528 |
'data' => 'ERROR_METHOD_NOT_ALLOWED'
|
|
|
529 |
];
|
|
|
530 |
}
|
|
|
531 |
|
|
|
532 |
return new JsonModel($response);
|
|
|
533 |
}
|
|
|
534 |
|
|
|
535 |
|
|
|
536 |
|
|
|
537 |
|
|
|
538 |
|
|
|
539 |
public function incTotalExternalSharedAction()
|
|
|
540 |
{
|
|
|
541 |
|
|
|
542 |
$request = $this->getRequest();
|
|
|
543 |
if ($request->isPost()) {
|
|
|
544 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
|
|
545 |
$currentUser = $currentUserPlugin->getUser();
|
|
|
546 |
|
|
|
547 |
$currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
|
|
|
548 |
$currentNetwork = $currentNetworkPlugin->getNetwork();
|
|
|
549 |
|
|
|
550 |
$code = $this->params()->fromRoute('code');
|
|
|
551 |
$type = $this->params()->fromRoute('type');
|
|
|
552 |
$user = $this->params()->fromRoute('user');
|
|
|
553 |
$timestamp = intval($this->params()->fromRoute('timestamp'), 10);
|
|
|
554 |
$rand = intval($this->params()->fromRoute('rand'), 10);
|
|
|
555 |
$password = $this->params()->fromRoute('password');
|
|
|
556 |
|
|
|
557 |
|
|
|
558 |
|
|
|
559 |
$checkpassword = '';
|
|
|
560 |
|
|
|
561 |
|
|
|
562 |
$userCheck = '';
|
|
|
563 |
if ($user && $timestamp > 0 && $rand > 0 && $password) {
|
|
|
564 |
$userMapper = UserMapper::getInstance($this->adapter);
|
|
|
565 |
$userCheck = $userMapper->fetchOneByUuid($user);
|
|
|
566 |
if ($userCheck) {
|
|
|
567 |
$checkpassword = md5('user-' . $userCheck->uuid . '-' . $type . '-' . $code . '-timestamp-' . $timestamp . '-rand-' . $rand . '-share-key-' . $userCheck->share_key);
|
|
|
568 |
}
|
|
|
569 |
}
|
|
|
570 |
|
|
|
571 |
if (empty($password) || $password != $checkpassword) {
|
|
|
572 |
$data = [
|
|
|
573 |
'success' => false,
|
|
|
574 |
'data' => 'ERROR_UNAUTHORIZED'
|
|
|
575 |
];
|
|
|
576 |
|
|
|
577 |
return new JsonModel($data);
|
|
|
578 |
}
|
|
|
579 |
|
|
|
580 |
|
|
|
581 |
|
|
|
582 |
|
|
|
583 |
|
|
|
584 |
|
|
|
585 |
|
|
|
586 |
|
|
|
587 |
|
|
|
588 |
if ($type == 'feed' && $code) {
|
|
|
589 |
$feedMapper = FeedMapper::getInstance($this->adapter);
|
|
|
590 |
$feed = $feedMapper->fetchOneByUuidAnyStatus($code);
|
|
|
591 |
|
|
|
592 |
|
|
|
593 |
if ($feed) {
|
|
|
594 |
|
|
|
595 |
if ($feed->network_id != $currentNetwork->id) {
|
|
|
596 |
$data = [
|
|
|
597 |
'success' => false,
|
|
|
598 |
'data' => 'ERROR_UNAUTHORIZED'
|
|
|
599 |
];
|
|
|
600 |
|
|
|
601 |
return new JsonModel($data);
|
|
|
602 |
}
|
|
|
603 |
|
|
|
604 |
if ($feedMapper->incTotalExternalShared($feed->id)) {
|
|
|
605 |
$total = $feedMapper->fetchTotalExternalShared($feed->id);
|
|
|
606 |
|
|
|
607 |
$this->logger->info('El usuario : ' . trim($currentUser->first_name . ' ' . $currentUser->last_name) . ' (' . $currentUser->email . ') compartio externamente el feed : ' . $feed->title);
|
|
|
608 |
|
|
|
609 |
$data = [
|
|
|
610 |
'success' => true,
|
|
|
611 |
'data' => $total,
|
|
|
612 |
];
|
|
|
613 |
|
|
|
614 |
return new JsonModel($data);
|
|
|
615 |
} else {
|
|
|
616 |
$data = [
|
|
|
617 |
'success' => false,
|
|
|
618 |
'data' => $feedMapper->getError()
|
|
|
619 |
];
|
|
|
620 |
|
|
|
621 |
return new JsonModel($data);
|
|
|
622 |
}
|
|
|
623 |
} else {
|
|
|
624 |
$data = [
|
|
|
625 |
'success' => false,
|
|
|
626 |
'data' => 'ERROR_FEED_NOT_FOUND',
|
|
|
627 |
];
|
|
|
628 |
|
|
|
629 |
return new JsonModel($data);
|
|
|
630 |
}
|
|
|
631 |
} else if ($type == 'post' && $code) {
|
|
|
632 |
|
|
|
633 |
$postMapper = PostMapper::getInstance($this->adapter);
|
|
|
634 |
$post = $postMapper->fetchOneByUuid($code);
|
|
|
635 |
|
|
|
636 |
if ($post && $post->status == Post::STATUS_ACTIVE) {
|
|
|
637 |
|
|
|
638 |
if ($post->network_id != $currentNetwork->id) {
|
|
|
639 |
$data = [
|
|
|
640 |
'success' => false,
|
|
|
641 |
'data' => 'ERROR_UNAUTHORIZED'
|
|
|
642 |
];
|
|
|
643 |
|
|
|
644 |
return new JsonModel($data);
|
|
|
645 |
}
|
|
|
646 |
|
|
|
647 |
|
|
|
648 |
if ($postMapper->incTotalExternalShared($post->id)) {
|
|
|
649 |
$total = $postMapper->fetchTotalExternalShared($post->id);
|
|
|
650 |
|
|
|
651 |
$this->logger->info('El usuario : ' . trim($currentUser->first_name . ' ' . $currentUser->last_name) . ' (' . $currentUser->email . ') compartio externamente el post : ' . $post->title);
|
|
|
652 |
|
|
|
653 |
|
|
|
654 |
|
|
|
655 |
$data = [
|
|
|
656 |
'success' => true,
|
|
|
657 |
'data' => $total,
|
|
|
658 |
];
|
|
|
659 |
|
|
|
660 |
return new JsonModel($data);
|
|
|
661 |
} else {
|
|
|
662 |
$data = [
|
|
|
663 |
'success' => false,
|
|
|
664 |
'data' => $postMapper->getError()
|
|
|
665 |
];
|
|
|
666 |
|
|
|
667 |
return new JsonModel($data);
|
|
|
668 |
}
|
|
|
669 |
} else {
|
|
|
670 |
$data = [
|
|
|
671 |
'success' => false,
|
|
|
672 |
'data' => 'ERROR_POST_NOT_FOUND'
|
|
|
673 |
];
|
|
|
674 |
|
|
|
675 |
return new JsonModel($data);
|
|
|
676 |
}
|
|
|
677 |
}
|
|
|
678 |
} else {
|
|
|
679 |
$response = [
|
|
|
680 |
'success' => false,
|
|
|
681 |
'data' => 'ERROR_METHOD_NOT_ALLOWED'
|
|
|
682 |
];
|
|
|
683 |
|
|
|
684 |
return new JsonModel($response);
|
|
|
685 |
}
|
|
|
686 |
}
|
|
|
687 |
|
247 |
efrain |
688 |
|
|
|
689 |
|
|
|
690 |
public function languageAction()
|
|
|
691 |
{
|
|
|
692 |
$request = $this->getRequest();
|
|
|
693 |
|
|
|
694 |
if ($request->isGet()) {
|
|
|
695 |
|
|
|
696 |
|
|
|
697 |
|
|
|
698 |
$pathname = dirname(__DIR__);
|
|
|
699 |
$filename = $pathname . DIRECTORY_SEPARATOR . 'i18n' . DIRECTORY_SEPARATOR . 'spanish.php';
|
|
|
700 |
|
|
|
701 |
|
|
|
702 |
if(file_exists($filename)) {
|
|
|
703 |
|
|
|
704 |
$arr = include $filename;
|
|
|
705 |
$arr = array_filter($arr, function($a) {
|
|
|
706 |
return strpos($a, 'LABEL_') !== false;
|
|
|
707 |
}, ARRAY_FILTER_USE_KEY);
|
|
|
708 |
|
|
|
709 |
|
|
|
710 |
$data = [];
|
|
|
711 |
foreach($arr as $key => $value)
|
|
|
712 |
{
|
|
|
713 |
$key = str_replace('LABEL_', 'LANG_', $key);
|
|
|
714 |
|
|
|
715 |
$data[ $key ] = $value;
|
|
|
716 |
|
|
|
717 |
}
|
|
|
718 |
|
|
|
719 |
|
|
|
720 |
|
|
|
721 |
$response = [
|
|
|
722 |
'success' => true,
|
|
|
723 |
'data' => $data
|
|
|
724 |
];
|
|
|
725 |
|
|
|
726 |
return new JsonModel($response);
|
|
|
727 |
|
|
|
728 |
|
|
|
729 |
} else {
|
|
|
730 |
$response = [
|
|
|
731 |
'success' => false,
|
|
|
732 |
'data' => 'ERROR_METHOD_NOT_ALLOWED'
|
|
|
733 |
];
|
|
|
734 |
|
|
|
735 |
return new JsonModel($response);
|
|
|
736 |
}
|
|
|
737 |
|
|
|
738 |
|
|
|
739 |
|
|
|
740 |
|
|
|
741 |
|
|
|
742 |
} else {
|
|
|
743 |
$response = [
|
|
|
744 |
'success' => false,
|
|
|
745 |
'data' => 'ERROR_METHOD_NOT_ALLOWED'
|
|
|
746 |
];
|
|
|
747 |
|
|
|
748 |
return new JsonModel($response);
|
|
|
749 |
}
|
|
|
750 |
|
|
|
751 |
|
|
|
752 |
}
|
|
|
753 |
|
1 |
efrain |
754 |
public function shareAction()
|
|
|
755 |
{
|
|
|
756 |
$request = $this->getRequest();
|
|
|
757 |
if ($request->isGet()) {
|
|
|
758 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
|
|
759 |
$currentUser = $currentUserPlugin->getUser();
|
247 |
efrain |
760 |
|
1 |
efrain |
761 |
$code = $this->params()->fromRoute('code');
|
|
|
762 |
$type = $this->params()->fromRoute('type');
|
|
|
763 |
$user = $this->params()->fromRoute('user');
|
|
|
764 |
$timestamp = intval($this->params()->fromRoute('timestamp'), 10);
|
|
|
765 |
$rand = intval($this->params()->fromRoute('rand'), 10);
|
|
|
766 |
$password = $this->params()->fromRoute('password');
|
247 |
efrain |
767 |
|
|
|
768 |
|
|
|
769 |
|
1 |
efrain |
770 |
$checkpassword = '';
|
247 |
efrain |
771 |
|
|
|
772 |
|
1 |
efrain |
773 |
$userCheck = '';
|
|
|
774 |
if ($user && $timestamp > 0 && $rand > 0 && $password) {
|
|
|
775 |
$userMapper = UserMapper::getInstance($this->adapter);
|
|
|
776 |
$userCheck = $userMapper->fetchOneByUuid($user);
|
|
|
777 |
if ($userCheck) {
|
|
|
778 |
$checkpassword = md5('user-' . $userCheck->uuid . '-' . $type . '-' . $code . '-timestamp-' . $timestamp . '-rand-' . $rand . '-share-key-' . $userCheck->share_key);
|
|
|
779 |
}
|
|
|
780 |
}
|
247 |
efrain |
781 |
|
1 |
efrain |
782 |
if (empty($password) || $password != $checkpassword) {
|
|
|
783 |
$data = [
|
|
|
784 |
'success' => false,
|
|
|
785 |
'data' => 'ERROR_UNAUTHORIZED'
|
|
|
786 |
];
|
247 |
efrain |
787 |
|
1 |
efrain |
788 |
return new JsonModel($data);
|
|
|
789 |
}
|
247 |
efrain |
790 |
|
1 |
efrain |
791 |
/*
|
247 |
efrain |
792 |
$share_params = [
|
|
|
793 |
'type' => $type,
|
|
|
794 |
'code' => $code,
|
|
|
795 |
'user' => $currentUser->uuid,
|
|
|
796 |
'timestamp' => $timestamp,
|
|
|
797 |
'rand' => $rand,
|
|
|
798 |
'password' => $password,
|
|
|
799 |
];
|
|
|
800 |
|
|
|
801 |
$share_increment_external_counter_url = $this->url()->fromRoute('share/increment-external-counter', $share_params , ['force_canonical' => true]);
|
|
|
802 |
*/
|
1 |
efrain |
803 |
|
254 |
efrain |
804 |
$hostname = empty($_SERVER['HTTP_HOST']) ? '' : $_SERVER['HTTP_HOST'];
|
247 |
efrain |
805 |
|
254 |
efrain |
806 |
$networkMapper = NetworkMapper::getInstance($this->adapter);
|
|
|
807 |
$network = $networkMapper->fetchOneByHostnameForFrontend($hostname);
|
247 |
efrain |
808 |
|
254 |
efrain |
809 |
if(!$network) {
|
|
|
810 |
$network = $networkMapper->fetchOneByDefault();
|
137 |
efrain |
811 |
}
|
247 |
efrain |
812 |
|
254 |
efrain |
813 |
$hostname = trim($network->main_hostname);
|
|
|
814 |
$base_share = 'https://' . $hostname;
|
247 |
efrain |
815 |
|
1 |
efrain |
816 |
$share_url = $base_share . $_SERVER['REQUEST_URI'];
|
|
|
817 |
$share_image = $base_share . '/images/ll-logo.png';
|
|
|
818 |
$share_title = '';
|
|
|
819 |
$share_description = '';
|
249 |
efrain |
820 |
|
247 |
efrain |
821 |
|
|
|
822 |
|
1 |
efrain |
823 |
if ($type == 'feed' && $code) {
|
|
|
824 |
$feedMapper = FeedMapper::getInstance($this->adapter);
|
|
|
825 |
$feed = $feedMapper->fetchOneByUuidAnyStatus($code);
|
247 |
efrain |
826 |
|
1 |
efrain |
827 |
// if($feed && $feed->status == Feed::STATUS_PUBLISHED) {
|
247 |
efrain |
828 |
|
1 |
efrain |
829 |
if ($feed) {
|
247 |
efrain |
830 |
|
1 |
efrain |
831 |
$share_title = $feed->title ? $feed->title : '';
|
247 |
efrain |
832 |
|
1 |
efrain |
833 |
if ($feed->posted_or_shared == Feed::SHARED) {
|
247 |
efrain |
834 |
|
|
|
835 |
|
1 |
efrain |
836 |
$feed = $feedMapper->fetchOneAnyStatus($feed->shared_feed_id);
|
|
|
837 |
if ($feed->title) {
|
247 |
efrain |
838 |
|
1 |
efrain |
839 |
$share_title = $share_title . ' - ' . $feed->title;
|
|
|
840 |
}
|
|
|
841 |
}
|
247 |
efrain |
842 |
|
|
|
843 |
|
1 |
efrain |
844 |
$share_description = $feed->description;
|
247 |
efrain |
845 |
|
1 |
efrain |
846 |
$image_name = '';
|
345 |
www |
847 |
if ($feed->file_type == Storage::FILE_TYPE_IMAGE) {
|
247 |
efrain |
848 |
|
1 |
efrain |
849 |
$image_name = $feed->file_name;
|
|
|
850 |
} else if ($feed->file_image_preview) {
|
|
|
851 |
$image_name = $feed->file_image_preview;
|
|
|
852 |
}
|
247 |
efrain |
853 |
|
|
|
854 |
|
|
|
855 |
|
|
|
856 |
if ($image_name) {
|
|
|
857 |
|
|
|
858 |
$source = $this->config['leaderslinked.fullpath.feed'] . $feed->uuid . DIRECTORY_SEPARATOR . $image_name;
|
|
|
859 |
|
257 |
efrain |
860 |
$target_path = $this->config['leaderslinked.frontend.frontend']. DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'feed' . DIRECTORY_SEPARATOR . $feed->uuid;
|
|
|
861 |
|
247 |
efrain |
862 |
|
|
|
863 |
|
257 |
efrain |
864 |
//$target_path = 'public' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'feed' . DIRECTORY_SEPARATOR . $feed->uuid;
|
|
|
865 |
|
247 |
efrain |
866 |
if (!file_exists($target_path)) {
|
|
|
867 |
mkdir($target_path, 0755, true);
|
|
|
868 |
}
|
|
|
869 |
|
|
|
870 |
|
|
|
871 |
|
|
|
872 |
$target = $target_path . DIRECTORY_SEPARATOR . $image_name;
|
|
|
873 |
|
|
|
874 |
|
|
|
875 |
|
|
|
876 |
if (!file_exists($target)) {
|
|
|
877 |
|
|
|
878 |
copy($source, $target);
|
|
|
879 |
$share_image = $base_share . '/images/feed/' . $feed->uuid . '/' . $image_name;
|
|
|
880 |
} else {
|
|
|
881 |
$share_image = $base_share . '/images/feed/' . $feed->uuid . '/' . $image_name;
|
|
|
882 |
}
|
1 |
efrain |
883 |
}
|
|
|
884 |
} else {
|
247 |
efrain |
885 |
|
249 |
efrain |
886 |
return new JsonModel([
|
|
|
887 |
'success' => false,
|
|
|
888 |
'data' => 'ERROR_FEED_OR_POST_SHARED'
|
|
|
889 |
]);
|
1 |
efrain |
890 |
}
|
|
|
891 |
} else if ($type == 'post' && $code) {
|
247 |
efrain |
892 |
|
1 |
efrain |
893 |
$postMapper = PostMapper::getInstance($this->adapter);
|
|
|
894 |
$post = $postMapper->fetchOneByUuid($code);
|
247 |
efrain |
895 |
|
1 |
efrain |
896 |
if ($post && $post->status == Post::STATUS_ACTIVE) {
|
|
|
897 |
$share_title = $post->title;
|
|
|
898 |
$share_description = $post->description;
|
247 |
efrain |
899 |
|
|
|
900 |
|
1 |
efrain |
901 |
if ($post->image) {
|
|
|
902 |
$source = $this->config['leaderslinked.fullpath.post'] . $post->uuid . DIRECTORY_SEPARATOR . $post->image;
|
247 |
efrain |
903 |
|
|
|
904 |
|
257 |
efrain |
905 |
// $target_path = 'public' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'post' . DIRECTORY_SEPARATOR . $post->uuid;
|
247 |
efrain |
906 |
|
257 |
efrain |
907 |
$target_path = $this->config['leaderslinked.frontend.frontend'] . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'post' . DIRECTORY_SEPARATOR . $post->uuid;
|
|
|
908 |
|
1 |
efrain |
909 |
if (!file_exists($target_path)) {
|
|
|
910 |
mkdir($target_path, 0755, true);
|
|
|
911 |
}
|
247 |
efrain |
912 |
|
|
|
913 |
|
|
|
914 |
|
1 |
efrain |
915 |
$target = $target_path . DIRECTORY_SEPARATOR . $post->image;
|
247 |
efrain |
916 |
|
|
|
917 |
|
|
|
918 |
|
1 |
efrain |
919 |
if (!file_exists($target)) {
|
247 |
efrain |
920 |
|
1 |
efrain |
921 |
copy($source, $target);
|
|
|
922 |
$share_image = $base_share . '/images/post/' . $post->uuid . '/' . $post->image;
|
|
|
923 |
} else {
|
|
|
924 |
$share_image = $base_share . '/images/post/' . $post->uuid . '/' . $post->image;
|
|
|
925 |
}
|
|
|
926 |
}
|
|
|
927 |
} else {
|
247 |
efrain |
928 |
|
249 |
efrain |
929 |
return new JsonModel([
|
|
|
930 |
'success' => false,
|
|
|
931 |
'data' => 'ERROR_FEED_OR_POST_SHARED'
|
|
|
932 |
]);
|
1 |
efrain |
933 |
}
|
|
|
934 |
}
|
247 |
efrain |
935 |
|
1 |
efrain |
936 |
if ($currentUserPlugin->hasIdentity()) {
|
|
|
937 |
$currentUser = $currentUserPlugin->getUser();
|
|
|
938 |
if ($userCheck && $userCheck->status == User::STATUS_ACTIVE && $userCheck->id != $currentUser->id) {
|
247 |
efrain |
939 |
|
1 |
efrain |
940 |
$connectionMapper = ConnectionMapper::getInstance($this->adapter);
|
|
|
941 |
$connection = $connectionMapper->fetchOneByUserId1AndUserId2($currentUser->id, $userCheck->id);
|
247 |
efrain |
942 |
|
1 |
efrain |
943 |
if ($connection) {
|
247 |
efrain |
944 |
|
1 |
efrain |
945 |
if ($connection->status != Connection::STATUS_ACCEPTED) {
|
|
|
946 |
$connectionMapper->approve($connection);
|
|
|
947 |
}
|
|
|
948 |
} else {
|
|
|
949 |
$connection = new Connection();
|
|
|
950 |
$connection->request_from = $currentUser->id;
|
|
|
951 |
$connection->request_to = $userCheck->id;
|
|
|
952 |
$connection->status = Connection::STATUS_ACCEPTED;
|
247 |
efrain |
953 |
|
1 |
efrain |
954 |
$connectionMapper->insert($connection);
|
|
|
955 |
}
|
|
|
956 |
}
|
|
|
957 |
|
|
|
958 |
} else {
|
249 |
efrain |
959 |
$this->cache->setItem('user_share_invitation', [
|
|
|
960 |
'code' => $code,
|
|
|
961 |
'type' => $type,
|
|
|
962 |
'user' => $user
|
|
|
963 |
]);
|
1 |
efrain |
964 |
}
|
|
|
965 |
return new JsonModel([
|
249 |
efrain |
966 |
'success' => true,
|
|
|
967 |
'data' => [
|
|
|
968 |
'image' => $share_image,
|
|
|
969 |
'url' => $share_url,
|
|
|
970 |
'title' => strip_tags($share_title),
|
|
|
971 |
'description' => strip_tags($share_description),
|
|
|
972 |
]
|
247 |
efrain |
973 |
|
1 |
efrain |
974 |
]);
|
|
|
975 |
|
|
|
976 |
} else {
|
|
|
977 |
$response = [
|
|
|
978 |
'success' => false,
|
|
|
979 |
'data' => 'ERROR_METHOD_NOT_ALLOWED'
|
|
|
980 |
];
|
|
|
981 |
|
|
|
982 |
return new JsonModel($response);
|
|
|
983 |
}
|
|
|
984 |
}
|
333 |
www |
985 |
|
|
|
986 |
|
1 |
efrain |
987 |
}
|