• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP handle_event函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中handle_event函数的典型用法代码示例。如果您正苦于以下问题:PHP handle_event函数的具体用法?PHP handle_event怎么用?PHP handle_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了handle_event函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:rboyatt,项目名称:mahara,代码行数:33,代码来源:requestfriendship.php


示例2: cancelrequest_submit

function cancelrequest_submit(Pieform $form, $values)
{
    global $USER;
    foreach ($values as $k => $v) {
        if (preg_match('/^\\_cancelrequest\\_([a-z0-9]+)$/', $k, $m)) {
            $institution = $m[1];
            break;
        }
    }
    if (!empty($institution)) {
        delete_records('usr_institution_request', 'usr', $USER->id, 'institution', $institution);
        handle_event('updateuser', $USER->id);
    }
    redirect(get_config('wwwroot') . 'account/institutions.php');
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:15,代码来源:institutions.php


示例3: 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'));
}
开发者ID:patkira,项目名称:mahara,代码行数:22,代码来源:changeuser.php


示例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);
}
开发者ID:vohung96,项目名称:mahara,代码行数:43,代码来源:denyrequest.php


示例5: removefriend_submit

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);
    $n->urltext = $displayname;
    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', 'group');
    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);
    }
    require_once 'activity.php';
    activity_occurred('maharamessage', $n);
    handle_event('removefriend', array('user' => $loggedinid, 'friend' => $id));
    $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;
    }
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:38,代码来源:removefriend.php


示例6: viewskin_submit

function viewskin_submit(Pieform $form, $values)
{
    global $SESSION;
    $view = new View($values['view']);
    $new = $values['new'];
    $view->set('skin', $values['skin']);
    $view->commit();
    handle_event('saveview', $view->get('id'));
    $SESSION->add_ok_msg(get_string('viewskinchanged', 'skin'));
    redirect('/view/view.php?id=' . $view->get('id') . ($new ? '&new=1' : ''));
}
开发者ID:rboyatt,项目名称:mahara,代码行数:11,代码来源:skin.php


示例7: create_user

/**
 * Create user
 *
 * @param object $user stdclass or User object for the usr table
 * @param array  $profile profile field/values to set
 * @param string|object $institution Institution the user should joined to (name or Institution object)
 * @param bool $remoteauth authinstance record for a remote authinstance
 * @param string $remotename username on the remote site
 * @param array $accountprefs user account preferences to set
 * @return integer id of the new user
 */
function create_user($user, $profile = array(), $institution = null, $remoteauth = null, $remotename = null, $accountprefs = array(), $quickhash = false)
{
    db_begin();
    if ($user instanceof User) {
        $user->create();
        $user->quota_init();
        $user->commit();
        $user = $user->to_stdclass();
    } else {
        $user->ctime = db_format_timestamp(time());
        // Ensure this user has a profile urlid
        if (get_config('cleanurls') && (!isset($user->urlid) || is_null($user->urlid))) {
            $user->urlid = generate_urlid($user->username, get_config('cleanurluserdefault'), 3, 30);
            $user->urlid = get_new_profile_urlid($user->urlid);
        }
        if (empty($user->quota)) {
            $user->quota = get_config_plugin('artefact', 'file', 'defaultquota');
        }
        if (get_config('defaultaccountlifetime')) {
            // we need to set the user expiry to the site default one
            $user->expiry = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y')) + (int) get_config('defaultaccountlifetime'));
        }
        $user->id = insert_record('usr', $user, 'id', true);
    }
    if (isset($user->email) && $user->email != '') {
        set_profile_field($user->id, 'email', $user->email, TRUE);
    }
    if (isset($user->firstname) && $user->firstname != '') {
        set_profile_field($user->id, 'firstname', $user->firstname, TRUE);
    }
    if (isset($user->lastname) && $user->lastname != '') {
        set_profile_field($user->id, 'lastname', $user->lastname, TRUE);
    }
    foreach ($profile as $k => $v) {
        if (in_array($k, array('firstname', 'lastname', 'email'))) {
            continue;
        }
        set_profile_field($user->id, $k, $v, TRUE);
    }
    if (!empty($institution)) {
        if (is_string($institution)) {
            $institution = new Institution($institution);
        }
        if ($institution->name != 'mahara') {
            $institution->addUserAsMember($user);
            // uses $user->newuser
            if (empty($accountprefs['licensedefault'])) {
                $accountprefs['licensedefault'] = LICENSE_INSTITUTION_DEFAULT;
            }
        }
    }
    $authobj = get_record('auth_instance', 'id', $user->authinstance);
    $authinstance = AuthFactory::create($authobj->id);
    // For legacy compatibility purposes, we'll also put the remote auth on there if it has been
    // specifically requested.
    if ($authinstance->needs_remote_username() || !empty($remoteauth)) {
        if (isset($remotename) && strlen($remotename) > 0) {
            $un = $remotename;
        } else {
            $un = $user->username;
        }
        // remote username must not already exist
        if (record_exists('auth_remote_user', 'remoteusername', $un, 'authinstance', $user->authinstance)) {
            throw new InvalidArgumentException("user_create: remoteusername already exists: ({$un}, {$user->authinstance})");
        }
        insert_record('auth_remote_user', (object) array('authinstance' => $user->authinstance, 'remoteusername' => $un, 'localusr' => $user->id));
    }
    // Set account preferences
    if (!empty($accountprefs)) {
        $expectedprefs = expected_account_preferences();
        foreach ($expectedprefs as $eprefkey => $epref) {
            if (isset($accountprefs[$eprefkey]) && $accountprefs[$eprefkey] != $epref) {
                set_account_preference($user->id, $eprefkey, $accountprefs[$eprefkey]);
            }
        }
    }
    // Copy site views and collections to the new user's profile
    $userobj = new User();
    $userobj->find_by_id($user->id);
    $userobj->copy_site_views_collections_to_new_user();
    reset_password($user, false, $quickhash);
    handle_event('createuser', $user);
    db_commit();
    return $user->id;
}
开发者ID:patkira,项目名称:mahara,代码行数:96,代码来源:user.php


示例8: commit

 public function commit()
 {
     if (empty($this->dirty)) {
         return;
     }
     $fordb = new StdClass();
     foreach (get_object_vars($this) as $k => $v) {
         // The configdata is initially fetched from the database in string
         // form. Calls to get() will convert it to an array on the fly. We
         // ensure that it is a string again here
         if ($k == 'configdata' && is_array($v)) {
             $fordb->{$k} = serialize($v);
         } else {
             $fordb->{$k} = $v;
         }
     }
     if (empty($this->id)) {
         $this->id = insert_record('block_instance', $fordb, 'id', true);
     } else {
         update_record('block_instance', $fordb, 'id');
     }
     $this->rebuild_artefact_list();
     // Tell stuff about this
     handle_event('blockinstancecommit', $this);
     $this->dirty = false;
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:26,代码来源:lib.php


示例9: core_install_lastcoredata_defaults

function core_install_lastcoredata_defaults()
{
    db_begin();
    $institution = new StdClass();
    $institution->name = 'mahara';
    $institution->displayname = 'No Institution';
    $institution->authplugin = 'internal';
    $institution->theme = 'default';
    insert_record('institution', $institution);
    $auth_instance = new StdClass();
    $auth_instance->instancename = 'Internal';
    $auth_instance->priority = '1';
    $auth_instance->institution = 'mahara';
    $auth_instance->authname = 'internal';
    $auth_instance->id = insert_record('auth_instance', $auth_instance, 'id', true);
    // Insert the root user
    $user = new StdClass();
    $user->id = 0;
    $user->username = 'root';
    $user->password = '*';
    $user->salt = '*';
    $user->firstname = 'System';
    $user->lastname = 'User';
    $user->email = '[email protected]';
    $user->quota = get_config_plugin('artefact', 'file', 'defaultquota');
    $user->authinstance = $auth_instance->id;
    if (is_mysql()) {
        // gratuitous mysql workaround
        $newid = insert_record('usr', $user, 'id', true);
        set_field('usr', 'id', 0, 'id', $newid);
        execute_sql('ALTER TABLE {usr} AUTO_INCREMENT=1');
    } else {
        insert_record('usr', $user);
    }
    install_system_profile_view();
    // Insert the admin user
    $user = new StdClass();
    $user->username = 'admin';
    $user->password = 'mahara';
    $user->authinstance = $auth_instance->id;
    $user->passwordchange = 1;
    $user->admin = 1;
    $user->firstname = 'Admin';
    $user->lastname = 'User';
    $user->email = '[email protected]';
    $user->quota = get_config_plugin('artefact', 'file', 'defaultquota');
    $user->id = insert_record('usr', $user, 'id', true);
    set_profile_field($user->id, 'email', $user->email);
    set_profile_field($user->id, 'firstname', $user->firstname);
    set_profile_field($user->id, 'lastname', $user->lastname);
    set_config('installed', true);
    handle_event('createuser', $user->id);
    activity_add_admin_defaults(array($user->id));
    db_commit();
    // if we're installing, set up the block categories here and then poll the plugins.
    // if we're upgrading this happens somewhere else.  This is because of dependency issues around
    // the order of installation stuff.
    install_blocktype_extras();
}
开发者ID:Br3nda,项目名称:mahara,代码行数:59,代码来源:upgrade.php


示例10: tlschema

<?php

// addnews ready.
// translator ready
// mail ready
require_once "common.php";
require_once "lib/http.php";
require_once "lib/buffs.php";
require_once "lib/events.php";
tlschema("graveyard");
page_header("The Graveyard");
$skipgraveyardtext = handle_event("graveyard");
$deathoverlord = getsetting('deathoverlord', '`$Ramius');
if (!$skipgraveyardtext) {
    if ($session['user']['alive']) {
        redirect("village.php", "Redirecting from Shades because the player isn't dead!");
    }
    checkday();
}
$battle = false;
strip_all_buffs();
$op = httpget('op');
switch ($op) {
    case "search":
        require_once "lib/graveyard/case_battle_search.php";
        break;
    case "run":
        if (e_rand(0, 2) == 1) {
            output("`\$%s`) curses you for your cowardice.`n`n", $deathoverlord);
            $favor = 5 + e_rand(0, $session['user']['level']);
            if ($favor > $session['user']['deathpower']) {
开发者ID:Beeps,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:31,代码来源:graveyard.php


示例11: set_access

 public function set_access($accessdata)
 {
     global $USER;
     require_once 'activity.php';
     $beforeusers = activity_get_viewaccess_users($this->get('id'), $USER->get('id'), 'viewaccess');
     db_begin();
     delete_records('view_access', 'view', $this->get('id'), 'visible', 1);
     // View access
     if ($accessdata) {
         /*
          * There should be a cleaner way to do this
          * $accessdata_added ensures that the same access is not granted twice because the profile page
          * gets very grumpy if there are duplicate access rules
          *
          * Additional rules:
          * - Don't insert records with stopdate in the past
          * - Remove startdates that are in the past
          * - If view allows comments, access record comment permissions, don't apply, so reset them.
          * @todo: merge overlapping date ranges.
          */
         $accessdata_added = array();
         $time = time();
         foreach ($accessdata as $item) {
             if (!empty($item['stopdate']) && $item['stopdate'] < $time) {
                 continue;
             }
             if (!empty($item['startdate']) && $item['startdate'] < $time) {
                 unset($item['startdate']);
             }
             if ($this->get('allowcomments')) {
                 unset($item['allowcomments']);
                 unset($item['approvecomments']);
             }
             $accessrecord = new StdClass();
             switch ($item['type']) {
                 case 'user':
                     $accessrecord->usr = $item['id'];
                     break;
                 case 'group':
                     $accessrecord->group = $item['id'];
                     if (isset($item['role']) && strlen($item['role'])) {
                         // Don't insert a record for a role the group doesn't have
                         $roleinfo = group_get_role_info($item['id']);
                         if (!isset($roleinfo[$item['role']])) {
                             break;
                         }
                         $accessrecord->role = $item['role'];
                     }
                     break;
                 case 'token':
                     $accessrecord->token = $item['id'];
                     break;
                 case 'friends':
                     if (!$this->owner) {
                         continue;
                         // Don't add friend access to group, institution or system views
                     }
                 case 'public':
                 case 'loggedin':
                     $accessrecord->accesstype = $item['type'];
             }
             $accessrecord->view = $this->get('id');
             if (isset($item['allowcomments'])) {
                 $accessrecord->allowcomments = (int) (!empty($item['allowcomments']));
                 if ($accessrecord->allowcomments) {
                     $accessrecord->approvecomments = (int) (!empty($item['approvecomments']));
                 }
             }
             if (isset($item['startdate'])) {
                 $accessrecord->startdate = db_format_timestamp($item['startdate']);
             }
             if (isset($item['stopdate'])) {
                 $accessrecord->stopdate = db_format_timestamp($item['stopdate']);
             }
             if (array_search($accessrecord, $accessdata_added) === false) {
                 insert_record('view_access', $accessrecord);
                 $accessdata_added[] = $accessrecord;
             }
         }
     }
     $data = new StdClass();
     $data->view = $this->get('id');
     $data->owner = $USER->get('id');
     $data->oldusers = $beforeusers;
     activity_occurred('viewaccess', $data);
     handle_event('saveview', $this->get('id'));
     db_commit();
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:88,代码来源:view.php


示例12: array

$schemas = array("text" => "village", "clock" => "village", "title" => "village", "talk" => "village", "sayline" => "village", "newest" => "village", "newestplayer" => "village", "newestid" => "village", "gatenav" => "village", "fightnav" => "village", "marketnav" => "village", "tavernnav" => "village", "infonav" => "village", "othernav" => "village", "section" => "village", "innname" => "village", "stablename" => "village", "mercenarycamp" => "village", "armorshop" => "village", "weaponshop" => "village");
// Now store the schemas
$origtexts['schemas'] = $schemas;
// don't hook on to this text for your standard modules please, use "village"
// instead.
// This hook is specifically to allow modules that do other villages to create
// ambience.
$texts = modulehook("villagetext", $origtexts);
//and now a special hook for the village
//$texts = modulehook("villagetext-{$session['user']['location']}",$texts);
$schemas = $texts['schemas'];
tlschema($schemas['title']);
page_header($texts['title']);
tlschema();
addcommentary();
$skipvillagedesc = handle_event("village");
checkday();
if ($session['user']['slaydragon'] == 1) {
    $session['user']['slaydragon'] = 0;
}
if ($session['user']['alive']) {
} else {
    redirect("shades.php", "Player in village but not alive");
}
if (getsetting("automaster", 1) && $session['user']['seenmaster'] != 1) {
    //masters hunt down truant students
    $level = $session['user']['level'] + 1;
    $dks = $session['user']['dragonkills'];
    $expreqd = exp_for_next_level($level, $dks);
    if ($session['user']['experience'] > $expreqd && $session['user']['level'] < 15) {
        redirect("train.php?op=autochallenge", "Master auto-challenge");
开发者ID:Beeps,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:31,代码来源:village.php


示例13: core_install_lastcoredata_defaults

function core_install_lastcoredata_defaults()
{
    global $USER;
    db_begin();
    $institution = new StdClass();
    $institution->name = 'mahara';
    $institution->displayname = 'No Institution';
    $institution->authplugin = 'internal';
    $institution->theme = 'default';
    $institution->priority = 0;
    insert_record('institution', $institution);
    $pages = site_content_pages();
    $now = db_format_timestamp(time());
    foreach ($pages as $name) {
        $page = new stdClass();
        $page->name = $name;
        $page->ctime = $now;
        $page->mtime = $now;
        $page->content = get_string($page->name . 'defaultcontent', 'install', get_string('staticpageconfigdefault', 'install'));
        $page->institution = 'mahara';
        insert_record('site_content', $page);
    }
    $auth_instance = new StdClass();
    $auth_instance->instancename = 'Internal';
    $auth_instance->priority = '1';
    $auth_instance->institution = 'mahara';
    $auth_instance->authname = 'internal';
    $auth_instance->id = insert_record('auth_instance', $auth_instance, 'id', true);
    // Insert the root user
    $user = new StdClass();
    $user->id = 0;
    $user->username = 'root';
    $user->password = '*';
    $user->salt = '*';
    $user->firstname = 'System';
    $user->lastname = 'User';
    $user->email = '[email protected]';
    $user->quota = get_config_plugin('artefact', 'file', 'defaultquota');
    $user->authinstance = $auth_instance->id;
    if (is_mysql()) {
        // gratuitous mysql workaround
        $newid = insert_record('usr', $user, 'id', true);
        set_field('usr', 'id', 0, 'id', $newid);
        execute_sql('ALTER TABLE {usr} AUTO_INCREMENT=1');
    } else {
        insert_record('usr', $user);
    }
    // install the default layout options
    install_view_layout_defaults();
    require_once 'group.php';
    install_system_profile_view();
    install_system_dashboard_view();
    install_system_grouphomepage_view();
    require_once 'license.php';
    install_licenses_default();
    require_once 'skin.php';
    install_skins_default();
    // Insert the admin user
    $user = new StdClass();
    $user->username = 'admin';
    $user->salt = auth_get_random_salt();
    $user->password = crypt('mahara', '$2a$' . get_config('bcrypt_cost') . '$' . substr(md5(get_config('passwordsaltmain') . $user->salt), 0, 22));
    $user->password = substr($user->password, 0, 7) . substr($user->password, 7 + 22);
    $user->authinstance = $auth_instance->id;
    $user->passwordchange = 1;
    $user->admin = 1;
    $user->firstname = 'Admin';
    $user->lastname = 'User';
    $user->email = '[email protected]';
    $user->quota = get_config_plugin('artefact', 'file', 'defaultquota');
    $user->id = insert_record('usr', $user, 'id', true);
    set_profile_field($user->id, 'email', $user->email);
    set_profile_field($user->id, 'firstname', $user->firstname);
    set_profile_field($user->id, 'lastname', $user->lastname);
    handle_event('createuser', $user);
    activity_add_admin_defaults(array($user->id));
    db_commit();
    // if we're installing, set up the block categories here and then poll the plugins.
    // if we're upgrading this happens somewhere else.  This is because of dependency issues around
    // the order of installation stuff.
    install_blocktype_extras();
}
开发者ID:agwells,项目名称:Mahara-1,代码行数:82,代码来源:upgrade.php


示例14: set_access


//.........这里部分代码省略.........
     // need to have the view and any attached artefacts removed from their
     // watchlist.
     $oldusers = array();
     foreach ($this->get_access() as $item) {
         if ($item['type'] == 'user') {
             $oldusers[] = $item;
         }
     }
     $newusers = array();
     if ($accessdata) {
         foreach ($accessdata as $item) {
             if ($item['type'] == 'user') {
                 $newusers[] = $item;
             }
         }
     }
     $userstodelete = array();
     foreach ($oldusers as $olduser) {
         foreach ($newusers as $newuser) {
             if ($olduser['id'] == $newuser['id']) {
                 continue 2;
             }
         }
         $userstodelete[] = $olduser;
     }
     if ($userstodelete) {
         $userids = array();
         foreach ($userstodelete as $user) {
             $userids[] = intval($user['id']);
         }
         $userids = implode(',', $userids);
         execute_sql('DELETE FROM {usr_watchlist_view}
             WHERE view = ' . $this->get('id') . '
             AND usr IN (' . $userids . ')');
     }
     $beforeusers = activity_get_viewaccess_users($this->get('id'), $USER->get('id'), 'viewaccess');
     // Procedure:
     // get list of current friends - this is available in global $data
     // compare with list of new friends
     // work out which friends are being removed
     // foreach friend
     //     // remove record from usr_watchlist_view where usr = ? and view = ?
     //     // remove records from usr_watchlist_artefact where usr = ? and view = ?
     // endforeach
     //
     db_begin();
     delete_records('view_access', 'view', $this->get('id'));
     delete_records('view_access_usr', 'view', $this->get('id'));
     delete_records('view_access_group', 'view', $this->get('id'));
     delete_records('view_access_token', 'view', $this->get('id'), 'visible', 1);
     $time = db_format_timestamp(time());
     // View access
     if ($accessdata) {
         foreach ($accessdata as $item) {
             $accessrecord = new StdClass();
             $accessrecord->view = $this->get('id');
             if (isset($item['startdate'])) {
                 $accessrecord->startdate = db_format_timestamp($item['startdate']);
             }
             if (isset($item['stopdate'])) {
                 $accessrecord->stopdate = db_format_timestamp($item['stopdate']);
             }
             switch ($item['type']) {
                 case 'public':
                 case 'loggedin':
                 case 'friends':
                     $accessrecord->accesstype = $item['type'];
                     insert_record('view_access', $accessrecord);
                     break;
                 case 'user':
                     $accessrecord->usr = $item['id'];
                     insert_record('view_access_usr', $accessrecord);
                     break;
                 case 'group':
                     $accessrecord->group = $item['id'];
                     if ($item['role']) {
                         // Don't insert a record for a role the group doesn't have
                         $roleinfo = group_get_role_info($item['id']);
                         if (!isset($roleinfo[$item['role']])) {
                             break;
                         }
                         $accessrecord->role = $item['role'];
                     }
                     insert_record('view_access_group', $accessrecord);
                     break;
                 case 'token':
                     $accessrecord->token = $item['id'];
                     insert_record('view_access_token', $accessrecord);
                     break;
             }
         }
     }
     $data = new StdClass();
     $data->view = $this->get('id');
     $data->owner = $USER->get('id');
     $data->oldusers = $beforeusers;
     activity_occurred('viewaccess', $data);
     handle_event('saveview', $this->get('id'));
     db_commit();
 }
开发者ID:Br3nda,项目名称:mahara,代码行数:101,代码来源:view.php


示例15: dirname

<?php

include_once dirname(__FILE__) . "/../lib/utilities.php";
include_once dirname(__FILE__) . "/../lib/app.php";
$fixture = file_get_contents("test_status.json");
handle_event($fixture);
开发者ID:alexandrubordei,项目名称:basic_marathon_orchestration,代码行数:6,代码来源:test_handler.php


示例16: file_get_contents

<?php

include_once "utilities.php";
include_once "app.php";
//get body
$entityBody = file_get_contents('php://input');
handle_event($entityBody);
开发者ID:alexandrubordei,项目名称:basic_marathon_orchestration,代码行数:7,代码来源:marathon_callback_endpoint.php


示例17: delete

 public function delete()
 {
     if (empty($this->id)) {
         $this->dirty = false;
         return;
     }
     //Propagate the deletion of the block
     handle_event('deleteblockinstance', $this);
     db_begin();
     safe_require('blocktype', $this->get('blocktype'), 'lib.php', 'require_once', true);
     $classname = generate_class_name('blocktype', $this->get('blocktype'));
     if (is_callable($classname . '::delete_instance')) {
         call_static_method($classname, 'delete_instance', $this);
     }
     delete_records('view_artefact', 'block', $this->id);
     delete_records('block_instance', 'id', $this->id);
     db_commit();
     $this->dirty = false;
 }
开发者ID:sarahjcotton,项目名称:mahara,代码行数:19,代码来源:lib.php


示例18: removeMember

 public function removeMember($user)
 {
     if (is_numeric($user)) {
         $user = get_record('usr', 'id', $user);
     }
     db_begin();
     // If the user is being authed by the institution they are
     // being removed from, change them to internal auth, or if
     // we can't find that, some other no institution auth.
     $authinstances = get_records_select_assoc('auth_instance', "institution IN ('mahara', ?)", array($this->name), "institution = 'mahara' DESC, authname = 'internal' DESC");
     $oldauth = $user->authinstance;
     if (isset($authinstances[$oldauth]) && $authinstances[$oldauth]->institution == $this->name) {
         foreach ($authinstances as $ai) {
             if ($ai->authname == 'internal' && $ai->institution == 'mahara') {
                 $user->authinstance = $ai->id;
                 break;
             } else {
                 if ($ai->institution == 'mahara') {
                     $user->authinstance = $ai->id;
                     break;
                 }
             }
         }
         delete_records('auth_remote_user', 'authinstance', $oldauth, 'localusr', $user->id);
         // If the old authinstance was external, the user may need
         // to set a password
         if ($user->password == '') {
             log_debug('resetting pw for ' . $user->id);
             $this->removeMemberSetPassword($user);
         } else {
             if ($authinstances[$oldauth]->authname != 'internal') {
                 $sitename = get_config('sitename');
                 $fullname = display_name($user, null, true);
                 email_user($user, null, get_string('noinstitutionoldpassemailsubject', 'mahara', $sitename, $this->displayname), get_string('noinstitutionoldpassemailmessagetext', 'mahara', $fullname, $this->displayname, $sitename, $user->username, get_config('wwwroot'), get_config('wwwroot'), $sitename, get_config('wwwroot')), get_string('noinstitutionoldpassemailmessagehtml', 'mahara', hsc($fullname), hsc($this->displayname), hsc($sitename), hsc($user->username), get_config('wwwroot'), get_config('wwwroot'), get_config('wwwroot'), hsc($sitename), get_config('wwwroot'), get_config('wwwroot')));
             }
         }
         update_record('usr', $user);
     }
     // If this user has a favourites list which is updated by this institution, remove it
     // from this institution's control.
     // Don't delete it in case the user wants to keep it, but move it out of the way, so
     // another institution can create a new faves list with the same name.
     execute_sql("\n            UPDATE {favorite}\n            SET institution = NULL, shortname = substring(shortname from 1 for 100) || '.' || ?\n            WHERE owner = ? AND institution = ?", array(substr($this->name, 0, 100) . '.' . get_random_key(), $user->id, $this->name));
     execute_sql("\n            DELETE FROM {usr_tag}\n            WHERE usr = ? AND tag " . db_ilike() . " 'lastinstitution:%'", array($user->id));
     insert_record('usr_tag', (object) array('usr' => $user->id, 'tag' => 'lastinstitution:' . strtolower($this->name)));
     // If the user's license default is set to "institution default", remove the pref
     delete_records('usr_account_preference', 'usr', $user->id, 'field', 'licensedefault', 'value', LICENSE_INSTITUTION_DEFAULT);
     delete_records('usr_institution', 'usr', $user->id, 'institution', $this->name);
     handle_event('updateuser', $user->id);
     db_commit();
 }
开发者ID:kienv,项目名称:mahara,代码行数:51,代码来源:institution.php


示例19: group_add_user

/**
 * Adds a member to a group.
 *
 * Doesn't do any jointype checking, that should be handled by the caller.
 *
 * TODO: it should though. We should probably have group_user_can_be_added
 *
 * @param int $groupid
 * @param int $userid
 * @param string $role
 */
function group_add_user($groupid, $userid, $role = null, $method = 'internal')
{
    $groupid = group_param_groupid($groupid);
    $userid = group_param_userid($userid);
    $gm = new StdClass();
    $gm->member = $userid;
    $gm->group = $groupid;
    $gm->ctime = db_format_timestamp(time());
    if (!$role) {
        $role = get_field_sql('SELECT gt.defaultrole FROM {grouptype} gt, {group} g WHERE g.id = ? AND g.grouptype = gt.name', array($groupid));
    }
    $gm->role = $role;
    $gm->method = $method;
    db_begin();
    insert_record('group_member', $gm);
    delete_records('group_member_request', 'group', $groupid, 'member', $userid);
    delete_records('group_member_invite', 'group', $groupid, 'member', $userid);
    handle_event('userjoinsgroup', $gm);
    db_commit();
    global $USER;
    $USER->reset_grouproles();
}
开发者ID:vohung96,项目名称:mahara,代码行数:33,代码来源:group.php


示例20: dirname

<?php

include_once dirname(__FILE__) . "/../lib/events.php";
include_once dirname(__FILE__) . "/../lib/utilities.php";
$post = file_get_contents("php://input");
handle_event($post);
开发者ID:alexandrubordei,项目名称:basic_marathon_orchestration,代码行数:6,代码来源:handle_event.php



注:本文中的handle_event函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP handle_goods_article函数代码示例发布时间:2022-05-15
下一篇:
PHP handle_errors函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap