@@ 379-508 (lines=130) @@ | ||
376 | * @param int $id |
|
377 | * @return void |
|
378 | */ |
|
379 | public function ParsePubArray($updatesarray, $id) |
|
380 | { |
|
381 | global $xoopsUser, $xoopsTpl, $tpl, $xoopsModule, $xoopsTpl, $xoopsConfig; |
|
382 | ||
383 | $check = new SmallWorldUser; |
|
384 | $dBase = new SmallWorldDB; |
|
385 | $profile = $xoopsUser ? $check->checkIfProfile($id) : 0; |
|
386 | $moduleHandler = xoops_getHandler('module'); |
|
387 | $module = $moduleHandler->getByDirname('smallworld'); |
|
388 | $configHandler = xoops_getHandler('config'); |
|
389 | $moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid')); |
|
390 | ||
391 | $myavatar = $this->Gravatar($id); |
|
392 | $myavatarlink = smallworld_getAvatarLink($id, $myavatar); |
|
393 | $myavatar_size = smallworld_getImageSize(80, 100, $myavatarlink); |
|
394 | $myavatar_highwide = smallworld_imageResize($myavatar_size[0], $myavatar_size[1], 100); |
|
395 | $user_img = "<img src='" . smallworld_getAvatarLink($id, $myavatar) . "' id='smallworld_user_img' " . $myavatar_highwide . '>'; |
|
396 | ||
397 | $xoopsTpl->assign('myavatar', $myavatar); |
|
398 | $xoopsTpl->assign('myavatarlink', $myavatarlink); |
|
399 | $xoopsTpl->assign('myavatar_highwide', $myavatar_highwide); |
|
400 | $xoopsTpl->assign('avatar', $user_img); |
|
401 | ||
402 | if (!empty($updatesarray)) { |
|
403 | foreach ($updatesarray as $data) { |
|
404 | ||
405 | // Is update's user a friend ? |
|
406 | $frU = $check->friendcheck($id, $data['uid_fk']); |
|
407 | ||
408 | $USW = []; |
|
409 | $USW['posts'] = 0; |
|
410 | $USW['comments'] = 0; |
|
411 | ||
412 | if ($xoopsUser) { |
|
413 | if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) || $data['uid_fk'] == $id) { |
|
414 | $USW['posts'] = 1; |
|
415 | $USW['comments'] = 1; |
|
416 | $frU[0] = 2; |
|
417 | } else { |
|
418 | $USW = json_decode($dBase->GetSettings($data['uid_fk']), true); |
|
419 | } |
|
420 | } |
|
421 | ||
422 | if (!$xoopsUser) { |
|
423 | $USW = json_decode($dBase->GetSettings($data['uid_fk']), true); |
|
424 | } |
|
425 | ||
426 | $wm['msg_id'] = $data['msg_id']; |
|
427 | $wm['orimessage'] = (1 == $USW['posts'] || $profile >= 2) ? str_replace(["\r", "\n"], '', Smallworld_stripWordsKeepUrl($data['message'])) : ''; |
|
428 | $wm['message'] = (1 == $USW['posts'] || $profile >= 2) ? smallworld_tolink(htmlspecialchars_decode($data['message']), $data['uid_fk']) : _SMALLWORLD_MESSAGE_PRIVSETPOSTS; |
|
429 | $wm['message'] = Smallworld_cleanup($wm['message']); |
|
430 | $wm['created'] = smallworld_time_stamp($data['created']); |
|
431 | $wm['username'] = $data['username']; |
|
432 | $wm['uid_fk'] = $data['uid_fk']; |
|
433 | $wm['priv'] = $data['priv']; |
|
434 | $wm['avatar'] = $this->Gravatar($data['uid_fk']); |
|
435 | $wm['avatar_link'] = smallworld_getAvatarLink($data['uid_fk'], $wm['avatar']); |
|
436 | $wm['avatar_size'] = smallworld_getImageSize(80, 100, $wm['avatar_link']); |
|
437 | $wm['avatar_highwide'] = smallworld_imageResize($wm['avatar_size'][0], $wm['avatar_size'][1], 50); |
|
438 | $wm['vote_up'] = $this->countVotes('msg', 'up', $data['msg_id']); |
|
439 | $wm['vote_down'] = $this->countVotes('msg', 'down', $data['msg_id']); |
|
440 | $wm['sharelinkurl'] = XOOPS_URL . '/modules/smallworld/smallworldshare.php?ownerid=' . $data['uid_fk']; |
|
441 | $wm['sharelinkurl'] .= '&updid=' . $data['msg_id'] . ''; |
|
442 | $wm['usernameTitle'] = $wm['username'] . _SMALLWORLD_UPDATEONSITEMETA . $xoopsConfig['sitename']; |
|
443 | if (1 == $USW['posts'] || $profile >= 2) { |
|
444 | $wm['sharelink'] = $this->GetSharing($wm['msg_id'], $wm['priv']); |
|
445 | } else { |
|
446 | $wm['sharelink'] = $this->GetSharing($wm['msg_id'], 1); |
|
447 | } |
|
448 | ||
449 | if (1 == $USW['posts'] || $profile >= 2) { |
|
450 | $wm['sharediv'] = $this->GetSharingDiv($wm['msg_id'], $wm['priv'], $wm['sharelinkurl'], $wm['orimessage'], $wm['usernameTitle']); |
|
451 | } else { |
|
452 | $wm['sharediv'] = $this->GetSharingDiv($wm['msg_id'], 1, $wm['sharelinkurl'], $wm['orimessage'], $wm['usernameTitle']); |
|
453 | } |
|
454 | $wm['linkimage'] = XOOPS_URL . '/modules/smallworld/assets/images/link.png'; |
|
455 | $wm['permalink'] = XOOPS_URL . '/modules/smallworld/permalink.php?ownerid=' . $data['uid_fk'] . '&updid=' . $data['msg_id']; |
|
456 | $wm['commentsarray'] = $this->Comments($data['msg_id']); |
|
457 | ||
458 | if (2 == $frU[0] || 1 == $USW['posts']) { |
|
459 | $xoopsTpl->append('walldata', $wm); |
|
460 | } |
|
461 | ||
462 | if (!empty($wm['commentsarray'])) { |
|
463 | foreach ($wm['commentsarray'] as $cdata) { |
|
464 | // Is commentuser a friend ? |
|
465 | $frC = $check->friendcheck($id, $cdata['uid_fk']); |
|
466 | ||
467 | $USC = []; |
|
468 | $USC['posts'] = 0; |
|
469 | $USC['comments'] = 0; |
|
470 | ||
471 | if ($xoopsUser) { |
|
472 | if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) || $cdata['uid_fk'] == $id) { |
|
473 | $USC['posts'] = 1; |
|
474 | $USC['comments'] = 1; |
|
475 | $frC[0] = 2; |
|
476 | } else { |
|
477 | $USC = json_decode($dBase->GetSettings($cdata['uid_fk']), true); |
|
478 | } |
|
479 | } |
|
480 | ||
481 | if (!$xoopsUser) { |
|
482 | $USC = json_decode($dBase->GetSettings($cdata['uid_fk']), true); |
|
483 | } |
|
484 | ||
485 | $wc['msg_id_fk'] = $cdata['msg_id_fk']; |
|
486 | $wc['com_id'] = $cdata['com_id']; |
|
487 | $wc['comment'] = (1 == $USC['comments'] || $profile >= 2) ? smallworld_tolink(htmlspecialchars_decode($cdata['comment']), $cdata['uid_fk']) : _SMALLWORLD_MESSAGE_PRIVSETCOMMENTS; |
|
488 | $wc['comment'] = Smallworld_cleanup($wc['comment']); |
|
489 | $wc['time'] = smallworld_time_stamp($cdata['created']); |
|
490 | $wc['username'] = $cdata['username']; |
|
491 | $wc['uid'] = $cdata['uid_fk']; |
|
492 | $wc['myavatar'] = $this->Gravatar($id); |
|
493 | $wc['myavatar_link'] = $myavatarlink; |
|
494 | $wc['avatar_size'] = smallworld_getImageSize(80, 100, $wc['myavatar_link']); |
|
495 | $wc['avatar_highwide'] = smallworld_imageResize($wc['avatar_size'][0], $wc['avatar_size'][1], 35); |
|
496 | $wc['cface'] = $this->Gravatar($cdata['uid_fk']); |
|
497 | $wc['avatar_link'] = smallworld_getAvatarLink($cdata['uid_fk'], $wc['cface']); |
|
498 | $wc['vote_up'] = $this->countVotesCom('com', 'up', $cdata['msg_id_fk'], $cdata['com_id']); |
|
499 | $wc['vote_down'] = $this->countVotesCom('com', 'down', $cdata['msg_id_fk'], $cdata['com_id']); |
|
500 | ||
501 | if (2 == $frC[0] || 1 == $USC['comments']) { |
|
502 | $xoopsTpl->append('comm', $wc); |
|
503 | } |
|
504 | } |
|
505 | } |
|
506 | } |
|
507 | } |
|
508 | } |
|
509 | } |
|
510 |
@@ 381-510 (lines=130) @@ | ||
378 | * @param int $id |
|
379 | * @return void |
|
380 | */ |
|
381 | public function ParsePubArray($updatesarray, $id) |
|
382 | { |
|
383 | global $xoopsUser, $xoopsTpl, $tpl, $xoopsModule, $xoopsTpl, $xoopsConfig; |
|
384 | $wm = []; |
|
385 | $check = new SmallWorldUser; |
|
386 | $dBase = new SmallWorldDB; |
|
387 | $profile = $xoopsUser ? $check->checkIfProfile($id) : 0; |
|
388 | $moduleHandler = xoops_getHandler('module'); |
|
389 | $module = $moduleHandler->getByDirname('smallworld'); |
|
390 | $configHandler = xoops_getHandler('config'); |
|
391 | $moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid')); |
|
392 | ||
393 | $myavatar = $this->Gravatar($id); |
|
394 | $myavatarlink = smallworld_getAvatarLink($id, $myavatar); |
|
395 | $myavatar_size = smallworld_getImageSize(80, 100, $myavatarlink); |
|
396 | $myavatar_highwide = smallworld_imageResize($myavatar_size[0], $myavatar_size[1], 100); |
|
397 | $user_img = "<img src='" . smallworld_getAvatarLink($id, $myavatar) . "' id='smallworld_user_img' " . $myavatar_highwide . '>'; |
|
398 | ||
399 | $xoopsTpl->assign('myavatar', $myavatar); |
|
400 | $xoopsTpl->assign('myavatarlink', $myavatarlink); |
|
401 | $xoopsTpl->assign('myavatar_highwide', $myavatar_highwide); |
|
402 | $xoopsTpl->assign('avatar', $user_img); |
|
403 | ||
404 | if (!empty($updatesarray)) { |
|
405 | foreach ($updatesarray as $data) { |
|
406 | ||
407 | // Is update's user a friend ? |
|
408 | $frU = $check->friendcheck($id, $data['uid_fk']); |
|
409 | ||
410 | $USW = []; |
|
411 | $USW['posts'] = 0; |
|
412 | $USW['comments'] = 0; |
|
413 | ||
414 | if ($xoopsUser) { |
|
415 | if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) || $data['uid_fk'] == $id) { |
|
416 | $USW['posts'] = 1; |
|
417 | $USW['comments'] = 1; |
|
418 | $frU[0] = 2; |
|
419 | } else { |
|
420 | $USW = json_decode($dBase->GetSettings($data['uid_fk']), true); |
|
421 | } |
|
422 | } |
|
423 | ||
424 | if (!$xoopsUser) { |
|
425 | $USW = json_decode($dBase->GetSettings($data['uid_fk']), true); |
|
426 | } |
|
427 | ||
428 | $wm['msg_id'] = $data['msg_id']; |
|
429 | $wm['orimessage'] = (1 == $USW['posts'] || $profile >= 2) ? str_replace(["\r", "\n"], '', Smallworld_stripWordsKeepUrl($data['message'])) : ''; |
|
430 | $wm['message'] = (1 == $USW['posts'] || $profile >= 2) ? smallworld_tolink(htmlspecialchars_decode($data['message']), $data['uid_fk']) : _SMALLWORLD_MESSAGE_PRIVSETPOSTS; |
|
431 | $wm['message'] = Smallworld_cleanup($wm['message']); |
|
432 | $wm['created'] = smallworld_time_stamp($data['created']); |
|
433 | $wm['username'] = $data['username']; |
|
434 | $wm['uid_fk'] = $data['uid_fk']; |
|
435 | $wm['priv'] = $data['priv']; |
|
436 | $wm['avatar'] = $this->Gravatar($data['uid_fk']); |
|
437 | $wm['avatar_link'] = smallworld_getAvatarLink($data['uid_fk'], $wm['avatar']); |
|
438 | $wm['avatar_size'] = smallworld_getImageSize(80, 100, $wm['avatar_link']); |
|
439 | $wm['avatar_highwide'] = smallworld_imageResize($wm['avatar_size'][0], $wm['avatar_size'][1], 50); |
|
440 | $wm['vote_up'] = $this->countVotes('msg', 'up', $data['msg_id']); |
|
441 | $wm['vote_down'] = $this->countVotes('msg', 'down', $data['msg_id']); |
|
442 | $wm['sharelinkurl'] = XOOPS_URL . '/modules/smallworld/smallworldshare.php?ownerid=' . $data['uid_fk']; |
|
443 | $wm['sharelinkurl'] .= '&updid=' . $data['msg_id'] . ''; |
|
444 | $wm['usernameTitle'] = $wm['username'] . _SMALLWORLD_UPDATEONSITEMETA . $xoopsConfig['sitename']; |
|
445 | if (1 == $USW['posts'] || $profile >= 2) { |
|
446 | $wm['sharelink'] = $this->GetSharing($wm['msg_id'], $wm['priv']); |
|
447 | } else { |
|
448 | $wm['sharelink'] = $this->GetSharing($wm['msg_id'], 1); |
|
449 | } |
|
450 | ||
451 | if (1 == $USW['posts'] || $profile >= 2) { |
|
452 | $wm['sharediv'] = $this->GetSharingDiv($wm['msg_id'], $wm['priv'], $wm['sharelinkurl'], $wm['orimessage'], $wm['usernameTitle']); |
|
453 | } else { |
|
454 | $wm['sharediv'] = $this->GetSharingDiv($wm['msg_id'], 1, $wm['sharelinkurl'], $wm['orimessage'], $wm['usernameTitle']); |
|
455 | } |
|
456 | $wm['linkimage'] = XOOPS_URL . '/modules/smallworld/assets/images/link.png'; |
|
457 | $wm['permalink'] = XOOPS_URL . '/modules/smallworld/permalink.php?ownerid=' . $data['uid_fk'] . '&updid=' . $data['msg_id']; |
|
458 | $wm['commentsarray'] = $this->Comments($data['msg_id']); |
|
459 | ||
460 | if (2 == $frU[0] || 1 == $USW['posts']) { |
|
461 | $xoopsTpl->append('walldata', $wm); |
|
462 | } |
|
463 | ||
464 | if (!empty($wm['commentsarray'])) { |
|
465 | foreach ($wm['commentsarray'] as $cdata) { |
|
466 | // Is commentuser a friend ? |
|
467 | $frC = $check->friendcheck($id, $cdata['uid_fk']); |
|
468 | ||
469 | $USC = []; |
|
470 | $USC['posts'] = 0; |
|
471 | $USC['comments'] = 0; |
|
472 | ||
473 | if ($xoopsUser) { |
|
474 | if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) || $cdata['uid_fk'] == $id) { |
|
475 | $USC['posts'] = 1; |
|
476 | $USC['comments'] = 1; |
|
477 | $frC[0] = 2; |
|
478 | } else { |
|
479 | $USC = json_decode($dBase->GetSettings($cdata['uid_fk']), true); |
|
480 | } |
|
481 | } |
|
482 | ||
483 | if (!$xoopsUser) { |
|
484 | $USC = json_decode($dBase->GetSettings($cdata['uid_fk']), true); |
|
485 | } |
|
486 | ||
487 | $wc['msg_id_fk'] = $cdata['msg_id_fk']; |
|
488 | $wc['com_id'] = $cdata['com_id']; |
|
489 | $wc['comment'] = (1 == $USC['comments'] || $profile >= 2) ? smallworld_tolink(htmlspecialchars_decode($cdata['comment']), $cdata['uid_fk']) : _SMALLWORLD_MESSAGE_PRIVSETCOMMENTS; |
|
490 | $wc['comment'] = Smallworld_cleanup($wc['comment']); |
|
491 | $wc['time'] = smallworld_time_stamp($cdata['created']); |
|
492 | $wc['username'] = $cdata['username']; |
|
493 | $wc['uid'] = $cdata['uid_fk']; |
|
494 | $wc['myavatar'] = $this->Gravatar($id); |
|
495 | $wc['myavatar_link'] = $myavatarlink; |
|
496 | $wc['avatar_size'] = smallworld_getImageSize(80, 100, $wc['myavatar_link']); |
|
497 | $wc['avatar_highwide'] = smallworld_imageResize($wc['avatar_size'][0], $wc['avatar_size'][1], 35); |
|
498 | $wc['cface'] = $this->Gravatar($cdata['uid_fk']); |
|
499 | $wc['avatar_link'] = smallworld_getAvatarLink($cdata['uid_fk'], $wc['cface']); |
|
500 | $wc['vote_up'] = $this->countVotesCom('com', 'up', $cdata['msg_id_fk'], $cdata['com_id']); |
|
501 | $wc['vote_down'] = $this->countVotesCom('com', 'down', $cdata['msg_id_fk'], $cdata['com_id']); |
|
502 | ||
503 | if (2 == $frC[0] || 1 == $USC['comments']) { |
|
504 | $xoopsTpl->append('comm', $wc); |
|
505 | } |
|
506 | } |
|
507 | } |
|
508 | } |
|
509 | } |
|
510 | } |
|
511 | } |
|
512 |