2 namespace TYPO3\CMS\SysAction;
58 $this->moduleUrl = BackendUtility::getModuleUrl(
'user_task');
60 $this->
getLanguageService()->includeLLFile(
'EXT:sys_action/Resources/Private/Language/locallang.xlf');
61 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'sys_action'][
'tx_sysaction_task'])) {
62 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'sys_action'][
'tx_sysaction_task'] as $classRef) {
77 foreach ($this->hookObjects as $hookObject) {
78 if (method_exists($hookObject,
'getTask')) {
79 $show = $hookObject->getTask($show, $this);
91 $content .= $flashMessage->render();
94 $content .= $this->taskObject->description($record[
'title'], $record[
'description']);
96 switch ($record[
'type']) {
99 $pageRenderer->loadRequireJsModule(
'TYPO3/CMS/SysAction/ActionTask');
116 \TYPO3\CMS\Core\Messaging\FlashMessage::class,
119 \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR
121 $content .=
'<br />' . $flashMessage->render();
138 if (!empty($actionList)) {
141 foreach ($actionList as $action) {
143 $items .=
'<li' . $active .
'>
144 <a href="' . $action[
'link'] .
'" title="' . htmlspecialchars($action[
'description']) .
'">' . htmlspecialchars($action[
'title']) .
'</a>
147 $content .=
'<ul>' . $items .
'</ul>';
160 $actionList = array();
163 $res = $this->
getDatabaseConnection()->exec_SELECTquery(
'*',
'sys_action',
'',
'',
'sys_action.sorting');
166 $additionalWhere =
'be_groups.uid IN (' . ($this->
getBackendUser()->groupList ?: 0) .
')';
167 $res = $this->
getDatabaseConnection()->exec_SELECT_mm_query(
'sys_action.*',
'sys_action',
'sys_action_asgr_mm',
'be_groups',
' AND sys_action.hidden=0 AND ' . $additionalWhere,
'sys_action.uid',
'sys_action.sorting');
170 $editActionLink =
'';
173 $link = BackendUtility::getModuleUrl(
176 'edit[sys_action][' . $actionRow[
'uid'] .
']' =>
'edit',
183 $icon = $this->iconFactory->getIcon(
'actions-document-info',
Icon::SIZE_SMALL)->render();
184 $editActionLink =
'<a class="edit" href="' . $link .
'"' . $title .
'>';
185 $editActionLink .= $icon . $this->
getLanguageService()->getLL(
'edit-sys_action') .
'</a>';
187 $actionList[] = array(
188 'uid' => $actionRow[
'uid'],
189 'title' => $actionRow[
'title'],
190 'description' => $actionRow[
'description'],
191 'descriptionHtml' => nl2br(htmlspecialchars($actionRow[
'description'])) . $editActionLink,
192 'link' => $this->moduleUrl .
'&SET[function]=sys_action.TYPO3\\CMS\\SysAction\\ActionTask&show=' . $actionRow[
'uid']
210 if (!empty($actionList)) {
211 $content .= $this->taskObject->renderListMenu($actionList);
214 $content .= $flashMessage->render();
218 $link = BackendUtility::getModuleUrl(
221 'edit[sys_action][0]' =>
'new',
222 'returnUrl' => $this->moduleUrl
228 '<a href="' . $link .
'" title="' . $this->
getLanguageService()->getLL(
'new-sys_action') .
'">' .
229 $this->iconFactory->getIcon(
'actions-document-new',
Icon::SIZE_SMALL)->render() .
247 if (!is_array($beRec)) {
249 $content .= $flashMessage->render();
254 if ($vars[
'sent'] == 1) {
260 if (empty($vars[
'username'])) {
263 if ($vars[
'key'] ===
'NEW' && empty($vars[
'password'])) {
266 if ($vars[
'key'] !==
'NEW' && !$this->
isCreatedByUser($vars[
'key'], $record)) {
269 foreach ($this->hookObjects as $hookObject) {
270 if (method_exists($hookObject,
'viewNewBackendUser_Error')) {
271 $errors = $hookObject->viewNewBackendUser_Error($vars, $errors, $this);
275 if (!empty($errors)) {
277 $content .= $flashMessage->render() .
'<br />';
283 $content .= $flashMessage->render() .
'<br />';
294 $this->
deleteUser($tmpUserId, $record[
'uid']);
300 $content .=
'<form action="" method="post" enctype="multipart/form-data">
301 <fieldset class="fields">
302 <legend>' . $this->
getLanguageService()->getLL(
'action_t1_legend_generalFields') .
'</legend>
304 <label for="field_disable">' . $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_general.xlf:LGL.disable') .
'</label>
305 <input type="checkbox" id="field_disable" name="data[disable]" value="1" class="checkbox" ' . ($vars[
'disable'] == 1 ?
' checked="checked" ' :
'') .
' />
308 <label for="field_realname">' . $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_general.xlf:LGL.name') .
'</label>
309 <input type="text" id="field_realname" name="data[realName]" value="' . htmlspecialchars($vars[
'realName']) .
'" />
312 <label for="field_username">' . $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_tca.xlf:be_users.username') .
'</label>
313 <input type="text" id="field_username" name="data[username]" value="' . htmlspecialchars($vars[
'username']) .
'" />
316 <label for="field_password">' . $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_tca.xlf:be_users.password') .
'</label>
317 <input type="password" id="field_password" name="data[password]" value="" />
320 <label for="field_email">' . $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_general.xlf:LGL.email') .
'</label>
321 <input type="text" id="field_email" name="data[email]" value="' . htmlspecialchars($vars[
'email']) .
'" />
324 <fieldset class="fields">
325 <legend>' . $this->
getLanguageService()->getLL(
'action_t1_legend_configuration') .
'</legend>
328 <label for="field_usergroup">' . $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_tca.xlf:be_users.usergroup') .
'</label>
329 <select id="field_usergroup" name="data[usergroup][]" multiple="multiple">
334 <input type="hidden" name="data[key]" value="' . $key .
'" />
335 <input type="hidden" name="data[sent]" value="1" />
336 <input class="btn btn-default" type="submit" value="' . ($key ===
'NEW' ? $this->
getLanguageService()->getLL(
'action_Create') : $this->
getLanguageService()->getLL(
'action_Update')) .
'" />
358 $redirectUrl = $this->moduleUrl .
'&show=' . $actionId;
359 \TYPO3\CMS\Core\Utility\HttpUtility::redirect($redirectUrl);
372 if (is_array($record)) {
394 $icon =
'<span title="' . htmlspecialchars(
'uid=' . $row[
'uid']) .
'">' . $this->iconFactory->getIconForRecord(
'be_users', $row,
Icon::SIZE_SMALL)->render() .
'</span>';
395 $line = $icon . $this->
action_linkUserName($row[
'username'], $row[
'realName'], $action[
'uid'], $row[
'uid']);
397 if ($row[
'uid'] == $selectedUser) {
398 $line =
'<strong>' . $line .
'</strong>';
404 if (!empty($userList)) {
405 $content .=
'<br /><h3>' . $this->
getLanguageService()->getLL(
'action_t1_listOfUsers',
true) .
'</h3><div>' . implode(
'<br />', $userList) .
'</div>';
421 if (!empty($realName)) {
422 $username .=
' (' . $realName .
')';
425 $href = $this->moduleUrl .
'&SET[function]=sys_action.TYPO3\\CMS\\SysAction\\ActionTask&show=' . (int)$sysActionUid .
'&be_users_uid=' . (
int)$userId;
426 $link =
'<a href="' . htmlspecialchars($href) .
'">' . htmlspecialchars($username) .
'</a>';
429 <a href="' . htmlspecialchars(($href .
'&delete=1')) .
'" class="t3js-confirm-trigger" data-title="' . $this->
getLanguageService()->getLL(
'lDelete_warning_title',
true) .
'" data-message="' . $this->
getLanguageService()->getLL(
'lDelete_warning',
true) .
'">'
430 . $this->iconFactory->getIcon(
'actions-edit-delete',
Icon::SIZE_SMALL)->render() .
445 $vars[
'db_mountpoints'] = $this->
fixDbMount($vars[
'db_mountpoints']);
447 $vars[
'usergroup'] = $this->
fixUserGroup($vars[
'usergroup'], $record);
449 $vars[
'password'] = trim($vars[
'password']);
451 if ($vars[
'password'] !==
'' && strpos(
$GLOBALS[
'TCA'][
'be_users'][
'columns'][
'password'][
'config'][
'eval'],
'md5') !==
false) {
452 $vars[
'password'] = md5($vars[
'password']);
456 if ($key ===
'NEW') {
458 if (is_array($beRec)) {
460 $data[
'be_users'][$key] = $beRec;
461 $data[
'be_users'][$key][
'username'] = $this->
fixUsername($vars[
'username'], $record[
't1_userprefix']);
462 $data[
'be_users'][$key][
'password'] = $vars[
'password'];
463 $data[
'be_users'][$key][
'realName'] = $vars[
'realName'];
464 $data[
'be_users'][$key][
'email'] = $vars[
'email'];
465 $data[
'be_users'][$key][
'disable'] = (int)$vars[
'disable'];
466 $data[
'be_users'][$key][
'admin'] = 0;
467 $data[
'be_users'][$key][
'usergroup'] = $vars[
'usergroup'];
468 $data[
'be_users'][$key][
'db_mountpoints'] = $vars[
'db_mountpoints'];
469 $data[
'be_users'][$key][
'createdByAction'] = $record[
'uid'];
474 if (is_array($beRec) && $beRec[
'cruser_id'] == $this->
getBackendUser()->user[
'uid']) {
476 $data[
'be_users'][$key][
'username'] = $this->
fixUsername($vars[
'username'], $record[
't1_userprefix']);
477 if ($vars[
'password'] !==
'') {
478 $data[
'be_users'][$key][
'password'] = $vars[
'password'];
480 $data[
'be_users'][$key][
'realName'] = $vars[
'realName'];
481 $data[
'be_users'][$key][
'email'] = $vars[
'email'];
482 $data[
'be_users'][$key][
'disable'] = (int)$vars[
'disable'];
483 $data[
'be_users'][$key][
'admin'] = 0;
484 $data[
'be_users'][$key][
'usergroup'] = $vars[
'usergroup'];
485 $data[
'be_users'][$key][
'db_mountpoints'] = $vars[
'db_mountpoints'];
490 if (is_array($data)) {
492 $tce->stripslashes_values = 0;
495 $tce->process_datamap();
496 $newUserId = (int)$tce->substNEWwithIDs[
'NEW'];
502 $newUserId = (int)$key;
518 $prefix = trim($prefix);
519 if (substr($username, 0, strlen($prefix)) === $prefix) {
520 $username = substr($username, strlen($prefix));
522 return $prefix . $username;
534 if (is_array($appliedUsergroups)) {
535 $cleanGroupList = array();
537 $allowedUsergroups = array_flip(explode(
',', $actionRecord[
't1_allowed_groups']));
539 foreach ($appliedUsergroups as $group) {
540 if (isset($allowedUsergroups[$group])) {
541 $cleanGroupList[] = $group;
544 $appliedUsergroups = $cleanGroupList;
546 return $appliedUsergroups;
558 if (!empty($appliedDbMounts) && !$this->
getBackendUser()->isAdmin()) {
559 $cleanDbMountList = array();
562 foreach ($dbMounts as $dbMount) {
563 $uid = (int)substr($dbMount, strrpos($dbMount,
'_') + 1);
567 $cleanDbMountList[] =
'pages_' . $uid;
571 $appliedDbMounts = implode(
',', $cleanDbMountList);
573 return $appliedDbMounts;
585 $dbMounts = array_flip(explode(
',', trim($this->
getBackendUser()->dataLists[
'webmount_list'],
',')));
587 foreach ($rootline as $page) {
588 if (isset($dbMounts[$page[
'uid']]) && !$access) {
617 $path =
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'userHomePath'];
635 if (empty($record[
't1_allowed_groups'])) {
638 $content .=
'<option value=""></option>';
640 foreach ($grList as $group) {
642 if (is_array($checkGroup)) {
643 $selected =
GeneralUtility::inList($vars[
'usergroup'], $checkGroup[
'uid']) ?
' selected="selected" ' :
'';
644 $content .=
'<option ' . $selected .
'value="' . $checkGroup[
'uid'] .
'">' . htmlspecialchars($checkGroup[
'title']) .
'</option>';
658 $link = BackendUtility::getModuleUrl(
661 'edit[' . $record[
't3_tables'] .
'][' . (
int)$record[
't3_listPid'] .
']' =>
'new',
662 'returnUrl' => $this->moduleUrl
667 \TYPO3\CMS\Core\Utility\HttpUtility::redirect($link);
679 $actionList = array();
681 $dbAnalysis->setFetchAllFields(
true);
682 $dbAnalysis->start($record[
't4_recordsToEdit'],
'*');
683 $dbAnalysis->getFromDB();
685 foreach ($dbAnalysis->itemArray as $el) {
691 if (isset($record[
'crdate'])) {
694 $link = BackendUtility::getModuleUrl(
697 'edit[' . $el[
'table'] .
'][' . $el[
'id'] .
']' =>
'edit',
698 'returnUrl' => $this->moduleUrl
703 $actionList[$el[
'id']] = array(
706 'descriptionHtml' => $description,
708 'icon' =>
'<span title="' . htmlspecialchars($path) .
'">' . $this->iconFactory->getIconForRecord($el[
'table'], $dbAnalysis->results[$el[
'table']][$el[
'id']],
Icon::SIZE_SMALL)->render() .
'</span>'
712 $content .= $this->taskObject->renderListMenu($actionList);
725 if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded(
'lowlevel')) {
726 $sql_query = unserialize($record[
't2_data']);
727 if (!is_array($sql_query) || is_array($sql_query) && strtoupper(substr(trim($sql_query[
'qSelect']), 0, 6)) ===
'SELECT') {
730 $fullsearch->formW = 40;
731 $fullsearch->noDownloadB = 1;
732 $type = $sql_query[
'qC'][
'search_query_makeQuery'];
733 if ($sql_query[
'qC'][
'labels_noprefix'] ===
'on') {
734 $GLOBALS[
'SOBE']->MOD_SETTINGS[
'labels_noprefix'] =
'on';
736 $sqlQuery = $sql_query[
'qSelect'];
737 $queryIsEmpty =
false;
741 $fullsearch->formW = 48;
743 $GLOBALS[
'SOBE']->MOD_SETTINGS[
'search_result_labels'] = 1;
744 $GLOBALS[
'SOBE']->MOD_SETTINGS[
'queryFields'] = $sql_query[
'qC'][
'queryFields'];
745 $cP = $fullsearch->getQueryResultCode($type, $res, $sql_query[
'qC'][
'queryTable']);
746 $actionContent = $cP[
'content'];
748 if ($type ===
'csv' || $type ===
'xml') {
756 $queryIsEmpty =
true;
758 $content .=
'<br />' . $flashMessage->render();
762 if (!$queryIsEmpty) {
763 $actionContent .=
'<hr /> ' . $fullsearch->tableWrap($sql_query[
'qSelect']);
765 $actionContent .=
'<br /><a title="' . $this->
getLanguageService()->getLL(
'action_editQuery') .
'" href="'
766 . htmlspecialchars(BackendUtility::getModuleUrl(
'system_dbint')
767 .
'&id=' .
'&SET[function]=search' .
'&SET[search]=query'
768 .
'&storeControl[STORE]=-' . $record[
'uid'] .
'&storeControl[LOAD]=1')
770 . $this->iconFactory->getIcon(
'actions-document-info',
Icon::SIZE_SMALL)->render()
772 :
'action_editQuery')) .
'</a><br /><br />';
774 $content .=
'<h2>' . $this->
getLanguageService()->getLL(
'action_t2_result',
true) .
'</h2><div>' . $actionContent .
'</div>';
778 $content .=
'<br />' . $flashMessage->render();
783 $content .=
'<br />' . $flashMessage->render();
797 $this->
id = (int)$record[
't3_listPid'];
798 $this->table = $record[
't3_tables'];
799 if ($this->
id == 0) {
801 $content .=
'<br />' . $flashMessage->render();
806 $access = is_array($this->pageinfo) ? 1 : 0;
812 $dblist->backPath =
$GLOBALS[
'BACK_PATH'];
813 $dblist->calcPerms = $this->
getBackendUser()->calcPerms($this->pageinfo);
814 $dblist->thumbs = $this->
getBackendUser()->uc[
'thumbnailsByDefault'];
815 $dblist->returnUrl = $this->taskObject->returnUrl;
816 $dblist->allFields = 1;
817 $dblist->localizationView = 1;
818 $dblist->showClipboard = 0;
819 $dblist->disableSingleTableView = 1;
820 $dblist->pageRow = $this->pageinfo;
822 $dblist->MOD_MENU = array(
'bigControlPanel' =>
'',
'clipBoard' =>
'',
'localization' =>
'');
823 $dblist->modTSconfig = $this->taskObject->modTSconfig;
824 $dblist->dontShowClipControlPanels = (!$this->taskObject->MOD_SETTINGS[
'bigControlPanel'] && $dblist->clipObj->current ==
'normal' && !$this->modTSconfig[
'properties'][
'showClipControlPanelsDespiteOfCMlayers']);
826 $this->pointer = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange(
GeneralUtility::_GP(
'pointer'), 0, 100000);
827 $dblist->start($this->
id, $this->table, $this->pointer, $this->taskObject->search_field, $this->taskObject->search_levels, $this->taskObject->showLimit);
828 $dblist->setDispFields();
830 $dblist->generateList();
832 $this->taskObject->getModuleTemplate()->addJavaScriptCode(
833 'ActionTaskInlineJavascript',
836 function jumpExt(URL,anchor) {
837 var anc = anchor?anchor:"";
838 window.location.href = URL+(T3_THIS_LOCATION?"&returnUrl="+T3_THIS_LOCATION:"")+anc;
841 function jumpSelf(URL) {
842 window.location.href = URL+(T3_RETURN_URL?"&returnUrl="+T3_RETURN_URL:"");
846 function setHighlight(id) {
847 top.fsMod.recentIds["web"]=id;
848 top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_"+top.fsMod.currentBank; // For highlighting
850 if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
851 top.content.nav_frame.refresh_nav();
855 ' . $dblist->CBfunctions() .
'
856 function editRecords(table,idList,addParams,CBflag) {
857 window.location.href="' . BackendUtility::getModuleUrl(
'record_edit', array(
'returnUrl' =>
GeneralUtility::getIndpEnv(
'REQUEST_URI'))) .
'&edit["+table+"]["+idList+"]=edit"+addParams;
859 function editList(table,idList) {
862 // Checking how many is checked, how many is not
864 var pos = idList.indexOf(",");
866 if (cbValue(table+"|"+idList.substr(pointer,pos-pointer))) {
867 list+=idList.substr(pointer,pos-pointer)+",";
870 pos = idList.indexOf(",",pointer);
872 if (cbValue(table+"|"+idList.substr(pointer))) {
873 list+=idList.substr(pointer)+",";
876 return list ? list : idList;
880 if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int)$this->
id .
';
884 $this->taskObject->getModuleTemplate()->getPageRenderer()->loadRequireJsModule(
'TYPO3/CMS/Backend/ClickMenu');
886 $content .=
'<form action="' . htmlspecialchars($dblist->listURL()) .
'" method="post" name="dblistForm">' . $dblist->HTMLcode .
'<input type="hidden" name="cmd_table" /><input type="hidden" name="cmd" />
889 if ($dblist->HTMLcode) {
891 if ($dblist->table) {
892 $tmpBackpath =
$GLOBALS[
'BACK_PATH'];
894 $content .= $dblist->fieldSelectBox($dblist->table);
895 $GLOBALS[
'BACK_PATH'] = $tmpBackpath;
901 $content .= $flashMessage->render();