本文整理汇总了PHP中activity_occurred函数的典型用法代码示例。如果您正苦于以下问题:PHP activity_occurred函数的具体用法?PHP activity_occurred怎么用?PHP activity_occurred使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了activity_occurred函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preprocess_file
/**
* Gets file information out of $_FILES and stores it locally in $files.
* Checks file against max upload file size.
* Scans file for viruses.
* @return false for no errors, or a string describing the error
*/
function preprocess_file()
{
$name = $this->inputname;
if (!isset($_FILES[$name])) {
return get_string('noinputnamesupplied');
}
$file = $_FILES[$name];
$maxsize = get_config('maxuploadsize');
if ($maxsize && $file['size'] > $maxsize) {
return get_string('uploadedfiletoobig');
}
if ($file['error'] != UPLOAD_ERR_OK) {
$errormsg = get_string('phpuploaderror', 'mahara', get_string('phpuploaderror_' . $file['error']), $file['error']);
log_debug($errormsg);
if ($file['error'] == UPLOAD_ERR_NO_TMP_DIR || $file['error'] == UPLOAD_ERR_CANT_WRITE) {
// The admin probably needs to fix this; notify them
// @TODO: Create a new activity type for general admin messages.
$message = (object) array('users' => get_column('usr', 'id', 'admin', 1), 'subject' => get_string('adminphpuploaderror'), 'message' => $errormsg);
require_once 'activity.php';
activity_occurred('maharamessage', $message);
} else {
if ($file['error'] == UPLOAD_ERR_INI_SIZE || $file['error'] == UPLOAD_ERR_FORM_SIZE) {
return get_string('uploadedfiletoobig');
}
}
}
if (!is_uploaded_file($file['tmp_name'])) {
return get_string('notphpuploadedfile');
}
if (get_config('viruschecking') && ($errormsg = mahara_clam_scan_file($file))) {
return $errormsg;
}
$this->file = $file;
return false;
}
示例2: requestfriendship_submit
function requestfriendship_submit(Pieform $form, $values)
{
global $USER, $SESSION, $id, $goto;
$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 = profile_url($USER, false);
$n->users = array($user->id);
$n->fromuser = $loggedinid;
$lang = get_user_language($user->id);
$displayname = display_name($USER, $user);
$n->strings = new stdClass();
$n->strings->urltext = (object) array('key' => 'Requests');
$f->owner = $id;
$f->requester = $loggedinid;
$f->message = $values['message'];
insert_record('usr_friend_request', $f);
$n->subject = get_string_from_language($lang, 'requestedfriendlistsubject', 'group');
if (isset($values['message']) && !empty($values['message'])) {
$n->message = get_string_from_language($lang, 'requestedfriendlistmessageexplanation', 'group', $displayname) . $values['message'];
} else {
$n->message = get_string_from_language($lang, 'requestedfriendlistinboxmessage', 'group', $displayname);
}
require_once 'activity.php';
activity_occurred('maharamessage', $n);
handle_event('addfriendrequest', array('requester' => $loggedinid, 'owner' => $id));
$SESSION->add_ok_msg(get_string('friendformrequestsuccess', 'group', display_name($id)));
redirect($goto);
}
示例3: deletepost_submit
function deletepost_submit(Pieform $form, $values)
{
global $SESSION, $USER;
$objectionable = get_record_sql("SELECT fp.id\n FROM {interaction_forum_post} fp\n JOIN {objectionable} o\n ON (o.objecttype = 'forum' AND o.objectid = fp.id)\n WHERE fp.id = ?\n AND o.resolvedby IS NULL\n AND o.resolvedtime IS NULL", array($values['post']));
if ($objectionable !== false) {
// Trigger activity.
$data = new StdClass();
$data->postid = $values['post'];
$data->message = '';
$data->reporter = $USER->get('id');
$data->ctime = time();
$data->event = DELETE_OBJECTIONABLE_POST;
activity_occurred('reportpost', $data, 'interaction', 'forum');
}
update_record('interaction_forum_post', array('deleted' => 1), array('id' => $values['post']));
$SESSION->add_ok_msg(get_string('deletepostsuccess', 'interaction.forum'));
// Figure out which parent record to redirect us to. If the parent record is deleted,
// keep moving up the chain until you find one that's not deleted.
$postrec = new stdClass();
$postrec->parent = $values['parent'];
do {
$postrec = get_record('interaction_forum_post', 'id', $postrec->parent, null, null, null, null, 'id, deleted, parent');
} while ($postrec && $postrec->deleted && $postrec->parent);
$redirecturl = get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $values['topic'];
if ($postrec && $postrec->parent) {
$redirecturl .= '&post=' . $postrec->id;
}
redirect($redirecturl);
}
示例4: addmembers_submit
function addmembers_submit(Pieform $form, $values)
{
global $SESSION, $group, $USER;
if (empty($values['users'])) {
redirect(get_config('wwwroot') . 'group/suggest.php?id=' . GROUP);
}
require_once 'activity.php';
$groupurl = group_homepage_url($group, false);
activity_occurred('maharamessage', array('users' => $values['users'], 'subject' => '', 'message' => '', 'strings' => (object) array('subject' => (object) array('key' => 'suggestgroupnotificationsubject', 'section' => 'group', 'args' => array(display_name($USER))), 'message' => (object) array('key' => 'suggestgroupnotificationmessage', 'section' => 'group', 'args' => array(display_name($USER), hsc($group->name), get_config('sitename')))), 'url' => $groupurl, 'urltext' => hsc($group->name)));
$SESSION->add_ok_msg(get_string('recommendationssent', 'group', count($values['users'])));
redirect(get_config('wwwroot') . $groupurl);
}
示例5: edit_comment_submit
function edit_comment_submit(Pieform $form, $values)
{
global $viewid, $comment, $SESSION, $goto;
db_begin();
$comment->set('description', $values['message']);
$comment->set('private', 1 - (int) $values['ispublic']);
$comment->commit();
require_once 'activity.php';
$data = (object) array('commentid' => $comment->get('id'), 'viewid' => $viewid);
activity_occurred('feedback', $data, 'artefact', 'comment');
db_commit();
$SESSION->add_ok_msg(get_string('commentupdated', 'artefact.comment'));
redirect($goto);
}
示例6: invitetogroup_submit
function invitetogroup_submit(Pieform $form, $values)
{
global $SESSION, $USER, $group, $user;
$data = new StdClass();
$data->group = $group->id;
$data->member = $user->id;
$data->ctime = db_format_timestamp(time());
$data->role = $values['role'];
insert_record('group_member_invite', $data);
$lang = get_user_language($user->id);
require_once 'activity.php';
activity_occurred('maharamessage', array('users' => array($user->id), 'subject' => get_string_from_language($lang, 'invitetogroupsubject', 'group'), 'message' => get_string_from_language($lang, 'invitetogroupmessage', 'group', display_name($USER, $user), $group->name), 'url' => get_config('wwwroot') . 'group/view.php?id=' . $group->id));
$SESSION->add_ok_msg(get_string('userinvited', 'group'));
redirect('/user/view.php?id=' . $user->id);
}
示例7: contactus_submit
function contactus_submit(Pieform $form, $values)
{
global $SESSION;
$data = new StdClass();
$data->fromname = $values['name'];
$data->fromemail = $values['email'];
$data->subject = $values['subject'];
$data->message = $values['message'];
if ($values['userid']) {
$data->fromuser = $values['userid'];
}
require_once 'activity.php';
activity_occurred('contactus', $data);
$SESSION->add_ok_msg(get_string('messagesent'));
redirect();
}
示例8: do_masquerade
/**
* Notify user (if configured), do the masquerading and emit event. Called when
* no (further) interaction with the admin is needed before the loginas.
*
* @param string $why The masquerading reason (if given) or null.
*/
function do_masquerade($why = null)
{
global $USER, $SESSION;
$id = param_integer('id');
$who = display_name($USER, $id);
$when = format_date(time());
if (get_config('masqueradingnotified')) {
$msg = (object) array('subject' => get_string('masqueradenotificationsubject', 'admin'), 'message' => $why === null ? get_string('masqueradenotificationnoreason', 'admin', $who, $when) : get_string('masqueradenotificationreason', 'admin', $who, $when, $why), 'users' => array($id), 'url' => profile_url($USER, false), 'urltext' => $who);
activity_occurred('maharamessage', $msg);
$SESSION->add_info_msg(get_string('masqueradenotificationdone', 'admin'));
}
$USER->change_identity_to($id);
// Permissions checking is done in here
handle_event('loginas', array('who' => $who, 'when' => $when, 'reason' => $why));
redirect(get_config('wwwroot'));
}
示例9: submitview_submit
function submitview_submit(Pieform $form, $values)
{
global $SESSION, $USER, $viewid, $groupid, $group;
db_begin();
update_record('view', array('submittedgroup' => $groupid, 'submittedtime' => db_format_timestamp(time())), array('id' => $viewid));
$roles = get_column('grouptype_roles', 'role', 'grouptype', $group->grouptype, 'see_submitted_views', 1);
foreach ($roles as $role) {
$accessrecord = (object) array('view' => $viewid, 'group' => $groupid, 'role' => $role, 'visible' => 0, 'allowcomments' => 1, 'approvecomments' => 0);
ensure_record_exists('view_access', $accessrecord, $accessrecord);
}
ArtefactType::update_locked($USER->get('id'));
activity_occurred('groupmessage', array('subject' => get_string('viewsubmitted', 'view'), 'message' => get_string('viewsubmitted', 'view'), 'submittedview' => $viewid, 'viewowner' => $USER->get('id'), 'group' => $groupid, 'roles' => $roles, 'strings' => (object) array('urltext' => (object) array('key' => 'view'))));
db_commit();
$SESSION->add_ok_msg(get_string('viewsubmitted', 'view'));
redirect('/' . returnto());
}
示例10: denyrequest_submit
function denyrequest_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 = profile_url($USER, false);
$n->users = array($user->id);
$n->fromuser = $USER->get('id');
$lang = get_user_language($user->id);
$displayname = display_name($USER, $user);
$n->urltext = $displayname;
delete_records('usr_friend_request', 'owner', $loggedinid, 'requester', $id);
$n->subject = get_string_from_language($lang, 'friendrequestrejectedsubject', 'group');
if (isset($values['reason']) && !empty($values['reason'])) {
$n->message = get_string_from_language($lang, 'friendrequestrejectedmessagereason', 'group', $displayname) . $values['reason'];
} else {
$n->message = get_string_from_language($lang, 'friendrequestrejectedmessage', 'group', $displayname);
}
require_once 'activity.php';
activity_occurred('maharamessage', $n);
handle_event('removefriendrequest', array('owner' => $loggedinid, 'requester' => $id));
$SESSION->add_ok_msg(get_string('friendformrejectsuccess', 'group'));
$offset = param_integer('offset', 0);
switch (param_alpha('returnto', 'myfriends')) {
case 'find':
$goto = 'user/find.php';
break;
case 'view':
$goto = profile_url($user, false);
break;
default:
$goto = 'user/myfriends.php';
break;
}
$goto .= strpos($goto, '?') ? '&offset=' . $offset : '?offset=' . $offset;
$goto = get_config('wwwroot') . $goto;
redirect($goto);
}
示例11: requestjoingroup_submit
function requestjoingroup_submit(Pieform $form, $values)
{
global $SESSION, $USER, $group, $goto;
insert_record('group_member_request', (object) array('group' => $group->id, 'member' => $USER->get('id'), 'ctime' => db_format_timestamp(time()), 'reason' => isset($values['reason']) ? $values['reason'] : null));
// Send request to all group admins
require_once 'activity.php';
$groupadmins = get_column('group_member', 'member', 'group', $group->id, 'role', 'admin');
foreach ($groupadmins as $groupadmin) {
$adminlang = get_user_language($groupadmin);
if (isset($values['reason']) && $values['reason'] != '') {
$message = get_string_from_language($adminlang, 'grouprequestmessagereason', 'group', display_name($USER, get_record('usr', 'id', $groupadmin)), $group->name, $values['reason']);
} else {
$message = get_string_from_language($adminlang, 'grouprequestmessage', 'group', display_name($USER, get_record('usr', 'id', $groupadmin)), $group->name);
}
activity_occurred('maharamessage', array('users' => array($groupadmin), 'subject' => get_string_from_language($adminlang, 'grouprequestsubject', 'group'), 'message' => $message, 'url' => 'group/members.php?id=' . $group->id . '&membershiptype=request', 'strings' => (object) array('urltext' => (object) array('key' => 'pendingmembers', 'section' => 'group'))));
}
$SESSION->add_ok_msg(get_string('grouprequestsent', 'group'));
redirect($goto);
}
示例12: deletetopic_submit
function deletetopic_submit(Pieform $form, $values)
{
global $SESSION, $USER, $topicid;
$objectionable = get_record_sql("SELECT fp.id\n FROM {interaction_forum_post} fp\n JOIN {objectionable} o\n ON (o.objecttype = 'forum' AND o.objectid = fp.id)\n WHERE fp.topic = ?\n AND fp.parent IS NULL\n AND o.resolvedby IS NULL\n AND o.resolvedtime IS NULL", $topicid);
if ($objectionable !== false) {
// Trigger activity.
$data = new StdClass();
$data->postid = $objectionable->id;
$data->message = '';
$data->reporter = $USER->get('id');
$data->ctime = time();
$data->event = DELETE_OBJECTIONABLE_TOPIC;
activity_occurred('reportpost', $data, 'interaction', 'forum');
}
// mark topic as deleted
update_record('interaction_forum_topic', array('deleted' => 1), array('id' => $topicid));
// mark relevant posts as deleted
update_record('interaction_forum_post', array('deleted' => 1), array('topic' => $topicid));
$SESSION->add_ok_msg(get_string('deletetopicsuccess', 'interaction.forum'));
redirect('/interaction/forum/view.php?id=' . $values['forum']);
}
示例13: requestfriendship_submit
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->message = $values['message'];
insert_record('usr_friend_request', $f);
$n->subject = get_string_from_language($lang, 'requestedfriendlistsubject', 'group');
if (isset($values['message']) && !empty($values['message'])) {
$n->message = get_string_from_language($lang, 'requestedfriendlistmessagereason', 'group', $displayname) . $values['message'];
} else {
$n->message = get_string_from_language($lang, 'requestedfriendlistmessage', 'group', $displayname);
}
require_once 'activity.php';
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;
}
}
示例14: reportpost_submit
function reportpost_submit(Pieform $form, $values)
{
global $SESSION, $USER, $postid;
$ctime = time();
$objection = new stdClass();
$objection->objecttype = 'forum';
$objection->objectid = $postid;
$objection->reportedby = $USER->get('id');
$objection->report = $values['message'];
$objection->reportedtime = db_format_timestamp($ctime);
insert_record('objectionable', $objection);
// Trigger activity.
$data = new StdClass();
$data->postid = $postid;
$data->message = $values['message'];
$data->reporter = $USER->get('id');
$data->ctime = $ctime;
$data->event = REPORT_OBJECTIONABLE;
activity_occurred('reportpost', $data, 'interaction', 'forum');
$SESSION->add_ok_msg(get_string('reportpostsuccess', 'interaction.forum'));
$redirecturl = get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $values['topic'] . '&post=' . $postid;
redirect($redirecturl);
}
示例15: addfriend_submit
function addfriend_submit(Pieform $form, $values)
{
global $USER, $SESSION;
$user = get_record('usr', 'id', $values['id']);
$loggedinid = $USER->get('id');
$userid = $user->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);
$n->urltext = $displayname;
$f->usr1 = $values['id'];
$f->usr2 = $loggedinid;
insert_record('usr_friend', $f);
$n->subject = get_string_from_language($lang, 'addedtofriendslistsubject', 'group', $displayname);
$n->message = get_string_from_language($lang, 'addedtofriendslistmessage', 'group', $displayname, $displayname);
require_once 'activity.php';
activity_occurred('maharamessage', $n);
handle_event('addfriend', array('user' => $f->usr2, 'friend' => $f->usr1));
$SESSION->add_ok_msg(get_string('friendformaddsuccess', 'group', display_name($user)));
redirect('/user/view.php?id=' . $values['id']);
}