本文整理汇总了PHP中get_user_language函数的典型用法代码示例。如果您正苦于以下问题:PHP get_user_language函数的具体用法?PHP get_user_language怎么用?PHP get_user_language使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_user_language函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: get_pano_description
function get_pano_description()
{
global $wpdb;
$pano_table_name = get_pano_table_name();
$text_table_name = get_pano_text_table_name();
$language_code = get_user_language();
$url = $_SERVER['HTTP_REFERER'];
$parts = explode('?pano_id=', $url);
$pano_id = $parts[1];
if ($pano_id == NULL) {
$pano_id = 1;
}
// DB query joining the pano table and the pano text table
$panos = $wpdb->get_results("SELECT wppt.description FROM " . $pano_table_name . " wpp " . "INNER JOIN " . $text_table_name . " wppt ON " . "wppt.pano_id = " . "'" . $pano_id . "'" . "WHERE wppt.language_code = " . $language_code, ARRAY_A);
return $panos;
}
示例4: 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);
}
示例5: 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);
}
示例6: 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;
}
}
示例7: release
public function release($releaseuser = null)
{
$submitinfo = $this->submitted_to();
if (is_null($submitinfo)) {
throw new ParameterException("View with id " . $this->get('id') . " has not been submitted");
}
$releaseuser = optional_userobj($releaseuser);
self::_db_release(array($this->id), $this->get('owner'), $this->get('submittedgroup'));
$ownerlang = get_user_language($this->get('owner'));
$url = $this->get_url(false);
require_once 'activity.php';
activity_occurred('maharamessage', array('users' => array($this->get('owner')), 'subject' => get_string_from_language($ownerlang, 'viewreleasedsubject', 'group', $this->get('title'), $submitinfo['name'], display_name($releaseuser, $this->get_owner_object())), 'message' => get_string_from_language($ownerlang, 'viewreleasedmessage', 'group', $this->get('title'), $submitinfo['name'], display_name($releaseuser, $this->get_owner_object())), 'url' => $url, 'urltext' => $this->get('title')));
}
示例8: add_feedback_form_submit
function add_feedback_form_submit(Pieform $form, $values)
{
global $view, $artefact, $USER;
$data = (object) array('title' => get_string('Comment', 'artefact.comment'), 'description' => $values['message']);
if ($artefact) {
$data->onartefact = $artefact->get('id');
$data->owner = $artefact->get('owner');
$data->group = $artefact->get('group');
$data->institution = $artefact->get('institution');
} else {
$data->onview = $view->get('id');
$data->owner = $view->get('owner');
$data->group = $view->get('group');
$data->institution = $view->get('institution');
}
if ($author = $USER->get('id')) {
$anonymous = false;
$data->author = $author;
} else {
$anonymous = true;
$data->authorname = $values['authorname'];
}
if (isset($values['moderate']) && $values['ispublic'] && !$USER->can_edit_view($view)) {
$data->private = 1;
$data->requestpublic = 'author';
$moderated = true;
} else {
$data->private = (int) (!$values['ispublic']);
$moderated = false;
}
$private = $data->private;
if (get_config('licensemetadata')) {
$data->license = $values['license'];
$data->licensor = $values['licensor'];
$data->licensorurl = $values['licensorurl'];
}
if (isset($values['rating'])) {
$data->rating = valid_rating($values['rating']);
}
$comment = new ArtefactTypeComment(0, $data);
db_begin();
$comment->commit();
$url = $comment->get_view_url($view->get('id'), true, false);
$goto = get_config('wwwroot') . $url;
if (isset($data->requestpublic) && $data->requestpublic === 'author' && $data->owner) {
$arg = $author ? display_name($USER, null, true) : $data->authorname;
$moderatemsg = (object) array('subject' => false, 'message' => false, 'strings' => (object) array('subject' => (object) array('key' => 'makepublicrequestsubject', 'section' => 'artefact.comment', 'args' => array()), 'message' => (object) array('key' => 'makepublicrequestbyauthormessage', 'section' => 'artefact.comment', 'args' => array(hsc($arg))), 'urltext' => (object) array('key' => 'Comment', 'section' => 'artefact.comment')), 'users' => array($data->owner), 'url' => $url);
}
if (!empty($values['attachments']) && is_array($values['attachments']) && !empty($data->author)) {
require_once get_config('libroot') . 'uploadmanager.php';
safe_require('artefact', 'file');
$ownerlang = empty($data->owner) ? get_config('lang') : get_user_language($data->owner);
$folderid = ArtefactTypeFolder::get_folder_id(get_string_from_language($ownerlang, 'feedbackattachdirname', 'artefact.comment'), get_string_from_language($ownerlang, 'feedbackattachdirdesc', 'artefact.comment'), null, true, $data->owner, $data->group, $data->institution);
$attachment = (object) array('owner' => $data->owner, 'group' => $data->group, 'institution' => $data->institution, 'author' => $data->author, 'allowcomments' => 0, 'parent' => $folderid, 'description' => get_string_from_language($ownerlang, 'feedbackonviewbyuser', 'artefact.comment', $view->get('title'), display_name($USER)));
foreach ($values['attachments'] as $filesindex) {
$originalname = $_FILES[$filesindex]['name'];
$attachment->title = ArtefactTypeFileBase::get_new_file_title($originalname, $folderid, $data->owner, $data->group, $data->institution);
try {
$fileid = ArtefactTypeFile::save_uploaded_file($filesindex, $attachment);
} catch (QuotaExceededException $e) {
if ($data->owner == $USER->get('id')) {
$form->reply(PIEFORM_ERR, array('message' => $e->getMessage()));
}
redirect($goto);
} catch (UploadException $e) {
$form->reply(PIEFORM_ERR, array('message' => $e->getMessage()));
redirect($goto);
}
$comment->attach($fileid);
}
}
require_once 'activity.php';
$data = (object) array('commentid' => $comment->get('id'), 'viewid' => $view->get('id'));
activity_occurred('feedback', $data, 'artefact', 'comment');
if (isset($moderatemsg)) {
activity_occurred('maharamessage', $moderatemsg);
}
db_commit();
$newlist = ArtefactTypeComment::get_comments(10, 0, 'last', $view, $artefact);
// If you're anonymous and your message is moderated or private, then you won't
// be able to tell what happened to it. So we'll provide some more explanation in
// the feedback message.
if ($anonymous && $moderated) {
$message = get_string('feedbacksubmittedmoderatedanon', 'artefact.comment');
} else {
if ($anonymous && $private) {
$message = get_string('feedbacksubmittedprivateanon', 'artefact.comment');
} else {
$message = get_string('feedbacksubmitted', 'artefact.comment');
}
}
$form->reply(PIEFORM_OK, array('message' => $message, 'goto' => $goto, 'data' => $newlist));
}
示例9: Incident
$incident = new Incident();
$incident->ajax($method);
break;
case 'calendars':
$calendars = new Calendars();
$calendars->ajax($method);
break;
}
return;
break;
case 'login':
if (!$user->checkLogin()) {
$user->showLogin();
} else {
if ($user->isLogged()) {
$user_language = get_user_language($system->getConfig('id_user'));
if (file_exists('../include/languages/' . $user_language . '.mo')) {
$l10n = new gettext_reader(new CachedFileReader('../include/languages/' . $user_language . '.mo'));
$l10n->load_tables();
}
$home = new Home();
$home->show();
} else {
$user->showLoginFail();
}
}
break;
case 'logout':
$user->logout();
$user->showLogin();
break;
示例10: group_invite_user
/**
* Invite a user to a group.
*
* @param object $group group
* @param object $userid User to invite
* @param object $userfrom User sending the invitation
*/
function group_invite_user($group, $userid, $userfrom, $role = 'member', $delay = null)
{
$user = optional_userobj($userid);
$data = new StdClass();
$data->group = $group->id;
$data->member = $user->id;
$data->ctime = db_format_timestamp(time());
$data->role = $role;
ensure_record_exists('group_member_invite', $data, $data);
$lang = get_user_language($user->id);
require_once 'activity.php';
$activitydata = array('users' => array($user->id), 'subject' => get_string_from_language($lang, 'invitetogroupsubject', 'group'), 'message' => get_string_from_language($lang, 'invitetogroupmessage', 'group', display_name($userfrom, $user), $group->name), 'url' => group_homepage_url($group, false), 'urltext' => $group->name);
activity_occurred('maharamessage', $activitydata, null, null, $delay);
}
示例11: addfriend_submit
function addfriend_submit(Pieform $form, $values)
{
global $USER, $SESSION;
$user = get_record('usr', 'id', $values['id']);
$loggedinid = $USER->get('id');
if (is_friend($loggedinid, $user->id)) {
$SESSION->add_info_msg(get_string('alreadyfriends', 'group', display_name($user)));
delete_records('usr_friend_request', 'owner', $loggedinid, 'requester', $user->id);
redirect(profile_url($user));
}
// 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);
$lang = get_user_language($user->id);
$displayname = display_name($USER, $user);
$n->urltext = $displayname;
$f->usr1 = $values['id'];
$f->usr2 = $loggedinid;
db_begin();
delete_records('usr_friend_request', 'owner', $loggedinid, 'requester', $user->id);
insert_record('usr_friend', $f);
db_commit();
$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(profile_url($user));
}
示例12: create_mission
function create_mission($mission_name, $mission_description, $mission_xml, $pano_id, $domain_id, $quest_id, $mission_points)
{
global $wpdb;
$mission_table_name = get_mission_table_name();
$mission_text_table_name = get_mission_text_table_name();
$language_code = get_user_language();
$language_code = str_replace("'", "", $language_code);
// Insert the pano
$wpdb->insert($mission_table_name, array('quest_id' => $quest_id, 'points' => $mission_points, 'mission_xml' => $mission_xml, 'pano_id' => $pano_id, 'domain_id' => $domain_id));
// Get the id of the last row
$lastid = $wpdb->insert_id;
// Insert the pano_text
$wpdb->insert($mission_text_table_name, array('mission_id' => $lastid, 'language_code' => $language_code, 'name' => $mission_name, 'description' => $mission_description));
return $wpdb->insert_id;
}
示例13: get_pano_description
function get_pano_description()
{
global $wpdb;
$pano_table_name = get_pano_table_name();
$text_table_name = get_pano_text_table_name();
$language_code = get_user_language();
// DB query joining the pano table and the pano text table
$panos = $wpdb->get_results("SELECT wpp.id, wppt.description FROM " . $pano_table_name . " wpp " . "INNER JOIN " . $text_table_name . " wppt ON " . "wppt.pano_id = wpp.id " . "WHERE wppt.language_code = " . $language_code, ARRAY_A);
return $panos;
}
示例14: release
public function release($releaseuser = null)
{
require_once get_config('docroot') . 'artefact/lib.php';
$submitinfo = $this->submitted_to();
if (is_null($submitinfo)) {
throw new ParameterException("View with id " . $this->get('id') . " has not been submitted");
}
$releaseuser = optional_userobj($releaseuser);
db_begin();
if ($submitinfo['type'] == 'group') {
$group = $this->get('submittedgroup');
$this->set('submittedgroup', null);
if ($group) {
// Remove hidden tutor view access records
delete_records('view_access', 'view', $this->id, 'group', $group, 'visible', 0);
}
} else {
if ($submitinfo['type'] == 'host') {
$this->set('submittedhost', null);
}
}
$this->set('submittedtime', null);
$this->commit();
ArtefactType::update_locked($this->owner);
db_commit();
$ownerlang = get_user_language($this->get('owner'));
$url = get_config('wwwroot') . 'view/view.php?id=' . $this->get('id');
require_once 'activity.php';
activity_occurred('maharamessage', array('users' => array($this->get('owner')), 'subject' => get_string_from_language($ownerlang, 'viewreleasedsubject', 'group', $this->get('title'), $submitinfo['name'], display_name($releaseuser, $this->get_owner_object())), 'message' => get_string_from_language($ownerlang, 'viewreleasedmessage', 'group', $this->get('title'), $submitinfo['name'], display_name($releaseuser, $this->get_owner_object())), 'url' => $url, 'urltext' => $this->get('title')));
}
示例15: group_remove_user
group_remove_user($groupid, $userid, $role = null);
$groupstoremovemail .= $groupdata[$groupid]->name . "\n";
}
}
//add group membership
if ($groupstoadd = array_diff($resultgroups, $initialgroups)) {
$groupstoaddmail = '';
foreach ($groupstoadd as $groupid) {
group_add_user($groupid, $userid, $role = null);
$groupstoaddmail .= $groupdata[$groupid]->name . "\n";
}
}
db_commit();
// Users notification
$userrecord = get_record('usr', 'id', $userid);
$lang = get_user_language($userid);
$n = new StdClass();
$n->users = array($userid);
$n->subject = get_string_from_language($lang, 'changedgroupmembershipsubject', 'group');
$n->message = '';
if (isset($groupstoaddmail)) {
$n->message .= get_string_from_language($lang, 'addedtongroupsmessage', 'group', count($groupstoadd), display_name($USER, $userrecord), $groupstoaddmail);
}
if (isset($groupstoremovemail)) {
$n->message .= get_string_from_language($lang, 'removedfromngroupsmessage', 'group', count($groupstoremove), display_name($USER, $userrecord), $groupstoremovemail);
}
require_once get_config('libroot') . 'activity.php';
activity_occurred('maharamessage', $n);
$data['message'] = get_string('changedgroupmembership', 'group');
} else {
if ($addtype == 'invite') {