18 require_once dirname(__FILE__).
'/../../page_templates/page_asset_builder/page_asset_builder.inc';
19 require_once SQ_FUDGE_PATH.
'/general/text.inc';
20 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
45 parent::__construct($assetid);
68 $val[
'subject'] = translate(
'cms_account_manager_validation_email_default_subject');
69 $val[
'text_format'] = translate(
'cms_account_manager_validation_email_default_content',
'%validation_url%');
70 $val[
'html_format'] =
'<p>'.translate(
'cms_account_manager_validation_email_default_content',
'<a href="%validation_url%">%validation_url%</a>').
'</p>';
71 $val[
'from'] = SQ_CONF_SYSTEM_NAME.
' <'.SQ_CONF_DEFAULT_EMAIL.
'>';
72 $this->setAttrVAlue(
'validation_email_format', $val);
74 return parent::create($link);
91 if (isset($this->_tmp[
'vars_set'][
'use_email_validation'])) {
92 if ($this->
attr(
'use_email_validation')) {
94 'create_no_login' => translate(
'cms_account_manager_awaiting_validation'),
95 'create_login' => translate (
'cms_account_manager_validated'),
99 'create_no_login' => translate(
'cms_account_manager_created_not_live'),
100 'create_login' => translate(
'cms_account_manager_created_live'),
103 foreach (Array(
'create_login',
'create_no_login') as $value) {
104 $link = $GLOBALS[
'SQ_SYSTEM']->am->getLink($this->
id, NULL,
'bodycopy', TRUE, $value);
106 $bc = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($link[
'minorid'],
'bodycopy');
107 $bc->setAttrValue(
'name', $new_names[$value]);
108 $bc->saveAttributes();
113 $GLOBALS[
'SQ_SYSTEM']->changeDatabaseConnection(
'db2');
114 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'BEGIN');
117 if ($this->
attr(
'use_email_validation')) {
119 $required_fields = $this->
attr(
'required_fields');
120 list($create_type) = array_keys($this->
attr(
'create_type'));
122 if (!isset($required_fields[$create_type])) {
123 $required_fields[$create_type] = Array();
125 if (!isset($required_fields[$create_type][
'username'])) {
126 $required_fields[$create_type][
'username'] = translate(
'cms_account_manager_username_required');
129 if (!isset($required_fields[$create_type][
'email'])) {
130 $required_fields[$create_type][
'email'] = translate(
'cms_account_manager_email_required');
135 if (!$this->
setAttrValue(
'required_fields', $required_fields)) {
136 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
137 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
144 if (!parent::saveAttributes($dont_run_updated)) {
145 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
146 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
150 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'COMMIT');
151 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
165 $current_user = $GLOBALS[
'SQ_SYSTEM']->user;
166 if ((!is_null($current_user) && !($current_user instanceof
Public_User)) && !SQ_IN_LIMBO) {
168 if ($this->
attr(
'enter_edit_mode')) {
170 $redirect_url = strip_url($this->
getURL()).
'/'.SQ_CONF_LIMBO_SUFFIX.
'/?ignore_frames=1';
174 if (isset($_REQUEST[
'SQ_LOGIN_ACCOUNT_MANAGER_STATE']) && $_REQUEST[
'SQ_LOGIN_ACCOUNT_MANAGER_STATE'] ==
'create_login') {
175 $link = $GLOBALS[
'SQ_SYSTEM']->am->getLink($this->
id, SQ_LINK_NOTICE,
'', FALSE,
'login_redirect');
178 $redirect_asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($link[
'minorid']);
179 $redirect_url = $redirect_asset->getURL();
180 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($redirect_asset);
185 if (isset($redirect_url)) {
186 header(
'Location: '.$redirect_url);
189 parent::printFrontend();
203 $this->_replacements[
'resend_validation_form'] = $this->getkeywordreplacement(
're_send_validation_form');
204 parent::_loadCreateReplacements();
236 if (isset($GLOBALS[
'SQ_SYSTEM']->backend->out)) {
237 $GLOBALS[
'SQ_SYSTEM']->backend->out->addFormActionGetVar(
'ignore_frames',
'1', TRUE);
240 $current_user = $GLOBALS[
'SQ_SYSTEM']->user;
241 $this->_current_state =
'logged_in';
243 if (!is_null($current_user) && !($current_user instanceof
Public_User)) {
245 $hh = $GLOBALS[
'SQ_SYSTEM']->getHipoHerder();
247 'assetids' => Array($current_user->id,),
248 'lock_type' =>
'attributes',
249 'forceably_acquire' => FALSE,
251 $lock_errors = $hh->freestyleHipo(
'hipo_job_acquire_locks', $vars);
259 if (!empty($lock_errors)) {
260 $this->_replacements[
'edit_details_lock_error'] = $this->
getKeywordReplacement(
'edit_details_lock_error');
261 $current_user->printBody();
267 require_once SQ_INCLUDE_PATH.
'/asset_edit_interface.inc';
271 $default_screen = $aei->_default_screen;
272 if (empty($default_screen)) {
273 $default_screen =
'details';
276 $check_screen_restrictions = (!($GLOBALS[
'SQ_SYSTEM']->userRoot() || $GLOBALS[
'SQ_SYSTEM']->userSystemAdmin()));
277 if ($check_screen_restrictions) {
278 if (empty($allowed_screens)) {
279 $check_screen_restrictions = FALSE;
283 if ($check_screen_restrictions && !isset($allowed_screens[$default_screen])) {
284 $this->_replacements[
'edit_details_invite'] =
'<p>'.translate(
'cms_account_manager_cannot_edit_details').
'</p>';
285 $current_user->printBody();
287 $this->_replacements[
'edit_details_invite'] = $this->
attr(
'edit_details_invite');
288 $current_user->initLimbo();
289 $current_user->printLimbo();
293 $this->_replacements[
'edit_details_form'] = ob_get_contents();
316 $allowed = parent::_getAllowedLinks();
317 $allowed[SQ_LINK_NOTICE][
'asset'] = Array(
'card' =>
'M',
'exclusive' => FALSE);
336 list($create_type) = array_keys($this->
attr(
'create_type'));
340 if (isset($_POST[
'AB_'.$this->
id.
'_ASSET_BUILDER_ACTION']) && $_POST[
'AB_'.$this->
id.
'_ASSET_BUILDER_ACTION'] ==
'resend_validation') {
344 if (strtolower(array_get_index($_GET,
'action',
'')) ==
'validate') {
347 if (!is_null($user)) {
350 $this->_current_state =
'create_login';
351 $_POST[
'SQ_LOGIN_USERNAME'] = $user->attr(
'username');
352 $this->_replacements[
'login_invite'] = $this->
attr(
'login_invite');
354 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($user);
363 if ($this->
attr(
'use_email_validation') && isset($_POST[
'AB_'.$this->
id.
'_ASSET_BUILDER_ACTION']) && strtolower($_POST[
'AB_'.$this->
id.
'_ASSET_BUILDER_ACTION']) ==
'create') {
366 $this->_tmp[
'am_created_asset_key'] =
'';
368 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset($create_type);
369 $new_asset =
new $create_type();
371 $real_username = $new_asset->getAttribute(
'username', TRUE);
372 if (is_null($real_username))
continue;
374 $username = $real_username;
376 $username->process($new_asset->getPrefix().
'_'.$username->id);
377 if ($username->processed) {
378 if (!empty($username->value)) {
379 $this->_tmp[
'am_created_asset_key'] = md5(microtime().$username->value);
383 unset($real_username);
392 $success = parent::_processGlobalActions();
393 if (!$success)
return FALSE;
395 if (isset($_POST[
'AB_'.$this->
id.
'_ASSET_BUILDER_ACTION'])) {
396 switch (strtolower($_POST[
'AB_'.$this->
id.
'_ASSET_BUILDER_ACTION'])) {
398 if (empty($this->_errors) && !empty($this->_tmp[
'created_asset'])) {
399 if ($this->
attr(
'use_email_validation')) {
402 $new_asset =& $this->_tmp[
'created_asset'];
407 $GLOBALS[
'SQ_SYSTEM']->setRunLevel(SQ_RUN_LEVEL_FORCED);
409 $GLOBALS[
'SQ_SYSTEM']->changeDatabaseConnection(
'db2');
410 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'BEGIN');
412 foreach (get_constant_values(
'SQ_PERMISSION_') as $permission_name => $permission) {
413 $permissions = $GLOBALS[
'SQ_SYSTEM']->am->getPermission($new_asset->id, $permission, NULL, FALSE);
414 foreach ($permissions as $userid) {
415 if (!(($permission == SQ_PERMISSION_ADMIN) && ($userid == $new_asset->id))) {
416 if (!$GLOBALS[
'SQ_SYSTEM']->am->deletePermission($new_asset->id, $userid, $permission)) {
417 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
418 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
419 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
424 $permissions = $GLOBALS[
'SQ_SYSTEM']->am->getPermission($new_asset->id, $permission, NULL, FALSE);
427 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'COMMIT');
428 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
429 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
432 $selected_create_locations = Array();
433 foreach ($this->
attr(
'create_location_optional') as $set_name => $details) {
434 $tmp_locations = Array();
436 if (isset($_POST[$code_name])) {
437 if ($details[
'allow_multiple'] && is_array($_POST[$code_name])) {
438 foreach ($_POST[$code_name] as $location_id) {
440 $tmp_locations[] = $location_id;
443 $tmp_locations = array_intersect($tmp_locations, array_keys($details[
'locations']));
445 foreach ($tmp_locations as $location_id) {
446 $selected_create_locations[$location_id] = Array(
447 'set_name' => $set_name,
448 'link_type' => (
int)$details[
'link_type'],
453 if (in_array($_POST[$code_name], array_keys($details[
'locations']))) {
454 $selected_create_locations[(int)$_POST[$code_name]] = Array(
455 'set_name' => $set_name,
456 'link_type' => (
int)$details[
'link_type'],
460 }
else if (!$details[
'allow_empty']) {
461 trigger_localised_error(
'CMS0036', E_USER_WARNING, $set_name);
468 if (!empty($selected_create_locations)) {
469 $GLOBALS[
'SQ_SYSTEM']->setRunLevel(SQ_RUN_LEVEL_FORCED);
471 $GLOBALS[
'SQ_SYSTEM']->changeDatabaseConnection(
'db2');
472 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'BEGIN');
474 foreach ($selected_create_locations as $locationid => $link_type) {
475 $location = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($locationid,
'', TRUE);
476 if (is_null($location))
continue;
477 if (!$GLOBALS[
'SQ_SYSTEM']->am->createAssetLink($location, $new_asset, SQ_LINK_NOTICE, $this->getPrefix().
'_selected_create_location-'.$link_type[
'link_type'])) {
479 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
480 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
481 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
486 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'COMMIT');
487 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
489 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
493 $replacements = Array();
494 $attrs = $GLOBALS[
'SQ_SYSTEM']->am->getAssetTypeAttributes($create_type);
495 foreach ($attrs as $attr => $type) {
496 if (($attr ==
'password') || ($type[
'type'] ==
'serialise')) {
499 $replacements[$attr] = $new_asset->attr($attr);
502 $replacements[
'validation_url'] = current_url().
'?action=validate&amid='.$this->_tmp[
'am_created_asset_key'];
505 $email_attr = $this->
getAttribute(
'validation_email_format');
506 $new_value = unserialize($email_attr->value);
507 $new_value[
'to'][] = $replacements[
'email'];
508 $email_attr->value = serialize($new_value);
511 $email_attr->sendMail($replacements);
515 if ($this->
attr(
'create_status') >= SQ_STATUS_LIVE && !$this->
attr(
'use_email_validation')) {
516 $this->_current_state =
'create_login';
517 $_POST[
'SQ_LOGIN_USERNAME'] = $this->_tmp[
'created_asset']->attr(
'username');
518 $this->_replacements[
'login_invite'] = $this->
attr(
'login_invite');
521 $this->_current_state =
'create_no_login';
548 $locs = parent::getCreateLocations($create_type);
549 if ($this->
attr(
'use_email_validation') && !empty($locs)) {
555 if ($pending_groupid) {
556 $locs = Array($pending_groupid => SQ_LINK_TYPE_1);
574 parent::_modifyCreateLink($link);
575 if ($this->
attr(
'use_email_validation')) {
576 $link[
'value'] = $this->_tmp[
'am_created_asset_key'];
594 if ($this->
attr(
'use_email_validation')) {
597 return parent::_setCreateStatus($new_asset);
615 $current_user = $GLOBALS[
'SQ_SYSTEM']->user;
617 if (!is_null($current_user) && !($current_user instanceof
Public_User)) {
618 if ($current_user->processBackend($o, $link)) {
626 return parent::processBackend($o, $link);
640 return ($GLOBALS[
'SQ_SYSTEM']->user instanceof
User);
642 return parent::backendAccess();
658 $res[
'not_logged_in'][
'name'] = translate(
'not_logged_in');
659 $res[
'not_logged_in'][
'content'] =
'<p>%create_error%%login_error%</p>'.
"\n".
660 '%create_invite%%create_form%%login_invite%%login_form%';
662 $res[
'create_no_login'][
'name'] = translate(
'cms_account_manager_created_not_live');
663 $res[
'create_no_login'][
'content'] = translate(
'cms_account_manager_created_need_activation');
665 $res[
'create_login'][
'name'] = translate(
'cms_account_manager_created_live');
666 $res[
'create_login'][
'content'] = translate(
'cms_account_manager_created_please_log_in').
"\n%login_form%";
668 $res[
'logged_in'][
'name'] = translate(
'logged_in');
669 $res[
'logged_in'][
'content'] =
'<p>%edit_details_lock_error%%edit_details_success%</p>'.
"\n".
670 '%edit_details_invite%%edit_details_form%';
690 $create_locations = Array();
691 $links = $GLOBALS[
'SQ_SYSTEM']->am->getLinks($userid, SQ_LINK_NOTICE, Array(
'user_group'), FALSE,
'minor');
692 foreach ($links as $link) {
695 preg_match(
'/^'.$this->
getPrefix().
'_selected_create_location-([\d]*)$/', $link[
'value'], $matches);
696 if (!empty($matches)) {
697 $create_locations[$link[
'majorid']] = $matches[1];
700 return $create_locations;
721 list($create_type) = array_keys($this->
attr(
'create_type'));
723 $user_attributes = Array();
724 $attrs = $GLOBALS[
'SQ_SYSTEM']->am->getAssetTypeAttributes($create_type);
725 foreach ($attrs as $attr => $type) {
726 $user_attributes[$attr] = $user->attr($attr);
730 $create_locations = parent::getFixedCreateLocations()
731 + parent::getRuleMatchCreateLocations($create_type, $user_attributes)
732 + $selected_create_locations;
734 if (empty($create_locations)) {
735 trigger_localised_error(
'CMS0071', E_USER_WARNING);
741 $GLOBALS[
'SQ_SYSTEM']->setRunLevel(SQ_RUN_LEVEL_FORCED);
743 $GLOBALS[
'SQ_SYSTEM']->changeDatabaseConnection(
'db2');
744 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'BEGIN');
746 foreach ($create_locations as $link_parentid => $link_type) {
747 $link_parent = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($link_parentid,
'', TRUE);
748 if (is_null($link_parent))
continue;
749 if (!$GLOBALS[
'SQ_SYSTEM']->am->createAssetLink($link_parent, $user, $link_type)) {
750 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
751 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
752 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
757 $current_paths = $user->getWebPaths();
758 require_once SQ_INCLUDE_PATH.
'/general_occasional.inc';
759 $valid_paths = make_valid_web_paths($current_paths, $user->id);
760 $valid_paths = $GLOBALS[
'SQ_SYSTEM']->am->webPathsInUse($link_parent, $valid_paths, $user->id, TRUE);
761 if (!$user->saveWebPaths($valid_paths, FALSE)){
762 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
763 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
764 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
770 foreach ($selected_create_locations as $link_parentid => $link_type) {
771 $link = $GLOBALS[
'SQ_SYSTEM']->am->getLinkByAsset($link_parentid, $user->id, SQ_LINK_NOTICE, $this->getPrefix().
'_selected_create_location-'.$link_type);
773 if (!$GLOBALS[
'SQ_SYSTEM']->am->deleteAssetLink($link[
'linkid'])) {
774 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
775 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
776 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
784 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
785 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
786 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
791 if (!parent::_setCreateStatus($user)) {
792 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
793 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
794 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
799 $hh =& $GLOBALS[
'SQ_SYSTEM']->getHipoHerder();
800 $vars = Array(
'assetids' => Array($user->id),
'auto_add_remaps' => FALSE);
801 $hipo_empty_array = $hh->freestyleHipo(
'hipo_job_update_lookups', $vars);
806 foreach ($create_locations as $location_id => $link_type) {
807 foreach (Array(SQ_PERMISSION_READ, SQ_PERMISSION_WRITE, SQ_PERMISSION_ADMIN) as $perm) {
808 $set_perms = $GLOBALS[
'SQ_SYSTEM']->am->getAssetPermissionByCascade($location_id, $perm, NULL, TRUE);
809 foreach ($set_perms as $perm_info) {
810 if (!empty($hipo_empty_array) || !$GLOBALS[
'SQ_SYSTEM']->am->setPermission($user->id, $perm_info[
'userid'], $perm, $perm_info[
'granted'], TRUE, TRUE)) {
811 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
812 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
813 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
819 $mm = $GLOBALS[
'SQ_SYSTEM']->getMetadataManager();
820 $mm_schema = $mm->getSchemas($location_id, NULL, TRUE);
821 foreach ($mm_schema as $schema_id => $granted ) {
822 if (!$mm->setSchema($user->id, $schema_id, $granted)) {
823 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
824 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
825 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
830 $wfm = $GLOBALS[
'SQ_SYSTEM']->getWorkflowManager();
831 $wf_schema = $wfm->getSchemas($location_id, NULL, FALSE, TRUE);
832 foreach ($wf_schema as $schema_id => $granted ) {
833 if (!$wfm->setSchema($user->id, $schema_id, $granted)) {
834 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
835 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
836 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
843 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'COMMIT');
844 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
845 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
864 $user = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($item);
865 if (is_null($user))
return FALSE;
867 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($user);
885 $user = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($item);
886 $user->saveWebPaths(Array());
887 $GLOBALS[
'SQ_SYSTEM']->am->trashAsset($item);
892 $GLOBALS[
'SQ_PURGING_TRASH'] = TRUE;
895 $inbox_link = $user->getInboxLink();
896 $inbox = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($inbox_link[
'minorid']);
897 $GLOBALS[
'SQ_SYSTEM']->am->trashAsset($inbox->id);
898 $inbox->updateLookups();
901 $workspace = $user->getWorkspace();
902 $workspace->saveWebPaths(Array());
903 $GLOBALS[
'SQ_SYSTEM']->am->trashAsset($workspace->id);
904 $workspace->updateLookups();
906 $inbox->delete(FALSE);
907 $workspace->delete(FALSE);
909 $GLOBALS[
'SQ_PURGING_TRASH'] = FALSE;
912 $user->delete(FALSE);
930 if (is_null($username)) {
931 if (!empty($_REQUEST[$this->
getPrefix().
'_resend_validation_username'])) {
932 $username = $_REQUEST[$this->
getPrefix().
'_resend_validation_username'];
936 if (!is_null($username) && $this->
attr(
'use_email_validation')) {
939 $auth_folder = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'authentication_folder');
940 $auth_systems = $auth_folder->getAuthSystems();
942 foreach ($auth_systems as $systemid) {
943 $system = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($systemid);
944 if (is_null($system))
continue;
945 $user = $system->locateUser($username);
946 if (!is_null($user) && $user->id) {
951 if (is_null($user)) {
952 $this->_errors[] = translate(
'cms_account_manager_keyword_resend_validation_user_not_found');
957 $replacements = Array();
958 list($create_type) = array_keys($this->
attr(
'create_type'));
959 $attrs = $GLOBALS[
'SQ_SYSTEM']->am->getAssetTypeAttributes($create_type);
960 foreach ($attrs as $attr => $type) {
961 if (($attr ==
'password') || ($type[
'type'] ==
'serialise')) {
964 $replacements[$attr] = $user->attr($attr);
966 $url = SQ_IN_CRON ? $this->
getURL() : current_url();
967 $replacements[
'validation_url'] = $url.
'?action=validate&amid='.$validation_key;
970 $email_attr = $this->
getAttribute(
'validation_email_format');
971 $new_value = unserialize($email_attr->value);
972 $new_value[
'to'][] = $replacements[
'email'];
974 if (is_null($new_email_attr)) {
975 $this->_errors[] = translate(
'cms_account_manager_keyword_resend_validation_cannot_send_user');
980 $new_email_attr->sendMail($replacements);
981 $this->_replacements[
'resend_validation_success'] = $this->
getKeywordReplacement(
're_send_validation_success');
985 $this->_errors[] = translate(
'cms_account_manager_keyword_resend_validation_cannot_send_user');
992 $this->_errors[] = translate(
'cms_account_manager_keyword_resend_validation_cannot_send_user');
1012 $links = $GLOBALS[
'SQ_SYSTEM']->am->getLinkByAsset($pending_usergroup_id, $user->id);
1015 if (!empty($links))
return $links[
'value'];
1029 $group_link = Array(
'asset' => &$this,
'link_type' => SQ_LINK_TYPE_2,
'sort_order' => 0,
'is_dependant' => 1,
'is_exclusive' => 1,
'value' =>
'pending_accounts');
1030 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'user_group');
1033 $group->setAttrValue(
'name',
'Pending Accounts');
1034 if (!$group->create($group_link)) {
1051 $link = $GLOBALS[
'SQ_SYSTEM']->am->getLink($this->
id, SQ_LINK_TYPE_2,
'user_group', TRUE,
'pending_accounts');
1055 return $link[
'minorid'];
1070 $id = (isset($_REQUEST[
'amid'])) ? trim($_REQUEST[
'amid']) :
'';
1072 $pending_link = $GLOBALS[
'SQ_SYSTEM']->am->getLink($this->
id, SQ_LINK_TYPE_2,
'user_group', TRUE,
'pending_accounts');
1073 if (!empty($pending_link)) {
1074 $link = $GLOBALS[
'SQ_SYSTEM']->am->getLink($pending_link[
'minorid'], SQ_LINK_TYPE_1,
'user', FALSE, $id);
1075 if (!empty($link)) {
1076 $user = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($link[
'minorid'], $link[
'minor_type_code']);
1096 if (!empty($pending_accounts_groupid)) {
1097 $link = $GLOBALS[
'SQ_SYSTEM']->am->getLinkByAsset($pending_accounts_groupid, $userid, SQ_LINK_TYPE_1);
1098 if (!empty($link)) {
1099 $resent_link = $GLOBALS[
'SQ_SYSTEM']->am->getLinkByAsset($pending_accounts_groupid, $userid, SQ_LINK_NOTICE,
'validation_email_resent');
1100 if (!empty($resent_link)) $GLOBALS[
'SQ_SYSTEM']->am->deleteAssetLink($resent_link[
'linkid']);
1101 return $GLOBALS[
'SQ_SYSTEM']->am->deleteAssetLink($link[
'linkid']);
1120 if (!empty($group_folder_id)) {
1121 $links = $GLOBALS[
'SQ_SYSTEM']->am->getLinks($group_folder_id, SQ_LINK_TYPE_1,
'user', FALSE);
1122 foreach ($links as $link) {
1123 $users[] = $link[
'minorid'];
1147 if (!isset($vars[
'keywords']))
return;
1150 $parents = $GLOBALS[
'SQ_SYSTEM']->am->getParents($broadcaster->id,
'bodycopy', TRUE);
1151 $type_links = $GLOBALS[
'SQ_SYSTEM']->am->getLinks($this->
id, SQ_LINK_TYPE_2,
'bodycopy');
1152 $bodycopy_type =
'';
1153 foreach ($type_links as $link_info) {
1154 if (isset($parents[$link_info[
'minorid']])) {
1155 $bodycopy_type = $link_info[
'value'];
1159 switch ($bodycopy_type) {
1160 case 'not_logged_in' :
1166 case 'create_login' :
1167 case 'create_no_login' :
1186 $keywords = parent::_getLoggedInKeywords();
1189 $keywords[
'edit_details_invite'] = translate(
'cms_account_manager_keyword_edit_details_invite');
1190 $keywords[
'edit_details_form'] = translate(
'cms_account_manager_keyword_edit_details_form');
1191 $keywords[
'edit_details_success'] = translate(
'cms_account_manager_keyword_edit_details_success');
1192 $keywords[
'edit_details_lock_error'] = translate(
'cms_account_manager_keyword_edit_details_lock_error');
1194 $keywords[
'logout_form'] = translate(
'cms_asset_builder_keyword_logout_form');
1197 if ($this->
attr(
'require_captcha')) {
1198 unset($keywords[
'form_captcha']);
1199 unset($keywords[
'form_captcha_image']);
1200 unset($keywords[
'form_captcha_field']);
1201 unset($keywords[
'form_captcha_link']);
1217 $keywords = parent::_getCreatedKeywords();
1220 $keywords[
'create_invite'] = translate(
'cms_account_manager_keyword_create_invite');
1221 $keywords[
'create_form'] = translate(
'cms_account_manager_keyword_create_form');
1222 $keywords[
'create_error'] = translate(
'cms_account_manager_keyword_create_error');
1223 $keywords[
'resend_validation_form'] = translate(
'cms_account_manager_keyword_resend_validation_form');
1238 $keywords = parent::_getNotLoggedInKeywords();
1239 $keywords[
'resend_validation_error'] = translate(
'cms_account_manager_keyword_resend_validation_error');
1240 $keywords[
'resend_validation_form'] = translate(
'cms_account_manager_keyword_resend_validation_form');
1241 $keywords[
'resend_validation_success'] = translate(
'cms_account_manager_keyword_resend_validation_success');
1243 if ($this->
attr(
'require_captcha')) {
1244 $keywords[
'form_captcha'] = translate(
'cms_asset_builder_keyword_form_captcha');
1245 $keywords[
'form_captcha_image'] = translate(
'cms_asset_builder_keyword_form_captcha_image');
1246 $keywords[
'form_captcha_field'] = translate(
'cms_asset_builder_keyword_form_captcha_field');
1247 $keywords[
'form_captcha_link'] = translate(
'cms_asset_builder_keyword_form_captcha_link');
1267 text_box($this->
getPrefix().
'_resend_validation_username',
'',20);
1268 submit_button(
'', $this->
attr(
'resend_validation_button'),
'document.getElementById(\'AB_'.$this->
id.
'_ASSET_BUILDER_ACTION\').value = \'resend_validation\';');
1269 return ob_get_clean();
1282 return $this->
attr(
'edit_details_lock_error');
1295 return $this->
attr(
'edit_details_success');
1308 return $this->
attr(
'resend_validation_success');
1323 <input
type=
"hidden" name=
"SQ_LOGIN_ACCOUNT_MANAGER_STATE" value=
"<?php echo $this->_current_state; ?>" />
1325 $output = ob_get_clean();
1327 return $output.parent::getLoginFormKeywordReplacement();
1342 <form
id=
"<?php echo $this->getPrefix() ?>_logout" method=
"POST" action=
"<?php echo current_url(TRUE, TRUE); ?>?SQ_ACTION=logout">
1343 <?php echo submit_button(
'logout', translate(
'logout')); ?>
1346 $replacement = ob_get_contents();
1349 return $replacement;