Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
7a280e7e
Commit
7a280e7e
authored
Feb 01, 2008
by
Clare Lenihan
Committed by
Clare Lenihan
Feb 01, 2008
Browse files
pages for removing/requesting friends and sending messages to users
parent
f1902368
Changes
6
Hide whitespace changes
Inline
Side-by-side
htdocs/theme/default/templates/user/removefriend.tpl
0 → 100644
View file @
7a280e7e
{
include
file
=
"header.tpl"
}
{
include
file
=
"sidebar.tpl"
}
{
include
file
=
"columnleftstart.tpl"
}
<h2>
{
$heading
}
</h2>
{
$form
}
{
include
file
=
"columnleftend.tpl"
}
{
include
file
=
"footer.tpl"
}
htdocs/theme/default/templates/user/requestfriendship.tpl
0 → 100644
View file @
7a280e7e
{
include
file
=
"header.tpl"
}
{
include
file
=
"sidebar.tpl"
}
{
include
file
=
"columnleftstart.tpl"
}
<h2>
{
$heading
}
</h2>
{
$form
}
{
include
file
=
"columnleftend.tpl"
}
{
include
file
=
"footer.tpl"
}
htdocs/theme/default/templates/user/sendmessage.tpl
0 → 100644
View file @
7a280e7e
{
include
file
=
"header.tpl"
}
{
include
file
=
"sidebar.tpl"
}
{
include
file
=
"columnleftstart.tpl"
}
<h2>
{
$heading
}
</h2>
{
$form
}
{
include
file
=
"columnleftend.tpl"
}
{
include
file
=
"footer.tpl"
}
htdocs/user/removefriend.php
0 → 100644
View file @
7a280e7e
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2007 Catalyst IT Ltd (http://www.catalyst.net.nz)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage core
* @author Clare Lenihan <clare@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
define
(
'INTERNAL'
,
1
);
define
(
'MENUITEM'
,
'groups/findfriends'
);
require
(
dirname
(
dirname
(
__FILE__
))
.
'/init.php'
);
require_once
(
'pieforms/pieform.php'
);
$id
=
param_integer
(
'id'
);
if
(
!
is_friend
(
$id
,
$USER
->
get
(
'id'
)))
{
throw
new
AccessDeniedException
(
get_string
(
'cantremovefriend'
,
'group'
));
}
define
(
'TITLE'
,
get_string
(
'removefromfriends'
,
'group'
,
display_name
(
$id
)));
$form
=
pieform
(
array
(
'name'
=>
'removefriend'
,
'autofocus'
=>
false
,
'elements'
=>
array
(
'reason'
=>
array
(
'type'
=>
'textarea'
,
'title'
=>
get_string
(
'reason'
),
'cols'
=>
40
,
'rows'
=>
5
),
'submit'
=>
array
(
'type'
=>
'submitcancel'
,
'value'
=>
array
(
get_string
(
'yes'
),
get_string
(
'no'
))
)
)
));
$smarty
=
smarty
();
$smarty
->
assign
(
'heading'
,
TITLE
);
$smarty
->
assign
(
'form'
,
$form
);
$smarty
->
display
(
'user/removefriend.tpl'
);
function
removefriend_submit
(
Pieform
$form
,
$values
)
{
global
$USER
,
$SESSION
,
$id
;
$loggedinid
=
$USER
->
get
(
'id'
);
$user
=
get_record
(
'usr'
,
'id'
,
$id
);
// friend db record
$f
=
new
StdClass
;
$f
->
ctime
=
db_format_timestamp
(
time
());
// notification info
$n
=
new
StdClass
;
$n
->
url
=
get_config
(
'wwwroot'
)
.
'user/view.php?id='
.
$loggedinid
;
$n
->
users
=
array
(
$user
->
id
);
$lang
=
get_user_language
(
$user
->
id
);
$displayname
=
display_name
(
$USER
,
$user
);
delete_records_select
(
'usr_friend'
,
'(usr1 = ? AND usr2 = ?) OR (usr2 = ? AND usr1 = ?)'
,
array
(
$id
,
$loggedinid
,
$id
,
$loggedinid
));
$n
->
subject
=
get_string_from_language
(
$lang
,
'removedfromfriendslistsubject'
);
if
(
isset
(
$values
[
'reason'
])
&&
!
empty
(
$values
[
'reason'
]))
{
$n
->
message
=
get_string_from_language
(
$lang
,
'removedfromfriendslistmessage'
,
'group'
,
$displayname
)
.
$values
[
'reason'
];
}
else
{
$n
->
message
=
get_string_from_language
(
$lang
,
'removedfromfriendslistmessage'
,
'group'
,
$displayname
);
}
$SESSION
->
add_ok_msg
(
get_string
(
'friendformremovesuccess'
,
'group'
,
display_name
(
$id
)));
switch
(
param_alpha
(
'returnto'
,
'myfriends'
))
{
case
'find'
:
redirect
(
'/user/find.php'
);
break
;
case
'view'
:
redirect
(
'/user/view.php?id='
.
$id
);
break
;
default
:
redirect
(
'/user/myfriends.php'
);
break
;
}
}
?>
htdocs/user/requestfriendship.php
0 → 100644
View file @
7a280e7e
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2007 Catalyst IT Ltd (http://www.catalyst.net.nz)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage core
* @author Clare Lenihan <clare@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
define
(
'INTERNAL'
,
1
);
define
(
'MENUITEM'
,
'groups/findfriends'
);
require
(
dirname
(
dirname
(
__FILE__
))
.
'/init.php'
);
require_once
(
'pieforms/pieform.php'
);
$id
=
param_integer
(
'id'
);
if
(
is_friend
(
$id
,
$USER
->
get
(
'id'
))
||
get_friend_request
(
$id
,
$USER
->
get
(
'id'
))
||
get_account_preference
(
$id
,
'friendscontrol'
)
!=
'auth'
)
{
throw
new
AccessDeniedException
(
get_string
(
'cantrequestfriendship'
,
'group'
));
}
if
(
$id
=
$USER
->
get
(
'id'
))
{
throw
new
AccessDeniedException
(
get_string
(
'cantrequestownfriendship'
,
'group'
));
}
define
(
'TITLE'
,
get_string
(
'sendfriendshiprequest'
,
'group'
,
display_name
(
$id
)));
$form
=
pieform
(
array
(
'name'
=>
'requestfriendship'
,
'autofocus'
=>
false
,
'elements'
=>
array
(
'reason'
=>
array
(
'type'
=>
'textarea'
,
'title'
=>
get_string
(
'reason'
),
'cols'
=>
50
,
'rows'
=>
4
,
),
'submit'
=>
array
(
'type'
=>
'submitcancel'
,
'value'
=>
array
(
get_string
(
'yes'
),
get_string
(
'no'
))
)
)
));
$smarty
=
smarty
();
$smarty
->
assign
(
'heading'
,
TITLE
);
$smarty
->
assign
(
'form'
,
$form
);
$smarty
->
display
(
'user/requestfriendship.tpl'
);
function
requestfriendship_submit
(
Pieform
$form
,
$values
)
{
global
$USER
,
$SESSION
,
$id
;
$loggedinid
=
$USER
->
get
(
'id'
);
$user
=
get_record
(
'usr'
,
'id'
,
$id
);
// friend db record
$f
=
new
StdClass
;
$f
->
ctime
=
db_format_timestamp
(
time
());
// notification info
$n
=
new
StdClass
;
$n
->
url
=
get_config
(
'wwwroot'
)
.
'user/view.php?id='
.
$loggedinid
;
$n
->
users
=
array
(
$user
->
id
);
$lang
=
get_user_language
(
$user
->
id
);
$displayname
=
display_name
(
$USER
,
$user
);
$f
->
owner
=
$id
;
$f
->
requester
=
$loggedinid
;
$f
->
reason
=
$values
[
'reason'
];
insert_record
(
'usr_friend_request'
,
$f
);
$n
->
subject
=
get_string_from_language
(
$lang
,
'requestedfriendlistsubject'
,
'group'
);
if
(
isset
(
$values
[
'reason'
])
&&
!
empty
(
$values
[
'reason'
]))
{
$n
->
message
=
get_string_from_language
(
$lang
,
'requestedfriendlistmessagereason'
,
'group'
,
$displayname
)
.
$values
[
'reason'
];
}
else
{
$n
->
message
=
get_string_from_language
(
$lang
,
'requestedfriendlistmessage'
,
'group'
,
$displayname
);
}
activity_occurred
(
'maharamessage'
,
$n
);
$SESSION
->
add_ok_msg
(
get_string
(
'friendformrequestsuccess'
,
'group'
,
display_name
(
$id
)));
switch
(
param_alpha
(
'returnto'
,
'myfriends'
))
{
case
'find'
:
redirect
(
'/user/find.php'
);
break
;
case
'view'
:
redirect
(
'/user/view.php?id='
.
$id
);
break
;
default
:
redirect
(
'/user/myfriends.php'
);
break
;
}
}
?>
htdocs/user/sendmessage.php
0 → 100644
View file @
7a280e7e
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2007 Catalyst IT Ltd (http://www.catalyst.net.nz)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage core
* @author Clare Lenihan <clare@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
define
(
'INTERNAL'
,
1
);
define
(
'MENUITEM'
,
'groups/findfriends'
);
require
(
dirname
(
dirname
(
__FILE__
))
.
'/init.php'
);
require_once
(
'pieforms/pieform.php'
);
require
(
'searchlib.php'
);
safe_require
(
'search'
,
'internal'
);
$id
=
param_integer
(
'id'
);
if
(
!
can_send_message
(
$USER
,
$id
))
{
throw
new
AccessDeniedException
(
get_string
(
'cantmessageuser'
,
'group'
));
}
define
(
'TITLE'
,
get_string
(
'sendmessageto'
,
'group'
,
display_name
(
$id
)));
$form
=
pieform
(
array
(
'name'
=>
'sendmessage'
,
'autofocus'
=>
false
,
'elements'
=>
array
(
'reason'
=>
array
(
'type'
=>
'textarea'
,
'title'
=>
get_string
(
'message'
),
'cols'
=>
50
,
'rows'
=>
4
,
),
'submit'
=>
array
(
'type'
=>
'submitcancel'
,
'value'
=>
array
(
get_string
(
'sendmessage'
,
'group'
),
get_string
(
'cancel'
))
)
)
));
$smarty
=
smarty
();
$smarty
->
assign
(
'heading'
,
TITLE
);
$smarty
->
assign
(
'form'
,
$form
);
$smarty
->
display
(
'user/denyrequest.tpl'
);
function
sendmessage_submit
(
Pieform
$form
,
$values
)
{
global
$USER
,
$SESSION
,
$id
;
send_user_message
(
$USER
,
$id
);
$SESSION
->
add_ok_msg
(
get_string
(
'messagesent'
,
'group'
));
switch
(
param_alpha
(
'returnto'
,
'myfriends'
))
{
case
'find'
:
redirect
(
'/user/find.php'
);
break
;
case
'view'
:
redirect
(
'/user/view.php?id='
.
$id
);
break
;
default
:
redirect
(
'/user/myfriends.php'
);
break
;
}
}
?>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment