Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 93 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,107 @@
# MyFriend
mixiのマイミク機能のような機能を持たせることができるモジュールです。
[![UTD powered-by-electricity](http://ForTheBadge.com/images/badges/powered-by-electricity.svg)](https://github.com/xoopscube)
[![UTD](https://forthebadge.com/images/badges/built-with-love.svg)](https://github.com/xoopscube/myfriend)

招待機能とマイミク機能があります。
招待機能で登録するグループを選ぶことが出来るので、招待グループとXCubeの通常登録でグループを分けることが可能です。
XCubeのユーザ登録を禁止することで、招待されないとユーザ登録出来ないように出来ます。
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/2.0.0/active.svg)](https://github.com/xoopscube/)
![License GPL](https://img.shields.io/badge/License-GPL-green)
![X-Updare Store](https://img.shields.io/badge/X--Update%20Store-Pending-red)

userinfo.phpの動作を変更しています。
XCubeのuserモジュールのテンプレートとは違う物(templates/myfriend_userinfo.html)が表示されます。
## ///// — MyFriend :: module for handling invitations and list of friends

招待者へ送信されるメールの雛型はlanguage/言語/invitation.tplですので適当に書き換えてください。
![alt text](https://repository-images.githubusercontent.com/347963527/8c04d798-5562-4443-8e55-656298649231)


Ver0.42:ユーザ自身の削除許可しても削除リンクが表示されなかったのを修正
Ver0.41:ユーザ削除時にmyfriend_friendlistからデータ削除するように修正
MODULE | MyFriend
------------ | -------------
Description | This module allows users to register an account using an invite
Render Engine | Smarty v2 and XCube Layout
Version | 2.3.1
Update | Naoki Okino @naao - Nuno Luciano @gigamaster XCL23
Author | Original by Marijuana and XOOPSCube Team
Copyright | 2012-2022 Authors
License | GPL

Ver0.40:招待の自動削除日数を管理画面で設定
招待者をユーザの任意削除
ブロックファイル名のtypo修正
ブロックがPHP4で表示されなくなったのを修正

Ver0.32:30日過ぎた招待を自動削除
Module.class.phpの利用
##### :computer: The Minimum Requirements

Ver0.31:無意味な参照の廃止
一部のrequireをrequire_onceに変更

Ver0.30:お気に入りユーザ対応

Ver0.20:Usersearchモジュール対応
Apache, Nginx, etc. PHP 7.2.x
MySQL 5.6, MariaDB InnoDB utf8 / utf8mb4
XCL version 2.3.+

Ver0.13:インストール時に全グループへアクセス権を付与するように変更
登録ユーザ以外では、デリゲートを登録しないように変更
その他少々変更


ToDo
ブロックの修正及び追加
-----


## Module MyFriend

### Description

The module implements an invitation feature, and a list of friends.
Since you can select the group to register with the invitation function,
it is possible to separate the invitation group from the normal registration of XCube.
You can prevent XCube user registration unless there is an invitation.

### Custom User Template

A template of userinfo.php is also available that implements MyFriend features.
The XCube default template can be replaced with _"templates/myfriend_userinfo.html"_

### Custom Email Template

The module also features a template to send email invitations :
_language/language/invitation.tpl_
So, you can edit and rewrite it appropriately.

### Integration

- Module Private Message
- Module Pico

---
### Changelog

ver2.31: Update to XCL Package

- Avatar
- Constructors
- Static call
- Language index and desc
- Language invite note sample
- Templates PicoCSS


ver2.30: Refactor code to XCL - PHP7 and MySQL ENGINE=InnoDB

---
Ver0.44: Fixed a bug that the approval of friend application is not reflected in the friend list of the applicant.

Ver0.42: Fixed that the delete link was not displayed even if the user allowed to delete

Ver0.41: Modified to delete data from myfriend_friendlist when deleting users

Ver0.40: Set the number of days to automatically delete invitations on the management screen
Invited users can be arbitrarily deleted
Fixed typo of block file name
Fixed block disappeared in PHP4

Ver0.32: Invitation automatically deleted after 30 days
Using Module.class.php

Ver0.31: Abolition of meaningless references
Changed some require to require_once

Ver0.30: Supports favorite users

Ver0.20: Supports Usersearch module

Ver0.13: Changed to give access right to all groups at installation
Changed not to register delegate except registered user
Other minor changes


### ToDo

- Modify and add blocks
- Modify templates to XCL default UI
37 changes: 0 additions & 37 deletions html/modules/myfriend/README

This file was deleted.

70 changes: 36 additions & 34 deletions html/modules/myfriend/actions/UserInfoAction.class.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
if (!defined('XOOPS_ROOT_PATH')) exit();

if (!defined('XOOPS_ROOT_PATH')) {
exit();
}

define ('USER_USERINFO_MAXHIT', 5);

Expand All @@ -8,121 +11,121 @@ class Myfriend_UserInfoAction
var $mObject = null;
var $mRankObject = null;
var $mSearchResults = null;

var $mSelfDelete = false;

var $mPmliteURL = null;

var $errFlg = false;
var $errMsg;
var $fuid;
function Myfriend_UserInfoAction(&$controller)

function __construct(&$controller)
{
$user = $controller->mRoot->mContext->mUser;
if ($user->isInRole('Site.GuestUser')) {
if ($user->isInRole('Site.GuestUser')) {
$this->_seterrMsg(_MD_MYFRIEND_NOGUEST);
} else {
$this->getDefaultView($controller);
}
}

function _seterrMsg($msg)
{
$this->errFlg = true;
$this->errMsg[] = $msg;
}

function getisError()
{
return $this->errFlg;
}

function geterrMsg()
{
return $this->errMsg;
}

function getDefaultView(&$controller)
{
$root = $controller->mRoot;
$xoopsUser = $root->mContext->mXoopsUser;
$this->fuid = intval($controller->mRoot->mContext->mRequest->getRequest('uid'));
$this->fuid = (int)$controller->mRoot->mContext->mRequest->getRequest('uid');
$handler = xoops_gethandler('user');
$this->mObject = $handler->get($this->fuid);
if (!is_object($this->mObject)) {
$this->_seterrMsg(_MD_MYFRIEND_NOUSER);
return;
}

$rankHandler = xoops_getmodulehandler('ranks', 'user');
$this->mRankObject = $rankHandler->get($this->mObject->get('rank'));

$service = $root->mServiceManager->getService('privateMessage');
if ($service != null) {
if ($service !== null) {
$client = $root->mServiceManager->createClient($service);
$this->mPmliteURL = $client->call('getPmliteUrl', array('fromUid' => $xoopsUser->get('uid'), 'toUid' => $this->fuid));
}
unset($service);

$service = $root->mServiceManager->getService("LegacySearch");
if ($service != null) {
if ($service !== null) {
$this->mSearchResults = array();

$client = $root->mServiceManager->createClient($service);

$moduleArr = $client->call('getActiveModules', array());

foreach ($moduleArr as $t_module) {
$module = array();
$module['name'] = $t_module['name'];
$module['mid'] = $t_module['mid'];

$params['mid'] = $t_module['mid'];
$params['uid'] = $this->mObject->get('uid');
$params['maxhit'] = USER_USERINFO_MAXHIT;
$params['start'] = 0;

$module['results'] = $client->call('searchItemsOfUser', $params);

if (count($module['results']) > 0) {
$module['has_more'] = (count($module['results']) >= USER_USERINFO_MAXHIT) ? true : false;
$module['has_more'] = count($module['results']) >= USER_USERINFO_MAXHIT;
$this->mSearchResults[] = $module;
}
}
}
}

function executeView(&$render)
{
$render->setTemplateName('myfriend_userinfo.html');
$render->setAttribute('thisUser', $this->mObject);
$render->setAttribute('rank', $this->mRankObject);
$render->setAttribute('pmliteUrl', $this->mPmliteURL);
$render->setAttribute('isFriend', $this->chk_myfriend());

$userSignature = $this->mObject->getShow('user_sig');

$render->setAttribute('user_signature', $userSignature);
$render->setAttribute('searchResults', $this->mSearchResults);

$root = XCube_Root::getSingleton();
$xoopsUser = $root->mContext->mXoopsUser;

$user_ownpage = (is_object($xoopsUser) && $xoopsUser->get('uid') == $this->mObject->get('uid'));
$render->setAttribute('user_ownpage', $user_ownpage);

$handler = xoops_gethandler('config');
$uconfig = $handler->getConfigsByDirname('user');
if ( $user_ownpage && $uconfig['self_delete'] ) {
$render->setAttribute('enableSelfDelete', true);
} else {
$render->setAttribute('enableSelfDelete', false);
}

$render->setAttribute('myfriends', $this->get_myfreindlist());
}

function get_myfreindlist()
{
$freiends = false;
Expand All @@ -140,7 +143,7 @@ function get_myfreindlist()
}
return $freiends;
}

function chk_myfriend()
{
$num = 0;
Expand All @@ -150,9 +153,8 @@ function chk_myfriend()
$sql.= "WHERE `uid` = ".$root->mContext->mXoopsUser->get('uid');
$sql.= " AND `friend_uid` = ".$this->fuid;
$result = $db->query($sql);
list($num) = $db->fetchRow($result);
[$num] = $db->fetchRow($result);
return $num;
}
}

?>
Loading