| @@ 440-567 (lines=128) @@ | ||
| 437 | * @param int $id |
|
| 438 | * @return void |
|
| 439 | */ |
|
| 440 | public function ParsePubArray($updatesarray, $id) |
|
| 441 | { |
|
| 442 | global $xoopsUser, $xoopsTpl, $tpl, $xoopsModule, $xoopsConfig; |
|
| 443 | ||
| 444 | $check = new SmallWorldUser; |
|
| 445 | $dBase = new SmallWorldDB; |
|
| 446 | $profile = $xoopsUser ? $check->checkIfProfile($id) : 0; |
|
| 447 | $moduleHandler = xoops_getHandler('module'); |
|
| 448 | $module = $moduleHandler->getByDirname('smallworld'); |
|
| 449 | $configHandler = xoops_getHandler('config'); |
|
| 450 | $moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid')); |
|
| 451 | ||
| 452 | $myavatar = $this->Gravatar($id); |
|
| 453 | $myavatarlink = smallworld_getAvatarLink($id, $myavatar); |
|
| 454 | $myavatar_size = smallworld_getImageSize(80, 100, $myavatarlink); |
|
| 455 | $myavatar_highwide = smallworld_imageResize($myavatar_size[0], $myavatar_size[1], 35); |
|
| 456 | ||
| 457 | $xoopsTpl->assign('myavatar', $myavatar); |
|
| 458 | $xoopsTpl->assign('myavatarlink', $myavatarlink); |
|
| 459 | $xoopsTpl->assign('myavatar_highwide', $myavatar_highwide); |
|
| 460 | ||
| 461 | if (!empty($updatesarray)) { |
|
| 462 | foreach ($updatesarray as $data) { |
|
| 463 | ||
| 464 | // Is update's user a friend ? |
|
| 465 | $frU = $check->friendcheck($id, $data['uid_fk']); |
|
| 466 | ||
| 467 | $USW = []; |
|
| 468 | $USW['posts'] = 0; |
|
| 469 | $USW['comments'] = 0; |
|
| 470 | ||
| 471 | if ($xoopsUser) { |
|
| 472 | if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) || $data['uid_fk'] == $id) { |
|
| 473 | $USW['posts'] = 1; |
|
| 474 | $USW['comments'] = 1; |
|
| 475 | $frU[0] = 2; |
|
| 476 | } else { |
|
| 477 | $USW = json_decode($dBase->GetSettings($data['uid_fk']), true); |
|
| 478 | } |
|
| 479 | } |
|
| 480 | ||
| 481 | if (!$xoopsUser) { |
|
| 482 | $USW = json_decode($dBase->GetSettings($data['uid_fk']), true); |
|
| 483 | } |
|
| 484 | ||
| 485 | $wm['msg_id'] = $data['msg_id']; |
|
| 486 | $wm['orimessage'] = (1 == $USW['posts'] || $profile >= 2) ? str_replace(["\r", "\n"], '', Smallworld_stripWordsKeepUrl($data['message'])) : ''; |
|
| 487 | $wm['message'] = (1 == $USW['posts'] || $profile >= 2) ? smallworld_tolink(htmlspecialchars_decode($data['message']), $data['uid_fk']) : _SMALLWORLD_MESSAGE_PRIVSETPOSTS; |
|
| 488 | $wm['message'] = Smallworld_cleanup($wm['message']); |
|
| 489 | $wm['created'] = smallworld_time_stamp($data['created']); |
|
| 490 | $wm['username'] = $data['username']; |
|
| 491 | $wm['uid_fk'] = $data['uid_fk']; |
|
| 492 | $wm['priv'] = $data['priv']; |
|
| 493 | $wm['avatar'] = $this->Gravatar($data['uid_fk']); |
|
| 494 | $wm['avatar_link'] = smallworld_getAvatarLink($data['uid_fk'], $wm['avatar']); |
|
| 495 | $wm['avatar_size'] = smallworld_getImageSize(80, 100, $wm['avatar_link']); |
|
| 496 | $wm['avatar_highwide'] = smallworld_imageResize($wm['avatar_size'][0], $wm['avatar_size'][1], 50); |
|
| 497 | $wm['vote_up'] = $this->countVotes('msg', 'up', $data['msg_id']); |
|
| 498 | $wm['vote_down'] = $this->countVotes('msg', 'down', $data['msg_id']); |
|
| 499 | $wm['sharelinkurl'] = XOOPS_URL . '/modules/smallworld/smallworldshare.php?ownerid=' . $data['uid_fk']; |
|
| 500 | $wm['sharelinkurl'] .= '&updid=' . $data['msg_id'] . ''; |
|
| 501 | $wm['usernameTitle'] = $wm['username'] . _SMALLWORLD_UPDATEONSITEMETA . $xoopsConfig['sitename']; |
|
| 502 | if (1 == $USW['posts'] || $profile >= 2) { |
|
| 503 | $wm['sharelink'] = $this->GetSharing($wm['msg_id'], $wm['priv']); |
|
| 504 | } else { |
|
| 505 | $wm['sharelink'] = $this->GetSharing($wm['msg_id'], 1); |
|
| 506 | } |
|
| 507 | ||
| 508 | if (1 == $USW['posts'] || $profile >= 2) { |
|
| 509 | $wm['sharediv'] = $this->GetSharingDiv($wm['msg_id'], $wm['priv'], $wm['sharelinkurl'], $wm['orimessage'], $wm['usernameTitle']); |
|
| 510 | } else { |
|
| 511 | $wm['sharediv'] = $this->GetSharingDiv($wm['msg_id'], 1, $wm['sharelinkurl'], $wm['orimessage'], $wm['usernameTitle']); |
|
| 512 | } |
|
| 513 | $wm['linkimage'] = XOOPS_URL . '/modules/smallworld/assets/images/link.png'; |
|
| 514 | $wm['permalink'] = XOOPS_URL . '/modules/smallworld/permalink.php?ownerid=' . $data['uid_fk'] . '&updid=' . $data['msg_id']; |
|
| 515 | $wm['commentsarray'] = $this->Comments($data['msg_id']); |
|
| 516 | ||
| 517 | if (2 == $frU[0] || 1 == $USW['posts']) { |
|
| 518 | $xoopsTpl->append('walldata', $wm); |
|
| 519 | } |
|
| 520 | ||
| 521 | if (!empty($wm['commentsarray'])) { |
|
| 522 | foreach ($wm['commentsarray'] as $cdata) { |
|
| 523 | // Is commentuser a friend ? |
|
| 524 | $frC = $check->friendcheck($id, $cdata['uid_fk']); |
|
| 525 | ||
| 526 | $USC = []; |
|
| 527 | $USC['posts'] = 0; |
|
| 528 | $USC['comments'] = 0; |
|
| 529 | ||
| 530 | if ($xoopsUser) { |
|
| 531 | if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) || $cdata['uid_fk'] == $id) { |
|
| 532 | $USC['posts'] = 1; |
|
| 533 | $USC['comments'] = 1; |
|
| 534 | $frC[0] = 2; |
|
| 535 | } else { |
|
| 536 | $USC = json_decode($dBase->GetSettings($cdata['uid_fk']), true); |
|
| 537 | } |
|
| 538 | } |
|
| 539 | ||
| 540 | if (!$xoopsUser) { |
|
| 541 | $USC = json_decode($dBase->GetSettings($cdata['uid_fk']), true); |
|
| 542 | } |
|
| 543 | ||
| 544 | $wc['msg_id_fk'] = $cdata['msg_id_fk']; |
|
| 545 | $wc['com_id'] = $cdata['com_id']; |
|
| 546 | $wc['comment'] = (1 == $USC['comments'] || $profile >= 2) ? smallworld_tolink(htmlspecialchars_decode($cdata['comment']), $cdata['uid_fk']) : _SMALLWORLD_MESSAGE_PRIVSETCOMMENTS; |
|
| 547 | $wc['comment'] = Smallworld_cleanup($wc['comment']); |
|
| 548 | $wc['time'] = smallworld_time_stamp($cdata['created']); |
|
| 549 | $wc['username'] = $cdata['username']; |
|
| 550 | $wc['uid'] = $cdata['uid_fk']; |
|
| 551 | $wc['myavatar'] = $this->Gravatar($id); |
|
| 552 | $wc['myavatar_link'] = $myavatarlink; |
|
| 553 | $wc['avatar_size'] = smallworld_getImageSize(80, 100, $wc['myavatar_link']); |
|
| 554 | $wc['avatar_highwide'] = smallworld_imageResize($wc['avatar_size'][0], $wc['avatar_size'][1], 35); |
|
| 555 | $wc['cface'] = $this->Gravatar($cdata['uid_fk']); |
|
| 556 | $wc['avatar_link'] = smallworld_getAvatarLink($cdata['uid_fk'], $wc['cface']); |
|
| 557 | $wc['vote_up'] = $this->countVotesCom('com', 'up', $cdata['msg_id_fk'], $cdata['com_id']); |
|
| 558 | $wc['vote_down'] = $this->countVotesCom('com', 'down', $cdata['msg_id_fk'], $cdata['com_id']); |
|
| 559 | ||
| 560 | if (2 == $frC[0] || 1 == $USC['comments']) { |
|
| 561 | $xoopsTpl->append('comm', $wc); |
|
| 562 | } |
|
| 563 | } |
|
| 564 | } |
|
| 565 | } |
|
| 566 | } |
|
| 567 | } |
|
| 568 | } |
|
| 569 | ||
| @@ 445-572 (lines=128) @@ | ||
| 442 | * @param int $id |
|
| 443 | * @return void |
|
| 444 | */ |
|
| 445 | public function ParsePubArray($updatesarray, $id) |
|
| 446 | { |
|
| 447 | global $xoopsUser, $xoopsTpl, $tpl, $xoopsModule, $xoopsConfig; |
|
| 448 | ||
| 449 | $check = new SmallWorldUser; |
|
| 450 | $dBase = new SmallWorldDB; |
|
| 451 | $profile = $xoopsUser ? $check->checkIfProfile($id) : 0; |
|
| 452 | $moduleHandler = xoops_getHandler('module'); |
|
| 453 | $module = $moduleHandler->getByDirname('smallworld'); |
|
| 454 | $configHandler = xoops_getHandler('config'); |
|
| 455 | $moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid')); |
|
| 456 | ||
| 457 | $myavatar = $this->Gravatar($id); |
|
| 458 | $myavatarlink = smallworld_getAvatarLink($id, $myavatar); |
|
| 459 | $myavatar_size = smallworld_getImageSize(80, 100, $myavatarlink); |
|
| 460 | $myavatar_highwide = smallworld_imageResize($myavatar_size[0], $myavatar_size[1], 35); |
|
| 461 | ||
| 462 | $xoopsTpl->assign('myavatar', $myavatar); |
|
| 463 | $xoopsTpl->assign('myavatarlink', $myavatarlink); |
|
| 464 | $xoopsTpl->assign('myavatar_highwide', $myavatar_highwide); |
|
| 465 | ||
| 466 | if (!empty($updatesarray)) { |
|
| 467 | foreach ($updatesarray as $data) { |
|
| 468 | ||
| 469 | // Is update's user a friend ? |
|
| 470 | $frU = $check->friendcheck($id, $data['uid_fk']); |
|
| 471 | ||
| 472 | $USW = []; |
|
| 473 | $USW['posts'] = 0; |
|
| 474 | $USW['comments'] = 0; |
|
| 475 | ||
| 476 | if ($xoopsUser) { |
|
| 477 | if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) || $data['uid_fk'] == $id) { |
|
| 478 | $USW['posts'] = 1; |
|
| 479 | $USW['comments'] = 1; |
|
| 480 | $frU[0] = 2; |
|
| 481 | } else { |
|
| 482 | $USW = json_decode($dBase->GetSettings($data['uid_fk']), true); |
|
| 483 | } |
|
| 484 | } |
|
| 485 | ||
| 486 | if (!$xoopsUser) { |
|
| 487 | $USW = json_decode($dBase->GetSettings($data['uid_fk']), true); |
|
| 488 | } |
|
| 489 | ||
| 490 | $wm['msg_id'] = $data['msg_id']; |
|
| 491 | $wm['orimessage'] = (1 == $USW['posts'] || $profile >= 2) ? str_replace(["\r", "\n"], '', Smallworld_stripWordsKeepUrl($data['message'])) : ''; |
|
| 492 | $wm['message'] = (1 == $USW['posts'] || $profile >= 2) ? smallworld_tolink(htmlspecialchars_decode($data['message']), $data['uid_fk']) : _SMALLWORLD_MESSAGE_PRIVSETPOSTS; |
|
| 493 | $wm['message'] = Smallworld_cleanup($wm['message']); |
|
| 494 | $wm['created'] = smallworld_time_stamp($data['created']); |
|
| 495 | $wm['username'] = $data['username']; |
|
| 496 | $wm['uid_fk'] = $data['uid_fk']; |
|
| 497 | $wm['priv'] = $data['priv']; |
|
| 498 | $wm['avatar'] = $this->Gravatar($data['uid_fk']); |
|
| 499 | $wm['avatar_link'] = smallworld_getAvatarLink($data['uid_fk'], $wm['avatar']); |
|
| 500 | $wm['avatar_size'] = smallworld_getImageSize(80, 100, $wm['avatar_link']); |
|
| 501 | $wm['avatar_highwide'] = smallworld_imageResize($wm['avatar_size'][0], $wm['avatar_size'][1], 50); |
|
| 502 | $wm['vote_up'] = $this->countVotes('msg', 'up', $data['msg_id']); |
|
| 503 | $wm['vote_down'] = $this->countVotes('msg', 'down', $data['msg_id']); |
|
| 504 | $wm['sharelinkurl'] = XOOPS_URL . '/modules/smallworld/smallworldshare.php?ownerid=' . $data['uid_fk']; |
|
| 505 | $wm['sharelinkurl'] .= '&updid=' . $data['msg_id'] . ''; |
|
| 506 | $wm['usernameTitle'] = $wm['username'] . _SMALLWORLD_UPDATEONSITEMETA . $xoopsConfig['sitename']; |
|
| 507 | if (1 == $USW['posts'] || $profile >= 2) { |
|
| 508 | $wm['sharelink'] = $this->GetSharing($wm['msg_id'], $wm['priv']); |
|
| 509 | } else { |
|
| 510 | $wm['sharelink'] = $this->GetSharing($wm['msg_id'], 1); |
|
| 511 | } |
|
| 512 | ||
| 513 | if (1 == $USW['posts'] || $profile >= 2) { |
|
| 514 | $wm['sharediv'] = $this->GetSharingDiv($wm['msg_id'], $wm['priv'], $wm['sharelinkurl'], $wm['orimessage'], $wm['usernameTitle']); |
|
| 515 | } else { |
|
| 516 | $wm['sharediv'] = $this->GetSharingDiv($wm['msg_id'], 1, $wm['sharelinkurl'], $wm['orimessage'], $wm['usernameTitle']); |
|
| 517 | } |
|
| 518 | $wm['linkimage'] = XOOPS_URL . '/modules/smallworld/assets/images/link.png'; |
|
| 519 | $wm['permalink'] = XOOPS_URL . '/modules/smallworld/permalink.php?ownerid=' . $data['uid_fk'] . '&updid=' . $data['msg_id']; |
|
| 520 | $wm['commentsarray'] = $this->Comments($data['msg_id']); |
|
| 521 | ||
| 522 | if (2 == $frU[0] || 1 == $USW['posts']) { |
|
| 523 | $xoopsTpl->append('walldata', $wm); |
|
| 524 | } |
|
| 525 | ||
| 526 | if (!empty($wm['commentsarray'])) { |
|
| 527 | foreach ($wm['commentsarray'] as $cdata) { |
|
| 528 | // Is commentuser a friend ? |
|
| 529 | $frC = $check->friendcheck($id, $cdata['uid_fk']); |
|
| 530 | ||
| 531 | $USC = []; |
|
| 532 | $USC['posts'] = 0; |
|
| 533 | $USC['comments'] = 0; |
|
| 534 | ||
| 535 | if ($xoopsUser) { |
|
| 536 | if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) || $cdata['uid_fk'] == $id) { |
|
| 537 | $USC['posts'] = 1; |
|
| 538 | $USC['comments'] = 1; |
|
| 539 | $frC[0] = 2; |
|
| 540 | } else { |
|
| 541 | $USC = json_decode($dBase->GetSettings($cdata['uid_fk']), true); |
|
| 542 | } |
|
| 543 | } |
|
| 544 | ||
| 545 | if (!$xoopsUser) { |
|
| 546 | $USC = json_decode($dBase->GetSettings($cdata['uid_fk']), true); |
|
| 547 | } |
|
| 548 | ||
| 549 | $wc['msg_id_fk'] = $cdata['msg_id_fk']; |
|
| 550 | $wc['com_id'] = $cdata['com_id']; |
|
| 551 | $wc['comment'] = (1 == $USC['comments'] || $profile >= 2) ? smallworld_tolink(htmlspecialchars_decode($cdata['comment']), $cdata['uid_fk']) : _SMALLWORLD_MESSAGE_PRIVSETCOMMENTS; |
|
| 552 | $wc['comment'] = Smallworld_cleanup($wc['comment']); |
|
| 553 | $wc['time'] = smallworld_time_stamp($cdata['created']); |
|
| 554 | $wc['username'] = $cdata['username']; |
|
| 555 | $wc['uid'] = $cdata['uid_fk']; |
|
| 556 | $wc['myavatar'] = $this->Gravatar($id); |
|
| 557 | $wc['myavatar_link'] = $myavatarlink; |
|
| 558 | $wc['avatar_size'] = smallworld_getImageSize(80, 100, $wc['myavatar_link']); |
|
| 559 | $wc['avatar_highwide'] = smallworld_imageResize($wc['avatar_size'][0], $wc['avatar_size'][1], 35); |
|
| 560 | $wc['cface'] = $this->Gravatar($cdata['uid_fk']); |
|
| 561 | $wc['avatar_link'] = smallworld_getAvatarLink($cdata['uid_fk'], $wc['cface']); |
|
| 562 | $wc['vote_up'] = $this->countVotesCom('com', 'up', $cdata['msg_id_fk'], $cdata['com_id']); |
|
| 563 | $wc['vote_down'] = $this->countVotesCom('com', 'down', $cdata['msg_id_fk'], $cdata['com_id']); |
|
| 564 | ||
| 565 | if (2 == $frC[0] || 1 == $USC['comments']) { |
|
| 566 | $xoopsTpl->append('comm', $wc); |
|
| 567 | } |
|
| 568 | } |
|
| 569 | } |
|
| 570 | } |
|
| 571 | } |
|
| 572 | } |
|
| 573 | } |
|
| 574 | ||