コード例 #1
1
    /**
     * Send an email notification to users in workspace
     *
     * @param array $stat Workspace access array (from t3lib_userauthgroup::checkWorkspace())
     * @param integer $stageId New Stage number: 0 = editing, 1= just ready for review, 10 = ready for publication, -1 = rejected!
     * @param string $table Table name of element (or list of element names if $id is zero)
     * @param integer $id Record uid of element (if zero, then $table is used as reference to element(s) alone)
     * @param string $comment User comment sent along with action
     * @param t3lib_TCEmain $tcemainObj TCEmain object
     * @param string $notificationAlternativeRecipients Comma separated list of recipients to notificate instead of be_users selected by sys_workspace, list is generated by workspace extension module
     * @return void
     */
    protected function notifyStageChange(array $stat, $stageId, $table, $id, $comment, t3lib_TCEmain $tcemainObj, $notificationAlternativeRecipients = FALSE)
    {
        $workspaceRec = t3lib_BEfunc::getRecord('sys_workspace', $stat['uid']);
        // So, if $id is not set, then $table is taken to be the complete element name!
        $elementName = $id ? $table . ':' . $id : $table;
        if (is_array($workspaceRec)) {
            // Get the new stage title from workspaces library, if workspaces extension is installed
            if (t3lib_extMgm::isLoaded('workspaces')) {
                $stageService = t3lib_div::makeInstance('Tx_Workspaces_Service_Stages');
                $newStage = $stageService->getStageTitle((int) $stageId);
            } else {
                // TODO: CONSTANTS SHOULD BE USED - tx_service_workspace_workspaces
                // TODO: use localized labels
                // Compile label:
                switch ((int) $stageId) {
                    case 1:
                        $newStage = 'Ready for review';
                        break;
                    case 10:
                        $newStage = 'Ready for publishing';
                        break;
                    case -1:
                        $newStage = 'Element was rejected!';
                        break;
                    case 0:
                        $newStage = 'Rejected element was noticed and edited';
                        break;
                    default:
                        $newStage = 'Unknown state change!?';
                        break;
                }
            }
            if ($notificationAlternativeRecipients == false) {
                // Compile list of recipients:
                $emails = array();
                switch ((int) $stat['stagechg_notification']) {
                    case 1:
                        switch ((int) $stageId) {
                            case 1:
                                $emails = $this->getEmailsForStageChangeNotification($workspaceRec['reviewers']);
                                break;
                            case 10:
                                $emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers'], TRUE);
                                break;
                            case -1:
                                #								$emails = $this->getEmailsForStageChangeNotification($workspaceRec['reviewers']);
                                #								$emails = array_merge($emails,$this->getEmailsForStageChangeNotification($workspaceRec['members']));
                                // List of elements to reject:
                                $allElements = explode(',', $elementName);
                                // Traverse them, and find the history of each
                                foreach ($allElements as $elRef) {
                                    list($eTable, $eUid) = explode(':', $elRef);
                                    $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('log_data,tstamp,userid', 'sys_log', 'action=6 and details_nr=30
											AND tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($eTable, 'sys_log') . '
											AND recuid=' . intval($eUid), '', 'uid DESC');
                                    // Find all implicated since the last stage-raise from editing to review:
                                    foreach ($rows as $dat) {
                                        $data = unserialize($dat['log_data']);
                                        $emails = t3lib_div::array_merge($emails, $this->getEmailsForStageChangeNotification($dat['userid'], TRUE));
                                        if ($data['stage'] == 1) {
                                            break;
                                        }
                                    }
                                }
                                break;
                            case 0:
                                $emails = $this->getEmailsForStageChangeNotification($workspaceRec['members']);
                                break;
                            default:
                                $emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers'], TRUE);
                                break;
                        }
                        break;
                    case 10:
                        $emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers'], TRUE);
                        $emails = t3lib_div::array_merge($emails, $this->getEmailsForStageChangeNotification($workspaceRec['reviewers']));
                        $emails = t3lib_div::array_merge($emails, $this->getEmailsForStageChangeNotification($workspaceRec['members']));
                        break;
                }
            } else {
                $emails = array();
                foreach ($notificationAlternativeRecipients as $emailAddress) {
                    $emails[] = array('email' => $emailAddress);
                }
            }
            // prepare and then send the emails
            if (count($emails)) {
                // Path to record is found:
                list($elementTable, $elementUid) = explode(':', $elementName);
                $elementUid = intval($elementUid);
                $elementRecord = t3lib_BEfunc::getRecord($elementTable, $elementUid);
                $recordTitle = t3lib_BEfunc::getRecordTitle($elementTable, $elementRecord);
                if ($elementTable == 'pages') {
                    $pageUid = $elementUid;
                } else {
                    t3lib_BEfunc::fixVersioningPid($elementTable, $elementRecord);
                    $pageUid = $elementUid = $elementRecord['pid'];
                }
                // fetch the TSconfig settings for the email
                // old way, options are TCEMAIN.notificationEmail_body/subject
                $TCEmainTSConfig = $tcemainObj->getTCEMAIN_TSconfig($pageUid);
                // these options are deprecated since TYPO3 4.5, but are still
                // used in order to provide backwards compatibility
                $emailMessage = trim($TCEmainTSConfig['notificationEmail_body']);
                $emailSubject = trim($TCEmainTSConfig['notificationEmail_subject']);
                // new way, options are
                // pageTSconfig: tx_version.workspaces.stageNotificationEmail.subject
                // userTSconfig: page.tx_version.workspaces.stageNotificationEmail.subject
                $pageTsConfig = t3lib_BEfunc::getPagesTSconfig($pageUid);
                $emailConfig = $pageTsConfig['tx_version.']['workspaces.']['stageNotificationEmail.'];
                $markers = array('###RECORD_TITLE###' => $recordTitle, '###RECORD_PATH###' => t3lib_BEfunc::getRecordPath($elementUid, '', 20), '###SITE_NAME###' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'], '###SITE_URL###' => t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir, '###WORKSPACE_TITLE###' => $workspaceRec['title'], '###WORKSPACE_UID###' => $workspaceRec['uid'], '###ELEMENT_NAME###' => $elementName, '###NEXT_STAGE###' => $newStage, '###COMMENT###' => $comment, '###USER_REALNAME###' => $tcemainObj->BE_USER->user['realName'], '###USER_USERNAME###' => $tcemainObj->BE_USER->user['username']);
                // sending the emails the old way with sprintf(),
                // because it was set explicitly in TSconfig
                if ($emailMessage && $emailSubject) {
                    t3lib_div::deprecationLog('This TYPO3 installation uses Workspaces staging notification by setting the TSconfig options "TCEMAIN.notificationEmail_subject" / "TCEMAIN.notificationEmail_body". Please use the more flexible marker-based options tx_version.workspaces.stageNotificationEmail.message / tx_version.workspaces.stageNotificationEmail.subject');
                    $emailSubject = sprintf($emailSubject, $elementName);
                    $emailMessage = sprintf($emailMessage, $markers['###SITE_NAME###'], $markers['###SITE_URL###'], $markers['###WORKSPACE_TITLE###'], $markers['###WORKSPACE_UID###'], $markers['###ELEMENT_NAME###'], $markers['###NEXT_STAGE###'], $markers['###COMMENT###'], $markers['###USER_REALNAME###'], $markers['###USER_USERNAME###'], $markers['###RECORD_PATH###'], $markers['###RECORD_TITLE###']);
                    // filter out double email addresses
                    $emailRecipients = array();
                    foreach ($emails as $recip) {
                        $emailRecipients[$recip['email']] = $recip['email'];
                    }
                    $emailRecipients = implode(',', $emailRecipients);
                    // Send one email to everybody
                    t3lib_div::plainMailEncoded($emailRecipients, $emailSubject, $emailMessage);
                } else {
                    // send an email to each individual user, to ensure the
                    // multilanguage version of the email
                    $emailHeaders = $emailConfig['additionalHeaders'];
                    $emailRecipients = array();
                    // an array of language objects that are needed
                    // for emails with different languages
                    $languageObjects = array($GLOBALS['LANG']->lang => $GLOBALS['LANG']);
                    // loop through each recipient and send the email
                    foreach ($emails as $recipientData) {
                        // don't send an email twice
                        if (isset($emailRecipients[$recipientData['email']])) {
                            continue;
                        }
                        $emailSubject = $emailConfig['subject'];
                        $emailMessage = $emailConfig['message'];
                        $emailRecipients[$recipientData['email']] = $recipientData['email'];
                        // check if the email needs to be localized
                        // in the users' language
                        if (t3lib_div::isFirstPartOfStr($emailSubject, 'LLL:') || t3lib_div::isFirstPartOfStr($emailMessage, 'LLL:')) {
                            $recipientLanguage = $recipientData['lang'] ? $recipientData['lang'] : 'default';
                            if (!isset($languageObjects[$recipientLanguage])) {
                                // a LANG object in this language hasn't been
                                // instantiated yet, so this is done here
                                /** @var $languageObject language */
                                $languageObject = t3lib_div::makeInstance('language');
                                $languageObject->init($recipientLanguage);
                                $languageObjects[$recipientLanguage] = $languageObject;
                            } else {
                                $languageObject = $languageObjects[$recipientLanguage];
                            }
                            if (t3lib_div::isFirstPartOfStr($emailSubject, 'LLL:')) {
                                $emailSubject = $languageObject->sL($emailSubject);
                            }
                            if (t3lib_div::isFirstPartOfStr($emailMessage, 'LLL:')) {
                                $emailMessage = $languageObject->sL($emailMessage);
                            }
                        }
                        $emailSubject = t3lib_parseHtml::substituteMarkerArray($emailSubject, $markers, '', TRUE, TRUE);
                        $emailMessage = t3lib_parseHtml::substituteMarkerArray($emailMessage, $markers, '', TRUE, TRUE);
                        // Send an email to the recipient
                        t3lib_div::plainMailEncoded($recipientData['email'], $emailSubject, $emailMessage, $emailHeaders);
                    }
                    $emailRecipients = implode(',', $emailRecipients);
                }
                $tcemainObj->newlog2('Notification email for stage change was sent to "' . $emailRecipients . '"', $table, $id);
            }
        }
    }
コード例 #2
0
 /**
  * The main function in the class
  *
  * @return	string		HTML content
  */
 function main()
 {
     $output = 'Enter [table]:[uid]:[fieldlist (optional)] <input name="table_uid" value="' . htmlspecialchars(t3lib_div::_POST('table_uid')) . '" />';
     $output .= '<input type="submit" name="_" value="REFRESH" /><br/>';
     // Show record:
     if (t3lib_div::_POST('table_uid')) {
         list($table, $uid, $fieldName) = t3lib_div::trimExplode(':', t3lib_div::_POST('table_uid'), 1);
         if ($GLOBALS['TCA'][$table]) {
             $rec = t3lib_BEfunc::getRecordRaw($table, 'uid=' . intval($uid), $fieldName ? $fieldName : '*');
             if (count($rec)) {
                 $pidOfRecord = $rec['pid'];
                 $output .= '<input type="checkbox" name="show_path" value="1"' . (t3lib_div::_POST('show_path') ? ' checked="checked"' : '') . '/> Show path and rootline of record<br/>';
                 if (t3lib_div::_POST('show_path')) {
                     $output .= '<br/>Path of PID ' . $pidOfRecord . ': <em>' . t3lib_BEfunc::getRecordPath($pidOfRecord, '', 30) . '</em><br/>';
                     $output .= 'RL:' . Tx_Extdeveval_Compatibility::viewArray(t3lib_BEfunc::BEgetRootLine($pidOfRecord)) . '<br/>';
                     $output .= 'FLAGS:' . ($rec['deleted'] ? ' <b>DELETED</b>' : '') . ($rec['pid'] == -1 ? ' <b>OFFLINE VERSION of ' . $rec['t3ver_oid'] . '</b>' : '') . '<br/><hr/>';
                 }
                 if (t3lib_div::_POST('_EDIT')) {
                     $output .= '<hr/>Edit:<br/><br/>';
                     $output .= '<input type="submit" name="_SAVE" value="SAVE" /><br/>';
                     foreach ($rec as $field => $value) {
                         $output .= '<b>' . htmlspecialchars($field) . ':</b><br/>';
                         if (count(explode(chr(10), $value)) > 1) {
                             $output .= '<textarea name="record[' . $table . '][' . $uid . '][' . $field . ']" cols="100" rows="10">' . t3lib_div::formatForTextarea($value) . '</textarea><br/>';
                         } else {
                             $output .= '<input name="record[' . $table . '][' . $uid . '][' . $field . ']" value="' . htmlspecialchars($value) . '" size="100" /><br/>';
                         }
                     }
                 } elseif (t3lib_div::_POST('_SAVE')) {
                     $incomingData = t3lib_div::_POST('record');
                     $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . intval($uid), $incomingData[$table][$uid]);
                     $output .= '<br/>Updated ' . $table . ':' . $uid . '...';
                     $this->updateRefIndex($table, $uid);
                 } else {
                     if (t3lib_div::_POST('_DELETE')) {
                         $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, 'uid=' . intval($uid));
                         $output .= '<br/>Deleted ' . $table . ':' . $uid . '...';
                         $this->updateRefIndex($table, $uid);
                     } else {
                         $output .= '<input type="submit" name="_EDIT" value="EDIT" />';
                         $output .= '<input type="submit" name="_DELETE" value="DELETE" onclick="return confirm(\'Are you sure you wish to delete?\');" />';
                         $output .= '<br/>' . md5(implode($rec));
                         $output .= Tx_Extdeveval_Compatibility::viewArray($rec);
                     }
                 }
             } else {
                 $output .= 'No record existed!';
             }
         }
     }
     return $output;
 }
コード例 #3
0
    /**
     * Main Task center module
     *
     * @return	string		HTML content.
     */
    function main()
    {
        if ($id = t3lib_div::_GP('display')) {
            return $this->urlInIframe($this->backPath . t3lib_extMgm::extRelPath('impexp') . 'app/index.php?tx_impexp[action]=export&preset[load]=1&preset[select]=' . $id, 1);
        } else {
            // Thumbnail folder and files:
            $tempDir = $this->userTempFolder();
            if ($tempDir) {
                $thumbnails = t3lib_div::getFilesInDir($tempDir, 'png,gif,jpg', 1);
            }
            $clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
            $usernames = t3lib_BEfunc::getUserNames();
            // Create preset links:
            $presets = $this->getPresets();
            $opt = array();
            $opt[] = '
			<tr class="bgColor5 tableheader">
				<td>Icon:</td>
				<td>Preset Title:</td>
				<td>Public</td>
				<td>Owner:</td>
				<td>Page:</td>
				<td>Path:</td>
				<td>Meta data:</td>
			</tr>';
            if (is_array($presets)) {
                foreach ($presets as $presetCfg) {
                    $configuration = unserialize($presetCfg['preset_data']);
                    $thumbnailFile = $thumbnails[$configuration['meta']['thumbnail']];
                    $title = strlen($presetCfg['title']) ? $presetCfg['title'] : '[' . $presetCfg['uid'] . ']';
                    $opt[] = '
					<tr class="bgColor4">
						<td>' . ($thumbnailFile ? '<img src="' . $this->backPath . '../' . substr($tempDir, strlen(PATH_site)) . basename($thumbnailFile) . '" hspace="2" width="70" style="border: solid black 1px;" alt="" /><br />' : '&nbsp;') . '</td>
						<td nowrap="nowrap"><a href="index.php?SET[function]=tx_impexp&display=' . $presetCfg['uid'] . '">' . htmlspecialchars(t3lib_div::fixed_lgd_cs($title, 30)) . '</a>&nbsp;</td>
						<td>' . ($presetCfg['public'] ? 'Yes' : '&nbsp;') . '</td>
						<td>' . ($presetCfg['user_uid'] === $GLOBALS['BE_USER']->user['uid'] ? 'Own' : '[' . $usernames[$presetCfg['user_uid']]['username'] . ']') . '</td>
						<td>' . ($configuration['pagetree']['id'] ? $configuration['pagetree']['id'] : '&nbsp;') . '</td>
						<td>' . htmlspecialchars($configuration['pagetree']['id'] ? t3lib_BEfunc::getRecordPath($configuration['pagetree']['id'], $clause, 20) : '[Single Records]') . '</td>
						<td>
							<strong>' . htmlspecialchars($configuration['meta']['title']) . '</strong><br />' . htmlspecialchars($configuration['meta']['description']) . ($configuration['meta']['notes'] ? '<br /><br /><strong>Notes:</strong> <em>' . htmlspecialchars($configuration['meta']['notes']) . '</em>' : '') . '
						</td>
					</tr>';
                }
                $content = '<table border="0" cellpadding="0" cellspacing="1" class="lrPadding">' . implode('', $opt) . '</table>';
            }
        }
        // Output:
        $theOutput .= $this->pObj->doc->spacer(5);
        $theOutput .= $this->pObj->doc->section('Export presets', $content, 0, 1);
        return $theOutput;
    }
コード例 #4
0
ファイル: index.php プロジェクト: danilovq/l10nmgr
    /**
     * [Describe function...]
     *
     * @param   [type]    $table: ...
     * @param   [type]    $uid: ...
     * @return  [type]    ...
     */
    function moduleContent($table, $uid)
    {
        if ($GLOBALS['TCA'][$table]) {
            $this->l10nMgrTools = GeneralUtility::makeInstance(\Localizationteam\L10nmgr\Model\Tools\Tools::class);
            $this->l10nMgrTools->verbose = false;
            // Otherwise it will show records which has fields but none editable.
            $output = '';
            if (GeneralUtility::_POST('_updateIndex')) {
                $output .= $this->l10nMgrTools->updateIndexForRecord($table, $uid);
                t3lib_BEfunc::setUpdateSignal('updatePageTree');
            }
            $inputRecord = t3lib_BEfunc::getRecord($table, $uid, 'pid');
            $pathShown = t3lib_BEfunc::getRecordPath($table == 'pages' ? $uid : $inputRecord['pid'], '', 20);
            $this->sysLanguages = $this->l10nMgrTools->t8Tools->getSystemLanguages($table == 'pages' ? $uid : $inputRecord['pid']);
            $languageListArray = explode(',', $GLOBALS['BE_USER']->groupData['allowed_languages'] ? $GLOBALS['BE_USER']->groupData['allowed_languages'] : implode(',', array_keys($this->sysLanguages)));
            $limitLanguageList = trim(GeneralUtility::_GP('languageList'));
            foreach ($languageListArray as $kkk => $val) {
                if ($limitLanguageList && !GeneralUtility::inList($limitLanguageList, $val)) {
                    unset($languageListArray[$kkk]);
                }
            }
            if (!count($languageListArray)) {
                $languageListArray[] = 0;
            }
            $languageList = implode(',', $languageListArray);
            // Fetch translation index records:
            if ($table != 'pages') {
                $records = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tx_l10nmgr_index', 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($table, 'tx_l10nmgr_index') . ' AND recuid=' . (int) $uid . ' AND translation_lang IN (' . $GLOBALS['TYPO3_DB']->cleanIntList($languageList) . ')' . ' AND workspace=' . (int) $GLOBALS['BE_USER']->workspace . ' AND (flag_new>0 OR flag_update>0 OR flag_noChange>0 OR flag_unknown>0)', '', 'translation_lang, tablename, recuid');
            } else {
                $records = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tx_l10nmgr_index', 'recpid=' . (int) $uid . ' AND translation_lang IN (' . $GLOBALS['TYPO3_DB']->cleanIntList($languageList) . ')' . ' AND workspace=' . (int) $GLOBALS['BE_USER']->workspace . ' AND (flag_new>0 OR flag_update>0 OR flag_noChange>0 OR flag_unknown>0)', '', 'translation_lang, tablename, recuid');
            }
            #	\TYPO3\CMS\Core\Utility\GeneralUtility::debugRows($records,'Index entries for '.$table.':'.$uid);
            $tRows = array();
            $tRows[] = '<tr class="bgColor2 tableheader">
				<td colspan="2">Base element:</td>
				<td colspan="2">Translation:</td>
				<td>Action:</td>
				<td><img src="../flags_new.png" width="10" height="16" alt="New" title="New" /></td>
				<td><img src="../flags_unknown.png" width="10" height="16" alt="Unknown" title="Unknown" /></td>
				<td><img src="../flags_update.png" width="10" height="16" alt="Update" title="Update" /></td>
				<td><img src="../flags_ok.png" width="10" height="16" alt="OK" title="OK" /></td>
				<td>Diff:</td>
			</tr>';
            //\TYPO3\CMS\Core\Utility\GeneralUtility::debugRows($records);
            foreach ($records as $rec) {
                if ($rec['tablename'] == 'pages') {
                    $tRows[] = $this->makeTableRow($rec);
                }
            }
            if (count($tRows) > 1) {
                $tRows[] = '<tr><td colspan="8">&nbsp;</td></tr>';
            }
            foreach ($records as $rec) {
                if ($rec['tablename'] != 'pages') {
                    $tRows[] = $this->makeTableRow($rec);
                }
            }
            $output .= 'Path: <i>' . $pathShown . '</i><br><table border="0" cellpadding="1" cellspacing="1">' . implode('', $tRows) . '</table>';
            // Updating index
            if ($GLOBALS['BE_USER']->isAdmin()) {
                $output .= '<br><br>Functions for "' . $table . ':' . $uid . '":<br/>
					<input type="submit" name="_updateIndex" value="Update Index" /><br>
					<input type="submit" name="_" value="Flush Translations" onclick="' . htmlspecialchars('document.location="../cm3/index.php?table=' . htmlspecialchars($table) . '&id=' . (int) $uid . '&cmd=flushTranslations";return false;') . '"/><br>
					<input type="submit" name="_" value="Create priority" onclick="' . htmlspecialchars('document.location="' . $GLOBALS['BACK_PATH'] . 'alt_doc.php?returnUrl=' . rawurlencode('db_list.php?id=0&table=tx_l10nmgr_priorities') . '&edit[tx_l10nmgr_priorities][0]=new&defVals[tx_l10nmgr_priorities][element]=' . rawurlencode($table . '_' . $uid) . '";return false;') . '"/><br>
					';
            }
            return $output;
        }
    }
コード例 #5
0
 /**
  * Returns a record icon with title and edit link
  *
  * @param	string		Table name (tt_content,...)
  * @param	array		Record array
  * @param	boolean		For pages records the rootline will be rendered
  * @return	string		Rendered icon
  */
 function getRecordInfoEditLink($refTable, $row, $showRootline = FALSE)
 {
     global $BACK_PATH, $LANG, $TCA;
     // Create record title or rootline for pages if option is selected
     if ($refTable === 'pages' and $showRootline) {
         $elementTitle = t3lib_BEfunc::getRecordPath($row['uid'], '1=1', 0);
         $elementTitle = t3lib_div::fixed_lgd_cs($elementTitle, -$BE_USER->uc['titleLen']);
     } else {
         $elementTitle = t3lib_BEfunc::getRecordTitle($refTable, $row, 1);
     }
     // Create icon for record
     if ($refTable === 'tx_dam') {
         $elementIcon = tx_dam_guiFunc::icon_getFileTypeImgTag($row, 'class="c-recicon" align="top"');
     } else {
         $iconAltText = t3lib_BEfunc::getRecordIconAltText($row, $refTable);
         // Prepend table description for non-pages tables
         if (!($refTable === 'pages')) {
             $iconAltText = htmlspecialchars($LANG->sl($TCA[$refTable]['ctrl']['title']) . ': ') . $iconAltText;
         }
         $elementIcon = t3lib_iconworks::getIconImage($refTable, $row, $BACK_PATH, 'class="c-recicon" align="top" title="' . $iconAltText . '"');
     }
     // Return item with edit link
     return tx_dam_SCbase::wrapLink_edit($elementIcon . $elementTitle, $refTable, $row['uid']);
 }
コード例 #6
0
ファイル: index.php プロジェクト: NaveedWebdeveloper/Test
    /**
     * Based on the content of ->ext_non_readAccessPageArray (see returnWebmounts()) it generates visually formatted information about these non-readable mounts.
     *
     * @return	string		HTML content showing which DB-mounts were not accessible for the user
     */
    function ext_non_readAccessPages()
    {
        $lines = array();
        foreach ($this->ext_non_readAccessPageArray as $pA) {
            if ($pA) {
                $lines[] = t3lib_BEfunc::getRecordPath($pA['uid'], '', 15);
            }
        }
        if (count($lines)) {
            return '<table bgcolor="red" border="0" cellpadding="0" cellspacing="0">
				<tr>
					<td align="center"><font color="white"><strong>' . $GLOBALS['LANG']->getLL('noReadAccess', true) . '</strong></font></td>
				</tr>
				<tr>
					<td>' . implode('</td></tr><tr><td>', $lines) . '</td>
				</tr>
			</table>';
        }
    }
コード例 #7
0
 /**
  * Returns the page title path of a PID value. Results are cached internally
  *
  * @param	integer		Record PID to check
  * @return	string		The path for the input PID
  */
 function getRecordPath($pid)
 {
     if (!isset($this->cache_getRecordPath[$pid])) {
         $clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
         $this->cache_getRecordPath[$pid] = (string) t3lib_BEfunc::getRecordPath($pid, $clause, 20);
     }
     return $this->cache_getRecordPath[$pid];
 }
コード例 #8
0
 /**
  * Generates and returns the content of the module
  *
  * @return string HTML to display
  */
 protected function moduleContent()
 {
     $content = '';
     $content .= $this->doc->header($GLOBALS['LANG']->getLL('general.title'));
     // Get the available configurations
     $l10nConfigurations = $this->getAllConfigurations();
     // No configurations, issue a simple message
     if (count($l10nConfigurations) == 0) {
         $content .= $this->doc->section('', nl2br($GLOBALS['LANG']->getLL('general.no_date')));
         // List all configurations
     } else {
         $content .= $this->doc->section('', nl2br($GLOBALS['LANG']->getLL('general.description.message')));
         $content .= $this->doc->section($GLOBALS['LANG']->getLL('general.list.configuration.title'), '');
         $content .= '<table class="typo3-dblist" border="0" cellpadding="0" cellspacing="0">';
         // Assemble the header row
         $content .= '<thead>';
         $content .= '<tr class="t3-row-header">';
         $content .= '<td>' . $GLOBALS['LANG']->getLL('general.list.headline.info.title') . '</td>';
         $content .= '<td>' . $GLOBALS['LANG']->getLL('general.list.headline.title.title') . '</td>';
         $content .= '<td>' . $GLOBALS['LANG']->getLL('general.list.headline.path.title') . '</td>';
         $content .= '<td>' . $GLOBALS['LANG']->getLL('general.list.headline.depth.title') . '</td>';
         $content .= '<td>' . $GLOBALS['LANG']->getLL('general.list.headline.tables.title') . '</td>';
         $content .= '<td>' . $GLOBALS['LANG']->getLL('general.list.headline.exclude.title') . '</td>';
         $content .= '<td>' . $GLOBALS['LANG']->getLL('general.list.headline.include.title') . '</td>';
         $content .= '<td>' . $GLOBALS['LANG']->getLL('general.list.headline.incfcewithdefaultlanguage.title') . '</td>';
         $content .= '</tr>';
         $content .= '</thead>';
         $content .= '<tbody>';
         $informationIcon = t3lib_iconWorks::getSpriteIcon('actions-document-info');
         foreach ($l10nConfigurations as $record) {
             $configurationDetails = '<a class="tooltip" href="#tooltip_' . $record['uid'] . '">' . $informationIcon . '</a>';
             $configurationDetails .= '<div style="display:none;" id="tooltip_' . $record['uid'] . '" class="infotip">';
             $configurationDetails .= $this->renderConfigurationDetails($record);
             $configurationDetails .= '</div>';
             $content .= '<tr class="db_list_normal">';
             $content .= '<td>' . $configurationDetails . '</td>';
             $content .= '<td><a href="' . t3lib_div::resolveBackPath($this->doc->backPath . t3lib_extMgm::extRelPath('l10nmgr')) . 'cm1/index.php?id=' . $record['uid'] . '&srcPID=' . intval($this->id) . '">' . $record['title'] . '</a>' . '</td>';
             // Get the full page path
             // If very long, make sure to still display the full path
             $pagePath = t3lib_BEfunc::getRecordPath($record['pid'], '1', 20, 50);
             $path = is_array($pagePath) ? $pagePath[1] : $pagePath;
             $content .= '<td>' . $path . '</td>';
             $content .= '<td>' . $record['depth'] . '</td>';
             $content .= '<td>' . $record['tablelist'] . '</td>';
             $content .= '<td>' . $record['exclude'] . '</td>';
             $content .= '<td>' . $record['include'] . '</td>';
             $content .= '<td>' . $record['incfcewithdefaultlanguage'] . '</td>';
             $content .= '</tr>';
         }
         $content .= '</tbody>';
     }
     return $content;
 }
コード例 #9
0
    /**
     * Renders records from the sys_notes table from page id
     * NOTICE: Requires the sys_note extension to be loaded.
     *
     * @param	integer		Page id
     * @return	string		HTML for the listing
     */
    function getTable_sys_note($id)
    {
        global $TCA;
        if (!t3lib_extMgm::isLoaded('sys_note')) {
            return '';
        }
        // INIT:
        $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
        $tree = $this->getTreeObject($id, intval($GLOBALS['SOBE']->MOD_SETTINGS['pages_levels']), $perms_clause);
        $this->itemLabels = array();
        foreach ($TCA['sys_note']['columns'] as $name => $val) {
            $this->itemLabels[$name] = $GLOBALS['LANG']->sL($val['label']);
        }
        // If page ids were found, select all sys_notes from the page ids:
        $out = '';
        if (count($tree->ids)) {
            $delClause = t3lib_BEfunc::deleteClause('sys_note') . t3lib_BEfunc::versioningPlaceholderClause('sys_note');
            $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_note', 'pid IN (' . implode(',', $tree->ids) . ') AND (personal=0 OR cruser='******'BE_USER']->user['uid']) . ')' . $delClause);
            $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
            // If sys_notes were found, render them:
            if ($dbCount) {
                $this->fieldArray = explode(',', '__cmds__,info,note');
                // header line is drawn
                $theData = array();
                $theData['__cmds__'] = '';
                $theData['info'] = '<strong>Info</strong><br /><img src="clear.gif" height="1" width="220" alt="" />';
                $theData['note'] = '<strong>Note</strong>';
                $out .= $this->addelement(1, '', $theData, ' class="t3-row-header"', 20);
                // half line is drawn
                $theData = array();
                $theData['info'] = $this->widthGif;
                $out .= $this->addelement(0, '', $theData);
                $this->no_noWrap = 1;
                // Items
                $this->eCounter = $this->firstElementNumber;
                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
                    t3lib_BEfunc::workspaceOL('sys_note', $row);
                    if (is_array($row)) {
                        list($flag, $code) = $this->fwd_rwd_nav();
                        $out .= $code;
                        if ($flag) {
                            $color = array(0 => '', 1 => ' class="bgColor4"', 2 => ' class="bgColor2"', 3 => '', 4 => ' class="bgColor5"');
                            $tdparams = $color[$row['category']];
                            $info = array();
                            $theData = array();
                            $this->getProcessedValue('sys_note', 'subject,category,author,email,personal', $row, $info);
                            $cont = implode('<br />', $info);
                            $head = '<strong>Page:</strong> ' . t3lib_BEfunc::getRecordPath($row['pid'], $perms_clause, 10) . '<br />';
                            $theData['__cmds__'] = $this->getIcon('sys_note', $row);
                            $theData['info'] = $head . $cont;
                            $theData['note'] = nl2br($row['message']);
                            $out .= $this->addelement(1, '', $theData, $tdparams, 20);
                            // half line is drawn
                            $theData = array();
                            $theData['info'] = $this->widthGif;
                            $out .= $this->addelement(0, '', $theData);
                        }
                        $this->eCounter++;
                    }
                }
                // Wrap it all in a table:
                $out = '
					<table border="0" cellpadding="1" cellspacing="2" width="480" class="typo3-page-sysnote">
						' . $out . '
					</table>';
            }
        }
        return $out;
    }
コード例 #10
0
    /**
     * [Describe function...]
     *
     * @param	[type]		$arr: ...
     * @param	[type]		$depthData: ...
     * @param	[type]		$keyArray: ...
     * @param	[type]		$first: ...
     * @return	[type]		...
     */
    function ext_getTemplateHierarchyArr($arr, $depthData, $keyArray, $first = 0)
    {
        $keyArr = array();
        foreach ($arr as $key => $value) {
            $key = preg_replace('/\\.$/', '', $key);
            if (substr($key, -1) != '.') {
                $keyArr[$key] = 1;
            }
        }
        $a = 0;
        $c = count($keyArr);
        static $i;
        foreach ($keyArr as $key => $value) {
            $HTML = '';
            $a++;
            $deeper = is_array($arr[$key . '.']);
            $row = $arr[$key];
            $PM = 'join';
            $LN = $a == $c ? 'blank' : 'line';
            $BTM = $a == $c ? 'top' : '';
            $PM = 'join';
            $HTML .= $depthData;
            $alttext = '[' . $row['templateID'] . ']';
            $alttext .= $row['pid'] ? ' - ' . t3lib_BEfunc::getRecordPath($row['pid'], $GLOBALS['SOBE']->perms_clause, 20) : '';
            $icon = substr($row['templateID'], 0, 3) == 'sys' ? t3lib_iconWorks::getSpriteIconForRecord('sys_template', $row, array('title' => $alttext)) : t3lib_iconWorks::getSpriteIcon('mimetypes-x-content-template-static', array('title' => $alttext));
            if (in_array($row['templateID'], $this->clearList_const) || in_array($row['templateID'], $this->clearList_setup)) {
                $A_B = '<a href="index.php?id=' . $GLOBALS['SOBE']->id . '&template=' . $row['templateID'] . '">';
                $A_E = '</a>';
                if (t3lib_div::_GP('template') == $row['templateID']) {
                    $A_B = '<strong>' . $A_B;
                    $A_E .= '</strong>';
                }
            } else {
                $A_B = '';
                $A_E = '';
            }
            $HTML .= ($first ? '' : '<img src="' . $GLOBALS['BACK_PATH'] . 'gfx/ol/' . $PM . $BTM . '.gif" width="18" height="16" align="top" border="0" />') . $icon . $A_B . t3lib_div::fixed_lgd_cs($row['title'], $GLOBALS['BE_USER']->uc['titleLen']) . $A_E . '&nbsp;&nbsp;';
            $RL = $this->ext_getRootlineNumber($row['pid']);
            $keyArray[] = '<tr class="' . ($i++ % 2 == 0 ? 'bgColor4' : 'bgColor6') . '">
							<td nowrap>' . $HTML . '</td>
							<td align="center">' . ($row['root'] ? t3lib_iconWorks::getSpriteIcon('status-status-checked') : '') . '&nbsp;&nbsp;</td>
							<td align="center">' . ($row['clConf'] ? t3lib_iconWorks::getSpriteIcon('status-status-checked') : '') . '&nbsp;&nbsp;' . '</td>
							<td align="center">' . ($row['clConst'] ? t3lib_iconWorks::getSpriteIcon('status-status-checked') : '') . '&nbsp;&nbsp;' . '</td>
							<td align="center">' . ($row['pid'] ? $row['pid'] : '') . '</td>
							<td align="center">' . (strcmp($RL, '') ? $RL : '') . '</td>
							<td>' . ($row['next'] ? '&nbsp;' . $row['next'] . '&nbsp;&nbsp;' : '') . '</td>
						</tr>';
            if ($deeper) {
                $keyArray = $this->ext_getTemplateHierarchyArr($arr[$key . '.'], $depthData . ($first ? '' : '<img src="' . $GLOBALS['BACK_PATH'] . 'gfx/ol/' . $LN . '.gif" width="18" height="16" align="top" />'), $keyArray);
            }
        }
        return $keyArray;
    }
コード例 #11
0
 /**
  * If "editPage" value is sent to script and it points to an accessible page, the internal var $this->theEditRec is set to the page record which should be loaded.
  * Returns void
  *
  * @return	void
  */
 function editPageIdFunc()
 {
     global $BE_USER, $LANG;
     if (!t3lib_extMgm::isLoaded('cms')) {
         return;
     }
     // EDIT page:
     $this->editPage = trim($LANG->csConvObj->conv_case($LANG->charSet, $this->editPage, 'toLower'));
     $this->editError = '';
     $this->theEditRec = '';
     $this->searchFor = '';
     if ($this->editPage) {
         // First, test alternative value consisting of [table]:[uid] and if not found, proceed with traditional page ID resolve:
         $this->alternativeTableUid = explode(':', $this->editPage);
         if (!(count($this->alternativeTableUid) == 2 && $BE_USER->isAdmin())) {
             // We restrict it to admins only just because I'm not really sure if alt_doc.php properly checks permissions of passed records for editing. If alt_doc.php does that, then we can remove this.
             $where = ' AND (' . $BE_USER->getPagePermsClause(2) . ' OR ' . $BE_USER->getPagePermsClause(16) . ')';
             if (t3lib_div::testInt($this->editPage)) {
                 $this->theEditRec = t3lib_BEfunc::getRecordWSOL('pages', $this->editPage, '*', $where);
             } else {
                 $records = t3lib_BEfunc::getRecordsByField('pages', 'alias', $this->editPage, $where);
                 if (is_array($records)) {
                     reset($records);
                     $this->theEditRec = current($records);
                     t3lib_BEfunc::workspaceOL('pages', $this->theEditRec);
                 }
             }
             if (!is_array($this->theEditRec)) {
                 unset($this->theEditRec);
                 $this->searchFor = $this->editPage;
             } elseif (!$BE_USER->isInWebMount($this->theEditRec['uid'])) {
                 unset($this->theEditRec);
                 $this->editError = $LANG->getLL('shortcut_notEditable');
             } else {
                 // Visual path set:
                 $perms_clause = $BE_USER->getPagePermsClause(1);
                 $this->editPath = t3lib_BEfunc::getRecordPath($this->theEditRec['pid'], $perms_clause, 30);
                 if (!$BE_USER->getTSConfigVal('options.shortcut_onEditId_dontSetPageTree')) {
                     // Expanding page tree:
                     t3lib_BEfunc::openPageTree($this->theEditRec['pid'], !$BE_USER->getTSConfigVal('options.shortcut_onEditId_keepExistingExpanded'));
                 }
             }
         }
     }
 }
コード例 #12
0
 /**
  * Main function
  *
  * @return	void
  */
 function main()
 {
     global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
     $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('adminLog'));
     $this->content .= $this->doc->spacer(5);
     // Menu compiled:
     $menuU = t3lib_BEfunc::getFuncMenu(0, 'SET[users]', $this->MOD_SETTINGS['users'], $this->MOD_MENU['users']);
     $menuM = t3lib_BEfunc::getFuncMenu(0, 'SET[max]', $this->MOD_SETTINGS['max'], $this->MOD_MENU['max']);
     $menuT = t3lib_BEfunc::getFuncMenu(0, 'SET[time]', $this->MOD_SETTINGS['time'], $this->MOD_MENU['time']);
     $menuA = t3lib_BEfunc::getFuncMenu(0, 'SET[action]', $this->MOD_SETTINGS['action'], $this->MOD_MENU['action']);
     $menuW = t3lib_BEfunc::getFuncMenu(0, 'SET[workspaces]', $this->MOD_SETTINGS['workspaces'], $this->MOD_MENU['workspaces']);
     $groupByPage = t3lib_BEfunc::getFuncCheck(0, 'SET[groupByPage]', $this->MOD_SETTINGS['groupByPage']);
     $style = ' style="margin:4px 2px;padding:1px;vertical-align:middle;width: 115px;"';
     $inputDate = '<input type="text" value="' . ($this->MOD_SETTINGS['manualdate'] ? $this->MOD_SETTINGS['manualdate'] : '') . '" name="SET[manualdate]" id="tceforms-datetimefield-manualdate"' . $style . ' />';
     $pickerInputDate = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/datepicker.gif', '', 0) . ' style="cursor:pointer; vertical-align:middle;" alt=""' . ' id="picker-tceforms-datetimefield-manualdate" />';
     $inputDate_end = '<input type="text" value="' . ($this->MOD_SETTINGS['manualdate_end'] ? $this->MOD_SETTINGS['manualdate_end'] : '') . '" name="SET[manualdate]" id="tceforms-datetimefield-manualdate_end"' . $style . ' />';
     $pickerInputDate_end = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/datepicker.gif', '', 0) . ' style="cursor:pointer; vertical-align:middle;" alt=""' . ' id="picker-tceforms-datetimefield-manualdate_end" />';
     $setButton = '<input type="button" value="' . $GLOBALS['LANG']->getLL('set') . '" onclick="jumpToUrl(\'mod.php?&amp;id=0&amp;M=tools_log&amp;SET[manualdate]=\'+escape($(\'tceforms-datetimefield-manualdate\').value)+\'&amp;SET[manualdate_end]=\'+escape($(\'tceforms-datetimefield-manualdate_end\').value),this);" />';
     $this->content .= $this->doc->section('', $this->doc->menuTable(array(array($GLOBALS['LANG']->getLL('users'), $menuU), array($GLOBALS['LANG']->getLL('time'), $menuT . ($this->MOD_SETTINGS['time'] == 30 ? '<br />' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:from', true) . ' ' . $inputDate . $pickerInputDate . ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:to', true) . ' ' . $inputDate_end . $pickerInputDate_end . '&nbsp;' . $setButton : ''))), array(array($GLOBALS['LANG']->getLL('max'), $menuM), array($GLOBALS['LANG']->getLL('action'), $menuA)), array($GLOBALS['BE_USER']->workspace !== 0 ? array($GLOBALS['LANG']->getLL('workspace'), '<strong>' . $GLOBALS['BE_USER']->workspace . '</strong>') : array($GLOBALS['LANG']->getLL('workspace'), $menuW), array($GLOBALS['LANG']->getLL('groupByPage'), $groupByPage))));
     $codeArr = $this->lF->initArray();
     $oldHeader = '';
     $c = 0;
     // Action (type):
     $where_part = '';
     if ($this->MOD_SETTINGS['action'] > 0) {
         $where_part .= ' AND type=' . intval($this->MOD_SETTINGS['action']);
     } elseif ($this->MOD_SETTINGS['action'] == -1) {
         $where_part .= ' AND error != 0';
     }
     $starttime = 0;
     $endtime = $GLOBALS['EXEC_TIME'];
     // Time:
     switch ($this->MOD_SETTINGS['time']) {
         case 0:
             // This week
             $week = (date('w') ? date('w') : 7) - 1;
             $starttime = mktime(0, 0, 0) - $week * 3600 * 24;
             break;
         case 1:
             // Last week
             $week = (date('w') ? date('w') : 7) - 1;
             $starttime = mktime(0, 0, 0) - ($week + 7) * 3600 * 24;
             $endtime = mktime(0, 0, 0) - $week * 3600 * 24;
             break;
         case 2:
             // Last 7 days
             $starttime = mktime(0, 0, 0) - 7 * 3600 * 24;
             break;
         case 10:
             // This month
             $starttime = mktime(0, 0, 0, date('m'), 1);
             break;
         case 11:
             // Last month
             $starttime = mktime(0, 0, 0, date('m') - 1, 1);
             $endtime = mktime(0, 0, 0, date('m'), 1);
             break;
         case 12:
             // Last 31 days
             $starttime = mktime(0, 0, 0) - 31 * 3600 * 24;
             break;
         case 30:
             $starttime = $this->theTime;
             if ($this->theTime_end) {
                 $endtime = $this->theTime_end;
             } else {
                 $endtime = $GLOBALS['EXEC_TIME'];
             }
     }
     if ($starttime) {
         $where_part .= ' AND tstamp>=' . $starttime . ' AND tstamp<' . $endtime;
     }
     // Users
     $selectUsers = array();
     if (substr($this->MOD_SETTINGS['users'], 0, 3) == "gr-") {
         // All users
         $this->be_user_Array = t3lib_BEfunc::blindUserNames($this->be_user_Array, array(substr($this->MOD_SETTINGS['users'], 3)), 1);
         if (is_array($this->be_user_Array)) {
             foreach ($this->be_user_Array as $val) {
                 if ($val['uid'] != $BE_USER->user['uid']) {
                     $selectUsers[] = $val['uid'];
                 }
             }
         }
         $selectUsers[] = 0;
         $where_part .= ' AND userid in (' . implode($selectUsers, ',') . ')';
     } elseif (substr($this->MOD_SETTINGS['users'], 0, 3) == "us-") {
         // All users
         $selectUsers[] = intval(substr($this->MOD_SETTINGS['users'], 3));
         $where_part .= ' AND userid in (' . implode($selectUsers, ',') . ')';
     } elseif ($this->MOD_SETTINGS['users'] == -1) {
         $where_part .= ' AND userid=' . $BE_USER->user['uid'];
         // Self user
     }
     // Workspace
     if ($GLOBALS['BE_USER']->workspace !== 0) {
         $where_part .= ' AND workspace=' . intval($GLOBALS['BE_USER']->workspace);
     } elseif ($this->MOD_SETTINGS['workspaces'] != -99) {
         $where_part .= ' AND workspace=' . intval($this->MOD_SETTINGS['workspaces']);
     }
     // Finding out which page ids are in the log:
     $logPids = array();
     if ($this->MOD_SETTINGS['groupByPage']) {
         $log = $GLOBALS['TYPO3_DB']->exec_SELECTquery('event_pid', 'sys_log', '1=1' . $where_part, 'event_pid');
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($log)) {
             $logPids[] = $row['event_pid'];
         }
         // Overview:
         $overviewList = array();
         foreach ($logPids as $pid) {
             if ((int) $pid > 0) {
                 $overviewList[] = htmlspecialchars(sprintf($GLOBALS['LANG']->getLL('pagenameWithUID'), t3lib_BEfunc::getRecordPath($pid, '', 20), $pid));
             }
         }
         sort($overviewList);
         $this->content .= $this->doc->divider(5);
         $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('overview'), sprintf($GLOBALS['LANG']->getLL('timeInfo'), date($this->dateFormat, $starttime), date($this->dateFormat, $endtime)) . '<br /><br /><br />' . implode('<br />', $overviewList), 1, 1, 0);
         $this->content .= $this->doc->spacer(30);
     } else {
         $logPids[] = '_SINGLE';
     }
     foreach ($logPids as $pid) {
         $codeArr = $this->lF->initArray();
         $this->lF->reset();
         $oldHeader = '';
         $this->content .= $this->doc->divider(5);
         switch ($pid) {
             case '_SINGLE':
                 $insertMsg = '';
                 break;
             case '-1':
                 $insertMsg = ' ' . $GLOBALS['LANG']->getLL('forNonPageRelatedActions') . ' ';
                 break;
             case '0':
                 $insertMsg = ' ' . $GLOBALS['LANG']->getLL('forRootLevel') . ' ';
                 break;
             default:
                 $insertMsg = ' ' . sprintf($GLOBALS['LANG']->getLL('forPage'), t3lib_BEfunc::getRecordPath($pid, '', 20), $pid) . ' ';
                 break;
         }
         $this->content .= $this->doc->section(sprintf($GLOBALS['LANG']->getLL('logForNonPageRelatedActionsOrRootLevelOrPage'), $insertMsg, date($this->dateFormat, $starttime), date($this->dateFormat, $endtime)), '', 1, 1, 0);
         $log = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_log', '1=1' . $where_part . ($pid != '_SINGLE' ? ' AND event_pid=' . intval($pid) : ''), '', 'uid DESC', intval($this->MOD_SETTINGS['max']));
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($log)) {
             $header = $this->doc->formatTime($row['tstamp'], 10);
             if (!$oldHeader) {
                 $oldHeader = $header;
             }
             if ($header != $oldHeader) {
                 $this->content .= $this->doc->spacer(10);
                 $this->content .= $this->doc->section($oldHeader, $this->doc->table($codeArr));
                 $codeArr = $this->lF->initArray();
                 $oldHeader = $header;
                 $this->lF->reset();
             }
             $i++;
             $codeArr[$i][] = $this->lF->getTimeLabel($row['tstamp']);
             $codeArr[$i][] = $this->lF->getUserLabel($row['userid'], $row['workspace']);
             $codeArr[$i][] = $this->lF->getTypeLabel($row['type']);
             $codeArr[$i][] = $row['error'] ? $this->lF->getErrorFormatting($this->lF->errorSign[$row['error']], $row['error']) : '';
             $codeArr[$i][] = $this->lF->getActionLabel($row['type'] . '_' . $row['action']);
             $codeArr[$i][] = $this->lF->formatDetailsForList($row);
         }
         $this->content .= $this->doc->spacer(10);
         $this->content .= $this->doc->section($header, $this->doc->table($codeArr));
         $GLOBALS['TYPO3_DB']->sql_free_result($log);
     }
     // Setting up the buttons and markers for docheader
     $docHeaderButtons = $this->getButtons();
     //$markers['CSH'] = $docHeaderButtons['csh'];
     $markers['CONTENT'] = $this->content;
     // Build the <body> for the module
     $this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('adminLog'));
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
 /**
  * Returns the path for a record. Is the whole path for all records except pages - for these the last part is cut
  * off, because it contains the pagetitle itself, which would be double information
  *
  * The path is returned uncut, cutting has to be done by calling function.
  *
  * @param  array	$row The row
  * @param  array	$record The record
  * @return string The record-path
  */
 protected function getRecordPath(&$row, $uid)
 {
     $titleLimit = max($this->config['maxPathTitleLength'], 0);
     if (($this->mmForeignTable ? $this->mmForeignTable : $this->table) == 'pages') {
         $path = t3lib_BEfunc::getRecordPath($uid, '', $titleLimit);
         // for pages we only want the first (n-1) parts of the path, because the n-th part is the page itself
         $path = substr($path, 0, strrpos($path, '/', -2)) . '/';
     } else {
         $path = t3lib_BEfunc::getRecordPath($row['pid'], '', $titleLimit);
     }
     return $path;
 }
コード例 #14
0
 /**
  * Return record path (visually formatted, using t3lib_BEfunc::getRecordPath() )
  *
  * @param	string		Table name
  * @param	array		Record array
  * @return	string		The record path.
  * @see t3lib_BEfunc::getRecordPath()
  */
 function getRecordPath($table, $rec)
 {
     t3lib_BEfunc::fixVersioningPid($table, $rec);
     list($tscPID, $thePidValue) = $this->getTSCpid($table, $rec['uid'], $rec['pid']);
     if ($thePidValue >= 0) {
         return t3lib_BEfunc::getRecordPath($tscPID, $this->readPerms(), 15);
     }
 }
コード例 #15
0
 /**
  * Action to edit records
  *
  * @param	array		$record: sys_action record
  * @return	string list of records
  */
 protected function viewEditRecord($record)
 {
     $content = '';
     $actionList = array();
     $dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
     $dbAnalysis->fromTC = 0;
     $dbAnalysis->start($record['t4_recordsToEdit'], '*');
     $dbAnalysis->getFromDB();
     // collect the records
     foreach ($dbAnalysis->itemArray as $el) {
         $path = t3lib_BEfunc::getRecordPath($el['id'], $this->taskObject->perms_clause, $GLOBALS['BE_USER']->uc['titleLen']);
         $record = t3lib_BEfunc::getRecord($el['table'], $dbAnalysis->results[$el['table']][$el['id']]);
         $title = t3lib_BEfunc::getRecordTitle($el['table'], $dbAnalysis->results[$el['table']][$el['id']]);
         $description = $GLOBALS['LANG']->sL($GLOBALS['TCA'][$el['table']]['ctrl']['title'], 1);
         if (isset($record['crdate'])) {
             // @todo: which information could be  needfull
             $description .= ' - ' . t3lib_BEfunc::dateTimeAge($record['crdate']);
         }
         $actionList[$el['id']] = array('title' => $title, 'description' => t3lib_BEfunc::getRecordTitle($el['table'], $dbAnalysis->results[$el['table']][$el['id']]), 'descriptionHtml' => $description, 'link' => $GLOBALS['BACK_PATH'] . 'alt_doc.php?returnUrl=' . rawurlencode(t3lib_div::getIndpEnv("REQUEST_URI")) . '&edit[' . $el['table'] . '][' . $el['id'] . ']=edit', 'icon' => t3lib_iconworks::getSpriteIconForRecord($el['table'], $dbAnalysis->results[$el['table']][$el['id']], array('title' => htmlspecialchars($path))));
     }
     // render the record list
     $content .= $this->taskObject->renderListMenu($actionList);
     return $content;
 }
コード例 #16
0
    ?>
</td>
							<td><?php 
    echo $configurationElementArray['incfcewithdefaultlanguage'];
    ?>
</td>
						</tr>
					</table>
				</div>
			</td>
			<td><?php 
    echo '<a href="' . t3lib_div::resolveBackPath($BACK_PATH . t3lib_extMgm::extRelPath('l10nmgr')) . 'cm1/index.php?id=' . $configurationElementArray['uid'] . '&srcPID=' . t3lib_div::intval_positive($this->getPageId()) . '">' . $configurationElementArray['title'] . '</a>';
    ?>
</td>
			<td><?php 
    echo current(t3lib_BEfunc::getRecordPath($configurationElementArray['pid'], '1', 20, 50));
    ?>
</td>
			<td><?php 
    echo $configurationElementArray['depth'];
    ?>
</td>
			<td><?php 
    echo $configurationElementArray['tablelist'];
    ?>
</td>
			<td><?php 
    echo $configurationElementArray['exclude'];
    ?>
</td>
			<td><?php 
コード例 #17
0
 /**
  * Returns the path for a certain pid
  * The result is cached internally for the session, thus you can call this function as much as you like without performance problems.
  *
  * @param	integer		The page id for which to get the path
  * @return	string		The path.
  */
 function recPath($pid)
 {
     if (!isset($this->recPath_cache[$pid])) {
         $this->recPath_cache[$pid] = t3lib_BEfunc::getRecordPath($pid, $this->perms_clause, 20);
     }
     return $this->recPath_cache[$pid];
 }
コード例 #18
0
 /**
  * Displays one line of the broken links table.
  *
  * @param string $table Name of database table
  * @param array $row Record row to be processed
  * @param array $brokenLinksItemTemplate Markup of the template to be used
  * @return string HTML of the rendered row
  */
 protected function renderTableRow($table, array $row, $brokenLinksItemTemplate)
 {
     $markerArray = array();
     if (is_array($row) && !empty($row['link_type'])) {
         if ($hookObj = $this->hookObjectsArr[$row['link_type']]) {
             $brokenUrl = $hookObj->getBrokenUrl($row);
         }
     }
     $params = '&edit[' . $table . '][' . $row['record_uid'] . ']=edit';
     $actionLinks = '<a href="#" onclick="' . t3lib_BEfunc::editOnClick($params, $GLOBALS['BACK_PATH'], t3lib_div::getIndpEnv('REQUEST_URI') . '?id=' . $this->pObj->id . '&search_levels=' . $this->searchLevel) . '"' . ' title="' . $GLOBALS['LANG']->getLL('list.edit') . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>';
     $elementHeadline = $row['headline'];
     if (empty($elementHeadline)) {
         $elementHeadline = '<i>' . $GLOBALS['LANG']->getLL('list.no.headline') . '</i>';
     }
     // Get the language label for the field from TCA
     if ($GLOBALS['TCA'][$table]['columns'][$row['field']]['label']) {
         $fieldName = $GLOBALS['TCA'][$table]['columns'][$row['field']]['label'];
         $fieldName = $GLOBALS['LANG']->sL($fieldName);
         // Crop colon from end if present.
         if (substr($fieldName, '-1', '1') === ':') {
             $fieldName = substr($fieldName, '0', strlen($fieldName) - 1);
         }
     }
     // Fallback, if there is no label
     $fieldName = $fieldName ? $fieldName : $row['field'];
     // column "Element"
     $element = t3lib_iconWorks::getSpriteIconForRecord($table, $row, array('title' => $table . ':' . $row['record_uid']));
     $element .= $elementHeadline;
     $element .= ' ' . sprintf($GLOBALS['LANG']->getLL('list.field'), $fieldName);
     $markerArray['actionlink'] = $actionLinks;
     $markerArray['path'] = t3lib_BEfunc::getRecordPath($row['record_pid'], '', 0, 0);
     $markerArray['element'] = $element;
     $markerArray['headlink'] = $row['link_title'];
     $markerArray['linktarget'] = $brokenUrl;
     $response = unserialize($row['url_response']);
     if ($response['valid']) {
         $linkMessage = '<span style="color: green;">' . $GLOBALS['LANG']->getLL('list.msg.ok') . '</span>';
     } else {
         $linkMessage = '<span style="color: red;">' . $hookObj->getErrorMessage($response['errorParams']) . '</span>';
     }
     $markerArray['linkmessage'] = $linkMessage;
     $lastRunDate = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $row['last_check']);
     $lastRunTime = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'], $row['last_check']);
     $message = sprintf($GLOBALS['LANG']->getLL('list.msg.lastRun'), $lastRunDate, $lastRunTime);
     $markerArray['lastcheck'] = $message;
     // Return the table html code as string
     return t3lib_parsehtml::substituteMarkerArray($brokenLinksItemTemplate, $markerArray, '###|###', TRUE, TRUE);
 }
コード例 #19
0
    /**
     * Main Task center module
     *
     * @return	string		HTML content.
     */
    public function main()
    {
        $content = '';
        $id = intval(t3lib_div::_GP('display'));
        // if a preset is found, it is rendered using an iframe
        if ($id > 0) {
            $url = $GLOBALS['BACK_PATH'] . t3lib_extMgm::extRelPath('impexp') . 'app/index.php?tx_impexp[action]=export&preset[load]=1&preset[select]=' . $id;
            return $this->taskObject->urlInIframe($url, 1);
        } else {
            // header
            $content .= $this->taskObject->description($GLOBALS['LANG']->getLL('.alttitle'), $GLOBALS['LANG']->getLL('.description'));
            $thumbnails = $lines = array();
            // Thumbnail folder and files:
            $tempDir = $this->userTempFolder();
            if ($tempDir) {
                $thumbnails = t3lib_div::getFilesInDir($tempDir, 'png,gif,jpg', 1);
            }
            $clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
            $usernames = t3lib_BEfunc::getUserNames();
            // Create preset links:
            $presets = $this->getPresets();
            // if any presets found
            if (is_array($presets)) {
                foreach ($presets as $key => $presetCfg) {
                    $configuration = unserialize($presetCfg['preset_data']);
                    $thumbnailFile = $thumbnails[$configuration['meta']['thumbnail']];
                    $title = strlen($presetCfg['title']) ? $presetCfg['title'] : '[' . $presetCfg['uid'] . ']';
                    $icon = 'EXT:impexp/export.gif';
                    $description = array();
                    // is public?
                    if ($presetCfg['public']) {
                        $description[] = $GLOBALS['LANG']->getLL('task.public') . ': ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes');
                    }
                    // owner
                    $description[] = $GLOBALS['LANG']->getLL('task.owner') . ': ' . ($presetCfg['user_uid'] === $GLOBALS['BE_USER']->user['uid'] ? $GLOBALS['LANG']->getLL('task.own') : '[' . htmlspecialchars($usernames[$presetCfg['user_uid']]['username']) . ']');
                    // page & path
                    if ($configuration['pagetree']['id']) {
                        $description[] = $GLOBALS['LANG']->getLL('task.page') . ': ' . $configuration['pagetree']['id'];
                        $description[] = $GLOBALS['LANG']->getLL('task.path') . ': ' . htmlspecialchars(t3lib_BEfunc::getRecordPath($configuration['pagetree']['id'], $clause, 20));
                    } else {
                        $description[] = $GLOBALS['LANG']->getLL('single-record');
                    }
                    // Meta information
                    if ($configuration['meta']['title'] || $configuration['meta']['description'] || $configuration['meta']['notes']) {
                        $metaInformation = '';
                        if ($configuration['meta']['title']) {
                            $metaInformation .= '<strong>' . htmlspecialchars($configuration['meta']['title']) . '</strong><br />';
                        }
                        if ($configuration['meta']['description']) {
                            $metaInformation .= htmlspecialchars($configuration['meta']['description']);
                        }
                        if ($configuration['meta']['notes']) {
                            $metaInformation .= '<br /><br />
												<strong>' . $GLOBALS['LANG']->getLL('notes') . ': </strong>
												<em>' . htmlspecialchars($configuration['meta']['notes']) . '</em>';
                        }
                        $description[] = '<br />' . $metaInformation;
                    }
                    // collect all preset information
                    $lines[$key] = array('icon' => $icon, 'title' => $title, 'descriptionHtml' => implode('<br />', $description), 'link' => 'mod.php?M=user_task&SET[function]=impexp.tx_impexp_task&display=' . $presetCfg['uid']);
                }
                // render preset list
                $content .= $this->taskObject->renderListMenu($lines);
            } else {
                // no presets found
                $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('no-presets'), '', t3lib_FlashMessage::NOTICE);
                $content .= $flashMessage->render();
            }
        }
        return $content;
    }
コード例 #20
0
ファイル: GridData.php プロジェクト: NaveedWebdeveloper/Test
 /**
  * Generates grid list array from given versions.
  *
  * @param array $versions
  * @param string $filterTxt
  * @return void
  */
 protected function generateDataArray(array $versions, $filterTxt)
 {
     /** @var $stagesObj Tx_Workspaces_Service_Stages */
     $stagesObj = t3lib_div::makeInstance('Tx_Workspaces_Service_Stages');
     /** @var $workspacesObj Tx_Workspaces_Service_Workspaces */
     $workspacesObj = t3lib_div::makeInstance('Tx_Workspaces_Service_Workspaces');
     $availableWorkspaces = $workspacesObj->getAvailableWorkspaces();
     $workspaceAccess = $GLOBALS['BE_USER']->checkWorkspace($GLOBALS['BE_USER']->workspace);
     $swapStage = $workspaceAccess['publish_access'] & 1 ? Tx_Workspaces_Service_Stages::STAGE_PUBLISH_ID : 0;
     $swapAccess = $GLOBALS['BE_USER']->workspacePublishAccess($GLOBALS['BE_USER']->workspace) && $GLOBALS['BE_USER']->workspaceSwapAccess();
     $this->initializeWorkspacesCachingFramework();
     // check for dataArray in cache
     if ($this->getDataArrayFromCache($versions, $filterTxt) == FALSE) {
         $stagesObj = t3lib_div::makeInstance('Tx_Workspaces_Service_Stages');
         foreach ($versions as $table => $records) {
             $versionArray = array('table' => $table);
             foreach ($records as $record) {
                 $origRecord = t3lib_BEFunc::getRecord($table, $record['t3ver_oid']);
                 $versionRecord = t3lib_BEFunc::getRecord($table, $record['uid']);
                 if (isset($GLOBALS['TCA'][$table]['columns']['hidden'])) {
                     $recordState = $this->workspaceState($versionRecord['t3ver_state'], $origRecord['hidden'], $versionRecord['hidden']);
                 } else {
                     $recordState = $this->workspaceState($versionRecord['t3ver_state']);
                 }
                 $isDeletedPage = $table == 'pages' && $recordState == 'deleted';
                 $viewUrl = tx_Workspaces_Service_Workspaces::viewSingleRecord($table, $record['t3ver_oid'], $origRecord);
                 $pctChange = $this->calculateChangePercentage($table, $origRecord, $versionRecord);
                 $versionArray['uid'] = $record['uid'];
                 $versionArray['workspace'] = $versionRecord['t3ver_id'];
                 $versionArray['label_Workspace'] = htmlspecialchars($versionRecord[$GLOBALS['TCA'][$table]['ctrl']['label']]);
                 $versionArray['label_Live'] = htmlspecialchars($origRecord[$GLOBALS['TCA'][$table]['ctrl']['label']]);
                 $versionArray['label_Stage'] = htmlspecialchars($stagesObj->getStageTitle($versionRecord['t3ver_stage']));
                 $versionArray['change'] = $pctChange;
                 $versionArray['path_Live'] = htmlspecialchars(t3lib_BEfunc::getRecordPath($record['livepid'], '', 999));
                 $versionArray['path_Workspace'] = htmlspecialchars(t3lib_BEfunc::getRecordPath($record['wspid'], '', 999));
                 $versionArray['workspace_Title'] = htmlspecialchars(tx_Workspaces_Service_Workspaces::getWorkspaceTitle($versionRecord['t3ver_wsid']));
                 $versionArray['workspace_Tstamp'] = $versionRecord['tstamp'];
                 $versionArray['workspace_Formated_Tstamp'] = t3lib_BEfunc::datetime($versionRecord['tstamp']);
                 $versionArray['t3ver_oid'] = $record['t3ver_oid'];
                 $versionArray['livepid'] = $record['livepid'];
                 $versionArray['stage'] = $versionRecord['t3ver_stage'];
                 $versionArray['icon_Live'] = t3lib_iconWorks::mapRecordTypeToSpriteIconClass($table, $origRecord);
                 $versionArray['icon_Workspace'] = t3lib_iconWorks::mapRecordTypeToSpriteIconClass($table, $versionRecord);
                 $versionArray['allowedAction_nextStage'] = $stagesObj->isNextStageAllowedForUser($versionRecord['t3ver_stage']);
                 $versionArray['allowedAction_prevStage'] = $stagesObj->isPrevStageAllowedForUser($versionRecord['t3ver_stage']);
                 if ($swapAccess && $swapStage != 0 && $versionRecord['t3ver_stage'] == $swapStage) {
                     $versionArray['allowedAction_swap'] = $stagesObj->isNextStageAllowedForUser($swapStage);
                 } else {
                     if ($swapAccess && $swapStage == 0) {
                         $versionArray['allowedAction_swap'] = TRUE;
                     } else {
                         $versionArray['allowedAction_swap'] = FALSE;
                     }
                 }
                 $versionArray['allowedAction_delete'] = TRUE;
                 // preview and editing of a deleted page won't work ;)
                 $versionArray['allowedAction_view'] = !$isDeletedPage && $viewUrl;
                 $versionArray['allowedAction_edit'] = !$isDeletedPage;
                 $versionArray['allowedAction_editVersionedPage'] = !$isDeletedPage;
                 $versionArray['state_Workspace'] = $recordState;
                 if ($filterTxt == '' || $this->isFilterTextInVisibleColumns($filterTxt, $versionArray)) {
                     $this->dataArray[] = $versionArray;
                 }
             }
         }
         $this->sortDataArray();
         $this->setDataArrayIntoCache($versions, $filterTxt);
     }
     $this->sortDataArray();
 }
コード例 #21
0
 /**
  * Renders the data columns
  *
  * @param	array		$item item array
  * @return	array
  */
 function getItemColumns($item)
 {
     // Columns rendering
     $columns = array();
     foreach ($this->columnList as $field => $descr) {
         switch ($field) {
             case 'page':
                 // Create output item for pages record
                 $pageRow = $item[$field];
                 $rootline = t3lib_BEfunc::BEgetRootLine($pageRow['uid']);
                 $pageOnClick = t3lib_BEfunc::viewOnClick($pageRow['uid'], $GLOBALS['BACK_PATH'], $rootline);
                 $iconAltText = t3lib_BEfunc::getRecordIconAltText($pageRow, 'pages');
                 $icon = t3lib_iconWorks::getIconImage('pages', $pageRow, $GLOBALS['BACK_PATH'], 'title="' . $iconAltText . '" align="top"');
                 if ($this->showRootline) {
                     $title = t3lib_BEfunc::getRecordPath($pageRow['uid'], '1=1', 0);
                     $title = t3lib_div::fixed_lgd_cs($title, -$GLOBALS['BE_USER']->uc['titleLen']);
                 } else {
                     $title = t3lib_BEfunc::getRecordTitle('pages', $pageRow, TRUE);
                 }
                 if ($pageRow['doktype'] == 1 || $pageRow['doktype'] == 6) {
                     if ($this->enableContextMenus) {
                         $columns[$field] = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($icon, 'pages', $pageRow['uid'], 1, '', '+view,edit,info') . $title;
                     } else {
                         $columns[$field] = '<a href="#" onclick="' . htmlspecialchars($pageOnClick) . '">' . $icon . $title . '</a>';
                     }
                 } else {
                     if ($this->enableContextMenus) {
                         $columns[$field] = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($icon, 'pages', $pageRow['uid'], 1, '', '+edit,info') . $title;
                     } else {
                         $columns[$field] = $icon . $title;
                     }
                 }
                 break;
             case 'content_element':
                 // Create output item for content record
                 $refTable = $item['tablenames'];
                 $refRow = $item[$field];
                 if ($refTable == 'pages') {
                     // The reference to the media is on a field of a page record
                     if ($GLOBALS['BE_USER']->isInWebMount($refRow['uid']) && $GLOBALS['BE_USER']->doesUserHaveAccess($refRow, 1)) {
                         $columns[$field] = tx_dam_SCbase::getRecordInfoEditLink($refTable, $refRow);
                     } else {
                         $pageRow = $refRow;
                         $rootline = t3lib_BEfunc::BEgetRootLine($pageRow['uid']);
                         $pageOnClick = t3lib_BEfunc::viewOnClick($pageRow['uid'], $GLOBALS['BACK_PATH'], $rootline);
                         $iconAltText = t3lib_BEfunc::getRecordIconAltText($refRow, $refTable);
                         $icon = t3lib_iconworks::getIconImage($refTable, $refRow, $GLOBALS['BACK_PATH'], 'class="c-recicon" align="top" title="' . $iconAltText . '"');
                         $title = t3lib_BEfunc::getRecordTitle($refTable, $refRow, 1);
                         if ($pageRow['doktype'] == 1 || $pageRow['doktype'] == 6) {
                             $columns[$field] = '<a href="#" onclick="' . htmlspecialchars($pageOnClick) . '">' . $icon . $title . '</a>';
                         } else {
                             $columns[$field] = $icon . $title;
                         }
                     }
                 } else {
                     // The reference to the media is on a field of a content element record
                     if ($GLOBALS['BE_USER']->isInWebMount($pageRow['uid']) && $GLOBALS['BE_USER']->doesUserHaveAccess($pageRow, 1)) {
                         $columns[$field] = tx_dam_SCbase::getRecordInfoEditLink($refTable, $refRow);
                     } else {
                         $pageRow = $item['page'];
                         $rootline = t3lib_BEfunc::BEgetRootLine($pageRow['uid']);
                         $pageOnClick = t3lib_BEfunc::viewOnClick($pageRow['uid'], $GLOBALS['BACK_PATH'], $rootline);
                         $iconAltText = t3lib_BEfunc::getRecordIconAltText($refRow, $refTable);
                         $icon = t3lib_iconworks::getIconImage($refTable, $refRow, $GLOBALS['BACK_PATH'], 'class="c-recicon" align="top" title="' . $iconAltText . '"');
                         $title = t3lib_BEfunc::getRecordTitle($refTable, $refRow, 1);
                         if ($pageRow['doktype'] == 1 || $pageRow['doktype'] == 6) {
                             $columns[$field] = '<a href="#" onclick="' . htmlspecialchars($pageOnClick) . '">' . $icon . $title . '</a>';
                         } else {
                             $columns[$field] = $icon . $title;
                         }
                     }
                 }
                 break;
             case 'content_field':
                 // Create output item for reference field
                 $columns[$field] = $item[$field];
                 break;
             case 'softref_key':
                 // Create output item for reference key
                 $columns[$field] = $item['softref_key'] ? $GLOBALS['LANG']->sl('LLL:EXT:dam/lib/locallang.xml:softref_key_' . $item['softref_key']) : $GLOBALS['LANG']->sl('LLL:EXT:dam/lib/locallang.xml:softref_key_media');
                 break;
             case 'content_age':
                 // Create output text describing the age of the content element
                 $columns[$field] = t3lib_BEfunc::dateTimeAge($item[$field], 1);
                 break;
             case 'media_element':
                 // Create output item for tx_dam record
                 $columns[$field] = tx_dam_SCbase::getRecordInfoEditLink('tx_dam', $item);
                 break;
             case 'media_element_age':
                 // Create output text describing the tx_dam record age
                 $columns[$field] = t3lib_BEfunc::dateTimeAge($item['tstamp'], 1);
                 break;
             case '_CLIPBOARD_':
                 $columns[$field] = $this->clipboard_getItemControl($item);
                 break;
             case '_CONTROL_':
                 $columns[$field] = $this->getItemControl($item);
                 $this->columnTDAttr[$field] = ' nowrap="nowrap"';
                 break;
             default:
                 $content = $item[$field];
                 $columns[$field] = htmlspecialchars(t3lib_div::fixed_lgd_cs($content, $this->titleLength));
                 break;
         }
         if ($columns[$field] === '') {
             $columns[$field] = '&nbsp;';
         }
     }
     // Thumbsnails?
     if ($this->showThumbs and $this->thumbnailPossible($item)) {
         $columns['media_element'] .= '<div style="margin:2px 0 2px 0;">' . $this->getThumbNail($item) . '</div>';
     }
     return $columns;
 }
コード例 #22
0
    /**
     * Send an email notification to users in workspace
     *
     * @param	array		Workspace access array (from t3lib_userauthgroup::checkWorkspace())
     * @param	integer		New Stage number: 0 = editing, 1= just ready for review, 10 = ready for publication, -1 = rejected!
     * @param	string		Table name of element (or list of element names if $id is zero)
     * @param	integer		Record uid of element (if zero, then $table is used as reference to element(s) alone)
     * @param	string		User comment sent along with action
     * @return	void
     */
    function notifyStageChange($stat, $stageId, $table, $id, $comment)
    {
        $workspaceRec = t3lib_BEfunc::getRecord('sys_workspace', $stat['uid']);
        $elementName = $id ? $table . ':' . $id : $table;
        // So, if $id is not set, then $table is taken to be the complete element name!
        if (is_array($workspaceRec)) {
            // Compile label:
            switch ((int) $stageId) {
                case 1:
                    $newStage = 'Ready for review';
                    break;
                case 10:
                    $newStage = 'Ready for publishing';
                    break;
                case -1:
                    $newStage = 'Element was rejected!';
                    break;
                case 0:
                    $newStage = 'Rejected element was noticed and edited';
                    break;
                default:
                    $newStage = 'Unknown state change!?';
                    break;
            }
            // Compile list of recipients:
            $emails = array();
            switch ((int) $stat['stagechg_notification']) {
                case 1:
                    switch ((int) $stageId) {
                        case 1:
                            $emails = $this->notifyStageChange_getEmails($workspaceRec['reviewers']);
                            break;
                        case 10:
                            $emails = $this->notifyStageChange_getEmails($workspaceRec['adminusers'], TRUE);
                            break;
                        case -1:
                            #							$emails = $this->notifyStageChange_getEmails($workspaceRec['reviewers']);
                            #							$emails = array_merge($emails,$this->notifyStageChange_getEmails($workspaceRec['members']));
                            // List of elements to reject:
                            $allElements = explode(',', $elementName);
                            // Traverse them, and find the history of each
                            foreach ($allElements as $elRef) {
                                list($eTable, $eUid) = explode(':', $elRef);
                                $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('log_data,tstamp,userid', 'sys_log', 'action=6 and details_nr=30
										AND tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($eTable, 'sys_log') . '
										AND recuid=' . intval($eUid), '', 'uid DESC');
                                // Find all implicated since the last stage-raise from editing to review:
                                foreach ($rows as $dat) {
                                    $data = unserialize($dat['log_data']);
                                    //debug($dat['userid'],'Adds user at stage: '.$data['stage']);
                                    $emails = array_merge($emails, $this->notifyStageChange_getEmails($dat['userid'], TRUE));
                                    if ($data['stage'] == 1) {
                                        break;
                                    }
                                }
                            }
                            break;
                        case 0:
                            $emails = $this->notifyStageChange_getEmails($workspaceRec['members']);
                            break;
                        default:
                            $emails = $this->notifyStageChange_getEmails($workspaceRec['adminusers'], TRUE);
                            break;
                    }
                    break;
                case 10:
                    $emails = $this->notifyStageChange_getEmails($workspaceRec['adminusers'], TRUE);
                    $emails = array_merge($emails, $this->notifyStageChange_getEmails($workspaceRec['reviewers']));
                    $emails = array_merge($emails, $this->notifyStageChange_getEmails($workspaceRec['members']));
                    break;
            }
            $emails = array_unique($emails);
            // Path to record is found:
            list($eTable, $eUid) = explode(':', $elementName);
            $eUid = intval($eUid);
            $rr = t3lib_BEfunc::getRecord($eTable, $eUid);
            $recTitle = t3lib_BEfunc::getRecordTitle($eTable, $rr);
            if ($eTable != 'pages') {
                t3lib_BEfunc::fixVersioningPid($eTable, $rr);
                $eUid = $rr['pid'];
            }
            $path = t3lib_BEfunc::getRecordPath($eUid, '', 20);
            // ALternative messages:
            $TSConfig = $this->getTCEMAIN_TSconfig($eUid);
            $body = trim($TSConfig['notificationEmail_body']) ? trim($TSConfig['notificationEmail_body']) : '
At the TYPO3 site "%s" (%s)
in workspace "%s" (#%s)
the stage has changed for the element(s) "%11$s" (%s) at location "%10$s" in the page tree:

==> %s

User Comment:
"%s"

State was change by %s (username: %s)
			';
            $subject = trim($TSConfig['notificationEmail_subject']) ? trim($TSConfig['notificationEmail_subject']) : 'TYPO3 Workspace Note: Stage Change for %s';
            // Send email:
            if (count($emails)) {
                $message = sprintf($body, $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'], t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir, $workspaceRec['title'], $workspaceRec['uid'], $elementName, $newStage, $comment, $this->BE_USER->user['realName'], $this->BE_USER->user['username'], $path, $recTitle);
                t3lib_div::plainMailEncoded(implode(',', $emails), sprintf($subject, $elementName), trim($message));
                $this->newlog2('Notification email for stage change was sent to "' . implode(', ', $emails) . '"', $table, $id);
            }
        }
    }