| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- <?php return array (
- 'c9c38ffa1cc58b6aa6fd45efd6acff61' =>
- array (
- 'criteria' =>
- array (
- 'name' => 'loglogins',
- ),
- 'object' =>
- array (
- 'name' => 'loglogins',
- 'path' => '{core_path}components/loglogins/',
- 'assets_path' => '',
- ),
- ),
- '7104b87cadd0313492b124c744ad825d' =>
- array (
- 'criteria' =>
- array (
- 'category' => 'LogLogins',
- ),
- 'object' =>
- array (
- 'id' => 19,
- 'parent' => 0,
- 'category' => 'LogLogins',
- 'rank' => 0,
- ),
- ),
- 'a6a69e423ce77aad3b96c4bfd5e6dbf4' =>
- array (
- 'criteria' =>
- array (
- 'name' => 'LogLogins',
- ),
- 'object' =>
- array (
- 'id' => 10,
- 'source' => 0,
- 'property_preprocess' => 0,
- 'name' => 'LogLogins',
- 'description' => '',
- 'editor_type' => 0,
- 'category' => 19,
- 'cache_type' => 0,
- 'plugincode' => '/** @var $modx modX */
- $pluginKey = \'loglogins_contexts\';
- /* Set action based on event name */
- if (strpos($modx->event->name, \'Login\') !== false) {
- $act = $modx->lexicon(\'login\');
- } else {
- $modx->lexicon->load(\'core:default\');
- $act = $modx->lexicon(\'logout\');
- }
- /* Need this because $modx->user is not available in some cases
- and MODX uses it for the actor in logManagerActions()*/
- if (isset($user)) {
- $modx->user =& $user;
- }
- $allContexts = array();
- /* These are from the vars passed to the event on login.
- Converted here to a comma-separated string */
- $ac = isset($attributes[\'addContexts\'])
- ? $attributes[\'addContexts\']
- : array();
- $lc = isset($attributes[\'loginContext\'])
- ? $attributes[\'loginContext\']
- : \'\';
- if ( (empty($ac))) {
- $allContexts[] = $lc;
- } else {
- $allContexts = $ac;
- if (! in_array($lc, $ac)) {
- $allContexts[] = $lc;
- }
- }
- $msg = !empty($allContexts)? implode(\',\', $allContexts) : \'\';
- /* $msg is always \'mgr\' for manager logins and logouts */
- if (strpos($modx->event->name, \'Manager\') !== false) {
- $msg = \'mgr\';
- }
- switch ($modx->event->name) {
- /* Save contexts in user setting */
- case \'OnWebLogin\':
- $setting = $modx->getObject(\'modUserSetting\',
- array(
- \'user\' => $user->get(\'id\'),
- \'key\' => $pluginKey,
- ));
- if (! $setting) {
- /* Create User Setting if it doesn\'t exist */
- $setting = $modx->newObject(\'modUserSetting\');
- $setting->set(\'user\', $user->get(\'id\'));
- $setting->set(\'key\', $pluginKey);
- $setting->set(\'namespace\', \'loglogins\');
- }
- /* Set value to login contexts */
- if ($setting) {
- $setting->set(\'value\', $msg);
- $setting->save();
- }
- break;
- case \'OnWebLogout\':
- /* Get contexts from user setting */
- $setting = $modx->getObject(\'modUserSetting\',
- array(
- \'user\' => $user->get(\'id\'),
- \'key\' => $pluginKey,
- ));
- if ($setting) {
- $msg = $setting->get(\'value\');
- } else {
- $msg = \'\';
- }
- break;
- }
- $modx->logManagerAction($act, \'modContext\', $msg);
- return \'\';',
- 'locked' => 0,
- 'properties' => 'a:0:{}',
- 'disabled' => 1,
- 'moduleguid' => '',
- 'static' => 0,
- 'static_file' => '',
- 'content' => '/** @var $modx modX */
- $pluginKey = \'loglogins_contexts\';
- /* Set action based on event name */
- if (strpos($modx->event->name, \'Login\') !== false) {
- $act = $modx->lexicon(\'login\');
- } else {
- $modx->lexicon->load(\'core:default\');
- $act = $modx->lexicon(\'logout\');
- }
- /* Need this because $modx->user is not available in some cases
- and MODX uses it for the actor in logManagerActions()*/
- if (isset($user)) {
- $modx->user =& $user;
- }
- $allContexts = array();
- /* These are from the vars passed to the event on login.
- Converted here to a comma-separated string */
- $ac = isset($attributes[\'addContexts\'])
- ? $attributes[\'addContexts\']
- : array();
- $lc = isset($attributes[\'loginContext\'])
- ? $attributes[\'loginContext\']
- : \'\';
- if ( (empty($ac))) {
- $allContexts[] = $lc;
- } else {
- $allContexts = $ac;
- if (! in_array($lc, $ac)) {
- $allContexts[] = $lc;
- }
- }
- $msg = !empty($allContexts)? implode(\',\', $allContexts) : \'\';
- /* $msg is always \'mgr\' for manager logins and logouts */
- if (strpos($modx->event->name, \'Manager\') !== false) {
- $msg = \'mgr\';
- }
- switch ($modx->event->name) {
- /* Save contexts in user setting */
- case \'OnWebLogin\':
- $setting = $modx->getObject(\'modUserSetting\',
- array(
- \'user\' => $user->get(\'id\'),
- \'key\' => $pluginKey,
- ));
- if (! $setting) {
- /* Create User Setting if it doesn\'t exist */
- $setting = $modx->newObject(\'modUserSetting\');
- $setting->set(\'user\', $user->get(\'id\'));
- $setting->set(\'key\', $pluginKey);
- $setting->set(\'namespace\', \'loglogins\');
- }
- /* Set value to login contexts */
- if ($setting) {
- $setting->set(\'value\', $msg);
- $setting->save();
- }
- break;
- case \'OnWebLogout\':
- /* Get contexts from user setting */
- $setting = $modx->getObject(\'modUserSetting\',
- array(
- \'user\' => $user->get(\'id\'),
- \'key\' => $pluginKey,
- ));
- if ($setting) {
- $msg = $setting->get(\'value\');
- } else {
- $msg = \'\';
- }
- break;
- }
- $modx->logManagerAction($act, \'modContext\', $msg);
- return \'\';',
- ),
- ),
- );
|