本文整理汇总了PHP中t3lib_div::arrayToLogString方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_div::arrayToLogString方法的具体用法?PHP t3lib_div::arrayToLogString怎么用?PHP t3lib_div::arrayToLogString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_div
的用法示例。
在下文中一共展示了t3lib_div::arrayToLogString方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchGroupData
/**
* Will select all fe_groups records that the current fe_user is member of - and which groups are also allowed in the current domain.
* It also accumulates the TSconfig for the fe_user/fe_groups in ->TSdataArray
*
* @return integer Returns the number of usergroups for the frontend users (if the internal user record exists and the usergroup field contains a value)
*/
function fetchGroupData()
{
$this->TSdataArray = array();
$this->userTS = array();
$this->userTSUpdated = 0;
$this->groupData = array('title' => array(), 'uid' => array(), 'pid' => array());
// Setting default configuration:
$this->TSdataArray[] = $GLOBALS['TYPO3_CONF_VARS']['FE']['defaultUserTSconfig'];
// get the info data for auth services
$authInfo = $this->getAuthInfoArray();
if ($this->writeDevLog) {
if (is_array($this->user)) {
t3lib_div::devLog('Get usergroups for user: ' . t3lib_div::arrayToLogString($this->user, array($this->userid_column, $this->username_column)), 'tslib_feUserAuth');
} else {
t3lib_div::devLog('Get usergroups for "anonymous" user', 'tslib_feUserAuth');
}
}
$groupDataArr = array();
// use 'auth' service to find the groups for the user
$serviceChain = '';
$subType = 'getGroups' . $this->loginType;
while (is_object($serviceObj = t3lib_div::makeInstanceService('auth', $subType, $serviceChain))) {
$serviceChain .= ',' . $serviceObj->getServiceKey();
$serviceObj->initAuth($subType, array(), $authInfo, $this);
$groupData = $serviceObj->getGroups($this->user, $groupDataArr);
if (is_array($groupData) && count($groupData)) {
$groupDataArr = t3lib_div::array_merge($groupDataArr, $groupData);
// Keys in $groupData should be unique ids of the groups (like "uid") so this function will override groups.
}
unset($serviceObj);
}
if ($this->writeDevLog and $serviceChain) {
t3lib_div::devLog($subType . ' auth services called: ' . $serviceChain, 'tslib_feUserAuth');
}
if ($this->writeDevLog and !count($groupDataArr)) {
t3lib_div::devLog('No usergroups found by services', 'tslib_feUserAuth');
}
if ($this->writeDevLog and count($groupDataArr)) {
t3lib_div::devLog(count($groupDataArr) . ' usergroup records found by services', 'tslib_feUserAuth');
}
// use 'auth' service to check the usergroups if they are really valid
foreach ($groupDataArr as $groupData) {
// by default a group is valid
$validGroup = TRUE;
$serviceChain = '';
$subType = 'authGroups' . $this->loginType;
while (is_object($serviceObj = t3lib_div::makeInstanceService('auth', $subType, $serviceChain))) {
$serviceChain .= ',' . $serviceObj->getServiceKey();
$serviceObj->initAuth($subType, array(), $authInfo, $this);
if (!$serviceObj->authGroup($this->user, $groupData)) {
$validGroup = FALSE;
if ($this->writeDevLog) {
t3lib_div::devLog($subType . ' auth service did not auth group: ' . t3lib_div::arrayToLogString($groupData, 'uid,title'), 'tslib_feUserAuth', 2);
}
break;
}
unset($serviceObj);
}
unset($serviceObj);
if ($validGroup) {
$this->groupData['title'][$groupData['uid']] = $groupData['title'];
$this->groupData['uid'][$groupData['uid']] = $groupData['uid'];
$this->groupData['pid'][$groupData['uid']] = $groupData['pid'];
$this->groupData['TSconfig'][$groupData['uid']] = $groupData['TSconfig'];
}
}
if (count($this->groupData) && count($this->groupData['TSconfig'])) {
// TSconfig: collect it in the order it was collected
foreach ($this->groupData['TSconfig'] as $TSdata) {
$this->TSdataArray[] = $TSdata;
}
$this->TSdataArray[] = $this->user['TSconfig'];
// Sort information
ksort($this->groupData['title']);
ksort($this->groupData['uid']);
ksort($this->groupData['pid']);
}
return count($this->groupData['uid']) ? count($this->groupData['uid']) : 0;
}
示例2: getUser
/**
* Find a user (eg. look up the user record in database when a login is sent)
*
* @return mixed user array or false
*/
function getUser()
{
$user = false;
if ($this->login['status'] == 'login' && $this->login['uident']) {
$user = $this->fetchUserRecord($this->login['uname']);
if (!is_array($user)) {
// Failed login attempt (no username found)
$this->writelog(255, 3, 3, 2, "Login-attempt from %s (%s), username '%s' not found!!", array($this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $this->login['uname']));
// Logout written to log
t3lib_div::sysLog(sprintf("Login-attempt from %s (%s), username '%s' not found!", $this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $this->login['uname']), 'Core', 0);
} else {
if ($this->writeDevLog) {
t3lib_div::devLog('User found: ' . t3lib_div::arrayToLogString($user, array($this->db_user['userid_column'], $this->db_user['username_column'])), 'tx_sv_auth');
}
}
}
return $user;
}
示例3: start
//.........这里部分代码省略.........
* @return void
*/
function start($V, $base64 = false)
{
$convCharset = FALSE;
// do we need to convert form data?
if ($GLOBALS['TSFE']->config['config']['formMailCharset']) {
// Respect formMailCharset if it was set
$this->charset = $GLOBALS['TSFE']->csConvObj->parse_charset($GLOBALS['TSFE']->config['config']['formMailCharset']);
$convCharset = TRUE;
} elseif ($GLOBALS['TSFE']->metaCharset != $GLOBALS['TSFE']->renderCharset) {
// Use metaCharset for mail if different from renderCharset
$this->charset = $GLOBALS['TSFE']->metaCharset;
$convCharset = TRUE;
}
parent::start();
if ($base64 || $V['use_base64']) {
$this->useBase64();
}
if (isset($V['recipient'])) {
// convert form data from renderCharset to mail charset
$val = $V['subject'] ? $V['subject'] : 'Formmail on ' . t3lib_div::getIndpEnv('HTTP_HOST');
$this->subject = $convCharset && strlen($val) ? $GLOBALS['TSFE']->csConvObj->conv($val, $GLOBALS['TSFE']->renderCharset, $this->charset) : $val;
$this->subject = $this->sanitizeHeaderString($this->subject);
$val = $V['from_name'] ? $V['from_name'] : ($V['name'] ? $V['name'] : '');
// Be careful when changing $val! It is used again as the fallback value for replyto_name
$this->from_name = $convCharset && strlen($val) ? $GLOBALS['TSFE']->csConvObj->conv($val, $GLOBALS['TSFE']->renderCharset, $this->charset) : $val;
$this->from_name = $this->sanitizeHeaderString($this->from_name);
$this->from_name = preg_match('/\\s|,/', $this->from_name) >= 1 ? '"' . $this->from_name . '"' : $this->from_name;
$val = $V['replyto_name'] ? $V['replyto_name'] : $val;
$this->replyto_name = $convCharset && strlen($val) ? $GLOBALS['TSFE']->csConvObj->conv($val, $GLOBALS['TSFE']->renderCharset, $this->charset) : $val;
$this->replyto_name = $this->sanitizeHeaderString($this->replyto_name);
$this->replyto_name = preg_match('/\\s|,/', $this->replyto_name) >= 1 ? '"' . $this->replyto_name . '"' : $this->replyto_name;
$val = $V['organisation'] ? $V['organisation'] : '';
$this->organisation = $convCharset && strlen($val) ? $GLOBALS['TSFE']->csConvObj->conv($val, $GLOBALS['TSFE']->renderCharset, $this->charset) : $val;
$this->organisation = $this->sanitizeHeaderString($this->organisation);
$this->from_email = $V['from_email'] ? $V['from_email'] : ($V['email'] ? $V['email'] : '');
$this->from_email = t3lib_div::validEmail($this->from_email) ? $this->from_email : '';
$this->replyto_email = $V['replyto_email'] ? $V['replyto_email'] : $this->from_email;
$this->replyto_email = t3lib_div::validEmail($this->replyto_email) ? $this->replyto_email : '';
$this->priority = $V['priority'] ? t3lib_div::intInRange($V['priority'], 1, 5) : 3;
// Auto responder.
$this->auto_respond_msg = trim($V['auto_respond_msg']) && $this->from_email ? trim($V['auto_respond_msg']) : '';
$this->auto_respond_msg = $this->sanitizeHeaderString($this->auto_respond_msg);
$Plain_content = '';
$HTML_content = '<table border="0" cellpadding="2" cellspacing="2">';
// Runs through $V and generates the mail
if (is_array($V)) {
foreach ($V as $key => $val) {
if (!t3lib_div::inList($this->reserved_names, $key)) {
$space = strlen($val) > 60 ? LF : '';
$val = is_array($val) ? implode($val, LF) : $val;
// convert form data from renderCharset to mail charset (HTML may use entities)
$Plain_val = $convCharset && strlen($val) ? $GLOBALS['TSFE']->csConvObj->conv($val, $GLOBALS['TSFE']->renderCharset, $this->charset, 0) : $val;
$HTML_val = $convCharset && strlen($val) ? $GLOBALS['TSFE']->csConvObj->conv(htmlspecialchars($val), $GLOBALS['TSFE']->renderCharset, $this->charset, 1) : htmlspecialchars($val);
$Plain_content .= strtoupper($key) . ': ' . $space . $Plain_val . LF . $space;
$HTML_content .= '<tr><td bgcolor="#eeeeee"><font face="Verdana" size="1"><strong>' . strtoupper($key) . '</strong></font></td><td bgcolor="#eeeeee"><font face="Verdana" size="1">' . nl2br($HTML_val) . ' </font></td></tr>';
}
}
}
$HTML_content .= '</table>';
if ($V['html_enabled']) {
$this->setHTML($this->encodeMsg($HTML_content));
}
$this->addPlain($Plain_content);
for ($a = 0; $a < 10; $a++) {
$varname = 'attachment' . ($a ? $a : '');
if (!isset($_FILES[$varname])) {
continue;
}
if (!is_uploaded_file($_FILES[$varname]['tmp_name'])) {
t3lib_div::sysLog('Possible abuse of t3lib_formmail: temporary file "' . $_FILES[$varname]['tmp_name'] . '" ("' . $_FILES[$varname]['name'] . '") was not an uploaded file.', 'Core', 3);
}
if ($_FILES[$varname]['tmp_name']['error'] !== UPLOAD_ERR_OK) {
t3lib_div::sysLog('Error in uploaded file in t3lib_formmail: temporary file "' . $_FILES[$varname]['tmp_name'] . '" ("' . $_FILES[$varname]['name'] . '") Error code: ' . $_FILES[$varname]['tmp_name']['error'], 'Core', 3);
}
$theFile = t3lib_div::upload_to_tempfile($_FILES[$varname]['tmp_name']);
$theName = $_FILES[$varname]['name'];
if ($theFile && file_exists($theFile)) {
if (filesize($theFile) < $GLOBALS['TYPO3_CONF_VARS']['FE']['formmailMaxAttachmentSize']) {
$this->addAttachment($theFile, $theName);
}
}
t3lib_div::unlink_tempfile($theFile);
}
$this->setHeaders();
$this->setContent();
$this->setRecipient($V['recipient']);
if ($V['recipient_copy']) {
$this->recipient_copy = trim($V['recipient_copy']);
}
// log dirty header lines
if ($this->dirtyHeaders) {
t3lib_div::sysLog('Possible misuse of t3lib_formmail: see TYPO3 devLog', 'Core', 3);
if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_DLOG']) {
t3lib_div::devLog('t3lib_formmail: ' . t3lib_div::arrayToLogString($this->dirtyHeaders, '', 200), 'Core', 3);
}
}
}
}
示例4: checkAuthentication
/**
* Checks if a submission of username and password is present or use other authentication by auth services
*
* @return void
* @internal
*/
function checkAuthentication()
{
// No user for now - will be searched by service below
$tempuserArr = array();
$tempuser = FALSE;
// User is not authenticated by default
$authenticated = FALSE;
// User want to login with passed login data (name/password)
$activeLogin = FALSE;
// Indicates if an active authentication failed (not auto login)
$this->loginFailure = FALSE;
if ($this->writeDevLog) {
t3lib_div::devLog('Login type: ' . $this->loginType, 't3lib_userAuth');
}
// The info array provide additional information for auth services
$authInfo = $this->getAuthInfoArray();
// Get Login/Logout data submitted by a form or params
$loginData = $this->getLoginFormData();
if ($this->writeDevLog) {
t3lib_div::devLog('Login data: ' . t3lib_div::arrayToLogString($loginData), 't3lib_userAuth');
}
// active logout (eg. with "logout" button)
if ($loginData['status'] == 'logout') {
if ($this->writeStdLog) {
$this->writelog(255, 2, 0, 2, 'User %s logged out', array($this->user['username']));
}
// Logout written to log
if ($this->writeDevLog) {
t3lib_div::devLog('User logged out. Id: ' . $this->id, 't3lib_userAuth', -1);
}
$this->logoff();
}
// active login (eg. with login form)
if ($loginData['status'] == 'login') {
$activeLogin = TRUE;
if ($this->writeDevLog) {
t3lib_div::devLog('Active login (eg. with login form)', 't3lib_userAuth');
}
// check referer for submitted login values
if ($this->formfield_status && $loginData['uident'] && $loginData['uname']) {
$httpHost = t3lib_div::getIndpEnv('TYPO3_HOST_ONLY');
if (!$this->getMethodEnabled && ($httpHost != $authInfo['refInfo']['host'] && !$GLOBALS['TYPO3_CONF_VARS']['SYS']['doNotCheckReferer'])) {
throw new RuntimeException('TYPO3 Fatal Error: Error: This host address ("' . $httpHost . '") and the referer host ("' . $authInfo['refInfo']['host'] . '") mismatches!<br />
It\'s possible that the environment variable HTTP_REFERER is not passed to the script because of a proxy.<br />
The site administrator can disable this check in the "All Configuration" section of the Install Tool (flag: TYPO3_CONF_VARS[SYS][doNotCheckReferer]).', 1270853930);
}
// delete old user session if any
$this->logoff();
}
// Refuse login for _CLI users, if not processing a CLI request type
// (although we shouldn't be here in case of a CLI request type)
if (strtoupper(substr($loginData['uname'], 0, 5)) == '_CLI_' && !(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI)) {
throw new RuntimeException('TYPO3 Fatal Error: You have tried to login using a CLI user. Access prohibited!', 1270853931);
}
}
// the following code makes auto-login possible (if configured). No submitted data needed
// determine whether we need to skip session update.
// This is used mainly for checking session timeout without
// refreshing the session itself while checking.
if (t3lib_div::_GP('skipSessionUpdate')) {
$skipSessionUpdate = true;
} else {
$skipSessionUpdate = false;
}
// re-read user session
$authInfo['userSession'] = $this->fetchUserSession($skipSessionUpdate);
$haveSession = is_array($authInfo['userSession']) ? TRUE : FALSE;
if ($this->writeDevLog) {
if ($haveSession) {
t3lib_div::devLog('User session found: ' . t3lib_div::arrayToLogString($authInfo['userSession'], array($this->userid_column, $this->username_column)), 't3lib_userAuth', 0);
}
if (is_array($this->svConfig['setup'])) {
t3lib_div::devLog('SV setup: ' . t3lib_div::arrayToLogString($this->svConfig['setup']), 't3lib_userAuth', 0);
}
}
// fetch user if ...
if ($activeLogin || !$haveSession && $this->svConfig['setup'][$this->loginType . '_fetchUserIfNoSession'] || $this->svConfig['setup'][$this->loginType . '_alwaysFetchUser']) {
// use 'auth' service to find the user
// first found user will be used
$serviceChain = '';
$subType = 'getUser' . $this->loginType;
while (is_object($serviceObj = t3lib_div::makeInstanceService('auth', $subType, $serviceChain))) {
$serviceChain .= ',' . $serviceObj->getServiceKey();
$serviceObj->initAuth($subType, $loginData, $authInfo, $this);
if ($row = $serviceObj->getUser()) {
$tempuserArr[] = $row;
if ($this->writeDevLog) {
t3lib_div::devLog('User found: ' . t3lib_div::arrayToLogString($row, array($this->userid_column, $this->username_column)), 't3lib_userAuth', 0);
}
// user found, just stop to search for more if not configured to go on
if (!$this->svConfig['setup'][$this->loginType . '_fetchAllUsers']) {
break;
}
}
//.........这里部分代码省略.........
示例5: encodeView
/**
* Rendering the encode-cache content
*
* @param array The Page tree data
* @return string HTML for the information table.
*/
function encodeView(t3lib_pageTree $tree) {
// Delete entries:
$cmd = t3lib_div::_GP('cmd');
$subcmd = '';
if ($cmd === 'deleteEC') {
$subcmd = t3lib_div::_GP('entry');
$this->clearDEncodeCache($subcmd);
}
// Traverse tree:
$cc = 0;
$countDisplayed = 0;
$output = '';
$duplicates = array();
foreach($tree->tree as $row) {
// Select rows:
$displayRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_realurl_urlencodecache','page_id='.intval($row['row']['uid']),'','content');
// Row title:
$rowTitle = $row['HTML'].t3lib_BEfunc::getRecordTitle('pages',$row['row'],TRUE);
// Add at least one empty element:
if (!count($displayRows) || $subcmd==='displayed') {
// Add title:
$tCells = array();
$tCells[]='<td nowrap="nowrap">'.$rowTitle.'</td>';
$tCells[]='<td nowrap="nowrap"> </td>';
// Empty row:
$tCells[]='<td colspan="7" align="center"> </td>';
// Compile Row:
$output.= '
<tr class="bgColor'.($cc%2 ? '-20':'-10').'">
'.implode('
',$tCells).'
</tr>';
$cc++;
if ($subcmd==='displayed') {
foreach($displayRows as $c => $inf) {
$this->clearDEncodeCache('urlhash_'.$inf['url_hash']);
}
}
} else {
foreach($displayRows as $c => $inf) {
// Add icon/title and ID:
$tCells = array();
if (!$c) {
$tCells[]='<td nowrap="nowrap" rowspan="'.count($displayRows).'">'.$rowTitle.'</td>';
$tCells[]='<td nowrap="nowrap" rowspan="'.count($displayRows).'">'.$row['row']['uid'].'</td>';
$tCells[]='<td rowspan="'.count($displayRows).'">'.
'<a href="'.$this->linkSelf('&cmd=deleteEC&entry=page_'.intval($row['row']['uid'])).'">'.
'<img'.t3lib_iconWorks::skinImg($this->pObj->doc->backPath,'gfx/garbage.gif','width="11" height="12"').' title="Delete entries for page" alt="" />'.
'</a>'.
'</td>';
}
// Get vars:
$tCells[]='<td>'.htmlspecialchars(t3lib_div::fixed_lgd_cs($inf['origparams'], 100)).'</td>';
// Internal Extras:
$tCells[]='<td>'.($inf['internalExtras'] ? t3lib_div::arrayToLogString(unserialize($inf['internalExtras'])) : ' ').'</td>';
// Path:
$tCells[]='<td>'.htmlspecialchars(t3lib_div::fixed_lgd_cs($inf['content'],100)).'</td>';
// Delete:
$tCells[]='<td>'.
'<a href="'.$this->linkSelf('&cmd=deleteEC&entry=urlhash_'.intval($inf['url_hash'])).'">'.
'<img'.t3lib_iconWorks::skinImg($this->pObj->doc->backPath,'gfx/garbage.gif','width="11" height="12"').' title="Delete entry" alt="" />'.
'</a>'.
'</td>';
// Error:
$eMsg = ($duplicates[$inf['content']] && $duplicates[$inf['content']] !== $row['row']['uid'] ? $this->pObj->doc->icons(2).'Already used on page ID '.$duplicates[$inf['content']].'<br/>' : '');
if (count($GLOBALS['TYPO3_DB']->exec_SELECTgetRows('url_hash','tx_realurl_redirects','url_hash='.intval(t3lib_div::md5int($inf['content']))))) {
$eMsg.= $this->pObj->doc->icons(3).'Also a redirect!';
}
$tCells[]='<td>'.$eMsg.'</td>';
// Timestamp:
$tCells[]='<td>'.htmlspecialchars(t3lib_BEfunc::datetime($inf['tstamp'])).' / '.htmlspecialchars(t3lib_BEfunc::calcAge(time()-$inf['tstamp'])).'</td>';
// Compile Row:
$output.= '
<tr class="bgColor'.($cc%2 ? '-20':'-10').'">
'.implode('
',$tCells).'
</tr>';
//.........这里部分代码省略.........
示例6: arrayToLogString
/**
* Converts a one dimensional array to a one line string which can be used for logging or debugging output
* Example: "loginType: FE; refInfo: Array; HTTP_HOST: www.example.org; REMOTE_ADDR: 192.168.1.5; REMOTE_HOST:; security_level:; showHiddenRecords: 0;"
*
* @param array $arr Data array which should be outputted
* @param mixed $valueList List of keys which should be listed in the output string. Pass a comma list or an array. An empty list outputs the whole array.
* @param int $valueLength Long string values are shortened to this length. Default: 20
* @return string Output string with key names and their value as string
*/
public function arrayToLogString(array $arr, $valueList = array(), $valueLength = 20)
{
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::arrayToLogString($arr, $valueLength, $valueLength);
}
示例7: start
//.........这里部分代码省略.........
if ($base64 || $valueList['use_base64']) {
$this->encoding = 'base64';
}
if (isset($valueList['recipient'])) {
// convert form data from renderCharset to mail charset
$this->subject = $valueList['subject'] ? $valueList['subject'] : 'Formmail on ' . t3lib_div::getIndpEnv('HTTP_HOST');
$this->subject = $this->sanitizeHeaderString($this->subject);
$this->fromName = $valueList['from_name'] ? $valueList['from_name'] : ($valueList['name'] ? $valueList['name'] : '');
$this->fromName = $this->sanitizeHeaderString($this->fromName);
$this->replyToName = $valueList['replyto_name'] ? $valueList['replyto_name'] : $this->fromName;
$this->replyToName = $this->sanitizeHeaderString($this->replyToName);
$this->organisation = $valueList['organisation'] ? $valueList['organisation'] : '';
$this->organisation = $this->sanitizeHeaderString($this->organisation);
$this->fromAddress = $valueList['from_email'] ? $valueList['from_email'] : ($valueList['email'] ? $valueList['email'] : '');
if (!t3lib_div::validEmail($this->fromAddress)) {
$this->fromAddress = t3lib_utility_Mail::getSystemFromAddress();
$this->fromName = t3lib_utility_Mail::getSystemFromName();
}
$this->replyToAddress = $valueList['replyto_email'] ? $valueList['replyto_email'] : $this->fromAddress;
$this->priority = $valueList['priority'] ? t3lib_div::intInRange($valueList['priority'], 1, 5) : 3;
// auto responder
$this->autoRespondMessage = trim($valueList['auto_respond_msg']) && $this->fromAddress ? trim($valueList['auto_respond_msg']) : '';
if ($this->autoRespondMessage !== '') {
// Check if the value of the auto responder message has been modified with evil intentions
$autoRespondChecksum = $valueList['auto_respond_checksum'];
$correctHmacChecksum = t3lib_div::hmac($this->autoRespondMessage);
if ($autoRespondChecksum !== $correctHmacChecksum) {
t3lib_div::sysLog('Possible misuse of t3lib_formmail auto respond method. Subject: ' . $valueList['subject'], 'Core', 3);
return;
} else {
$this->autoRespondMessage = $this->sanitizeHeaderString($this->autoRespondMessage);
}
}
$plainTextContent = '';
$htmlContent = '<table border="0" cellpadding="2" cellspacing="2">';
// Runs through $V and generates the mail
if (is_array($valueList)) {
foreach ($valueList as $key => $val) {
if (!t3lib_div::inList($this->reserved_names, $key)) {
$space = strlen($val) > 60 ? LF : '';
$val = is_array($val) ? implode($val, LF) : $val;
// convert form data from renderCharset to mail charset (HTML may use entities)
$plainTextValue = $val;
$HtmlValue = htmlspecialchars($val);
$plainTextContent .= strtoupper($key) . ': ' . $space . $plainTextValue . LF . $space;
$htmlContent .= '<tr><td bgcolor="#eeeeee"><font face="Verdana" size="1"><strong>' . strtoupper($key) . '</strong></font></td><td bgcolor="#eeeeee"><font face="Verdana" size="1">' . nl2br($HtmlValue) . ' </font></td></tr>';
}
}
}
$htmlContent .= '</table>';
$this->plainContent = $plainTextContent;
if ($valueList['html_enabled']) {
$this->mailMessage->setBody($htmlContent, 'text/html');
$this->mailMessage->addPart($plainTextContent, 'text/plain');
} else {
$this->mailMessage->setBody($plainTextContent, 'text/plain');
}
for ($a = 0; $a < 10; $a++) {
$variableName = 'attachment' . ($a ? $a : '');
if (!isset($_FILES[$variableName])) {
continue;
}
if (!is_uploaded_file($_FILES[$variableName]['tmp_name'])) {
t3lib_div::sysLog('Possible abuse of t3lib_formmail: temporary file "' . $_FILES[$variableName]['tmp_name'] . '" ("' . $_FILES[$variableName]['name'] . '") was not an uploaded file.', 'Core', 3);
}
if ($_FILES[$variableName]['tmp_name']['error'] !== UPLOAD_ERR_OK) {
t3lib_div::sysLog('Error in uploaded file in t3lib_formmail: temporary file "' . $_FILES[$variableName]['tmp_name'] . '" ("' . $_FILES[$variableName]['name'] . '") Error code: ' . $_FILES[$variableName]['tmp_name']['error'], 'Core', 3);
}
$theFile = t3lib_div::upload_to_tempfile($_FILES[$variableName]['tmp_name']);
$theName = $_FILES[$variableName]['name'];
if ($theFile && file_exists($theFile)) {
if (filesize($theFile) < $GLOBALS['TYPO3_CONF_VARS']['FE']['formmailMaxAttachmentSize']) {
$this->mailMessage->attach(Swift_Attachment::fromPath($theFile)->setFilename($theName));
}
}
$this->temporaryFiles[] = $theFile;
}
$from = $this->fromName ? array($this->fromAddress => $this->fromName) : array($this->fromAddress);
$this->recipient = $this->parseAddresses($valueList['recipient']);
$this->mailMessage->setSubject($this->subject)->setFrom($from)->setTo($this->recipient)->setPriority($this->priority);
$replyTo = $this->replyToName ? array($this->replyToAddress => $this->replyToName) : array($this->replyToAddress);
$this->mailMessage->addReplyTo($replyTo);
$this->mailMessage->getHeaders()->addTextHeader('Organization', $this->organisation);
if ($valueList['recipient_copy']) {
$this->mailMessage->addCc($this->parseAddresses($valueList['recipient_copy']));
}
if ($this->characterSet) {
$this->mailMessage->setCharset($this->characterSet);
}
// Ignore target encoding. This is handled automatically by Swift Mailer and overriding the defaults
// is not worth the trouble
// log dirty header lines
if ($this->dirtyHeaders) {
t3lib_div::sysLog('Possible misuse of t3lib_formmail: see TYPO3 devLog', 'Core', 3);
if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_DLOG']) {
t3lib_div::devLog('t3lib_formmail: ' . t3lib_div::arrayToLogString($this->dirtyHeaders, '', 200), 'Core', 3);
}
}
}
}
示例8: main
/**
* Find syslog
*
* @return array
*/
function main()
{
global $TYPO3_DB;
// Initialize result array:
$resultArray = array('message' => $this->cli_help['name'] . LF . LF . $this->cli_help['description'], 'headers' => array('listing' => array('', '', 1), 'allDetails' => array('', '', 0)), 'listing' => array(), 'allDetails' => array());
$rows = $TYPO3_DB->exec_SELECTgetRows('*', 'sys_log', 'tstamp>' . ($GLOBALS['EXEC_TIME'] - 25 * 3600));
foreach ($rows as $r) {
$l = unserialize($r['log_data']);
$explained = '#' . $r['uid'] . ' ' . t3lib_BEfunc::datetime($r['tstamp']) . ' USER[' . $r['userid'] . ']: ' . sprintf($r['details'], $l[0], $l[1], $l[2], $l[3], $l[4], $l[5]);
$resultArray['listing'][$r['uid']] = $explained;
$resultArray['allDetails'][$r['uid']] = array($explained, t3lib_div::arrayToLogString($r, 'uid,userid,action,recuid,tablename,recpid,error,tstamp,type,details_nr,IP,event_pid,NEWid,workspace'));
}
return $resultArray;
}
示例9: getAdditionalInformation
/**
* Liefert die im Scheduler gesetzten Optionen.
*
* @param string $info
* @return string Information to display
*/
public function getAdditionalInformation($info = '')
{
$info .= CRLF . ' Options: ';
$info .= t3lib_div::arrayToLogString($this->getOptions(), array(), 64);
return $info;
}
示例10: _submitContentAsDefaultLanguageAndGetFlexFormDiff
/**
* Submit incoming content as default language to database. Must match what is available in $accum.
*
* @param array $accum Translation configuration
* @param array $inputArray Array with incoming translation. Must match what is found in $accum
* @return mixed False if error - else flexFormDiffArray (if $inputArray was an array and processing was performed.)
*/
function _submitContentAsDefaultLanguageAndGetFlexFormDiff($accum, $inputArray)
{
if (is_array($inputArray)) {
// Initialize:
/** @var $flexToolObj t3lib_flexformtools */
$flexToolObj = t3lib_div::makeInstance('t3lib_flexformtools');
$TCEmain_data = array();
$_flexFormDiffArray = array();
// Traverse:
foreach ($accum as $pId => $page) {
foreach ($accum[$pId]['items'] as $table => $elements) {
foreach ($elements as $elementUid => $data) {
if (is_array($data['fields'])) {
foreach ($data['fields'] as $key => $tData) {
if (is_array($tData) && isset($inputArray[$table][$elementUid][$key])) {
list($Ttable, $TuidString, $Tfield, $Tpath) = explode(':', $key);
list($Tuid, $Tlang, $TdefRecord) = explode('/', $TuidString);
if (!$this->createTranslationAlsoIfEmpty && $inputArray[$table][$elementUid][$key] == '' && $Tuid == 'NEW') {
//if data is empty do not save it
unset($inputArray[$table][$elementUid][$key]);
continue;
}
#t3lib_div::debug($elementUid);
// If FlexForm, we set value in special way:
if ($Tpath) {
if (!is_array($TCEmain_data[$Ttable][$elementUid][$Tfield])) {
$TCEmain_data[$Ttable][$elementUid][$Tfield] = array();
}
//TCEMAINDATA is passed as reference here:
$flexToolObj->setArrayValueByPath($Tpath, $TCEmain_data[$Ttable][$elementUid][$Tfield], $inputArray[$table][$elementUid][$key]);
$_flexFormDiffArray[$key] = array('translated' => $inputArray[$table][$elementUid][$key], 'default' => $tData['defaultValue']);
} else {
$TCEmain_data[$Ttable][$elementUid][$Tfield] = $inputArray[$table][$elementUid][$key];
}
unset($inputArray[$table][$elementUid][$key]);
// Unsetting so in the end we can see if $inputArray was fully processed.
} else {
//debug($tData,'fields not set for: '.$elementUid.'-'.$key);
//debug($inputArray[$table],'inputarray');
}
}
if (is_array($inputArray[$table][$elementUid]) && !count($inputArray[$table][$elementUid])) {
unset($inputArray[$table][$elementUid]);
// Unsetting so in the end we can see if $inputArray was fully processed.
}
}
}
if (is_array($inputArray[$table]) && !count($inputArray[$table])) {
unset($inputArray[$table]);
// Unsetting so in the end we can see if $inputArray was fully processed.
}
}
}
if ($TCEmain_data['pages_language_overlay']) {
$TCEmain_data['pages'] = $TCEmain_data['pages_language_overlay'];
unset($TCEmain_data['pages_language_overlay']);
}
#t3lib_div::debug($TCEmain_data);
//var_dump($TCEmain_data);
$this->lastTCEMAINCommandsCount = 0;
// Now, submitting translation data:
$tce = t3lib_div::makeInstance('t3lib_TCEmain');
$tce->stripslashes_values = FALSE;
$tce->dontProcessTransformations = TRUE;
$tce->start($TCEmain_data, array());
// check has been done previously that there is a backend user which is Admin and also in live workspace
$tce->process_datamap();
if (count($tce->errorLog)) {
t3lib_div::sysLog(__FILE__ . ': ' . __LINE__ . ': TCEmain update errors: ' . t3lib_div::arrayToLogString($tce->errorLog), 'l10nmgr');
}
if (count($tce->autoVersionIdMap) && count($_flexFormDiffArray)) {
foreach ($_flexFormDiffArray as $key => $value) {
list($Ttable, $Tuid, $Trest) = explode(':', $key, 3);
if ($tce->autoVersionIdMap[$Ttable][$Tuid]) {
$_flexFormDiffArray[$Ttable . ':' . $tce->autoVersionIdMap[$Ttable][$Tuid] . ':' . $Trest] = $_flexFormDiffArray[$key];
unset($_flexFormDiffArray[$key]);
}
}
}
// Should be empty now - or there were more information in the incoming array than there should be!
if (count($inputArray)) {
debug($inputArray, 'These fields were ignored since they were not in the configuration:');
}
return $_flexFormDiffArray;
} else {
return FALSE;
}
}
示例11: processStoreControl
/**
* Processing of the storage command LOAD, SAVE, REMOVE
*
* @param string Name of the module to store the settings for. Default: $GLOBALS['SOBE']->MCONF['name'] (current module)
* @return string Storage message. Also set in $this->msg
*/
function processStoreControl($mconfName = '')
{
$this->initStorage();
$storeControl = t3lib_div::_GP('storeControl');
$storeIndex = $storeControl['STORE'];
$msg = '';
$saveSettings = FALSE;
$writeArray = array();
if (is_array($storeControl)) {
if ($this->writeDevLog) {
t3lib_div::devLog('Store command: ' . t3lib_div::arrayToLogString($storeControl), 't3lib_modSettings', 0);
}
//
// processing LOAD
//
if ($storeControl['LOAD'] and $storeIndex) {
$writeArray = $this->getStoredData($storeIndex, $writeArray);
$saveSettings = TRUE;
$msg = "'" . $this->storedSettings[$storeIndex]['title'] . "' preset loaded!";
//
// processing SAVE
//
} elseif ($storeControl['SAVE']) {
if (trim($storeControl['title'])) {
// get the data to store
$newEntry = $this->compileEntry($storeControl);
// create an index for the storage array
if (!$storeIndex) {
$storeIndex = t3lib_div::shortMD5($newEntry['title']);
}
// add data to the storage array
$this->storedSettings[$storeIndex] = $newEntry;
$saveSettings = TRUE;
$msg = "'" . $newEntry['title'] . "' preset saved!";
} else {
$msg = 'Please enter a name for the preset!';
}
//
// processing REMOVE
//
} elseif ($storeControl['REMOVE'] and $storeIndex) {
// Removing entry
$msg = "'" . $this->storedSettings[$storeIndex]['title'] . "' preset entry removed!";
unset($this->storedSettings[$storeIndex]);
$saveSettings = TRUE;
}
$this->msg = $msg;
if ($saveSettings) {
$this->writeStoredSetting($writeArray, $mconfName);
}
}
return $this->msg;
}
示例12: renderOverview
/**
* Render the module content in HTML
*
* @param array Translation data for configuration
* @param integer Sys language uid
* @param array Configuration record
* @return string HTML content
*/
function renderOverview()
{
global $LANG;
$sysLang = $this->sysLang;
$accumObj = $this->l10ncfgObj->getL10nAccumulatedInformationsObjectForLanguage($sysLang);
$accum = $accumObj->getInfoArray();
$l10ncfg = $this->l10ncfg;
$output = '';
$showSingle = t3lib_div::_GET('showSingle');
if ($l10ncfg['displaymode'] > 0) {
$showSingle = $showSingle ? $showSingle : 'NONE';
if ($l10ncfg['displaymode'] == 2) {
$noAnalysis = TRUE;
}
} else {
$noAnalysis = FALSE;
}
// Traverse the structure and generate HTML output:
foreach ($accum as $pId => $page) {
$output .= '<h3>' . $page['header']['icon'] . htmlspecialchars($page['header']['title']) . ' [' . $pId . ']</h3>';
$tableRows = array();
foreach ($accum[$pId]['items'] as $table => $elements) {
foreach ($elements as $elementUid => $data) {
if (is_array($data['fields'])) {
$FtableRows = array();
$flags = array();
if (!$noAnalysis || $showSingle === $table . ':' . $elementUid) {
foreach ($data['fields'] as $key => $tData) {
if (is_array($tData)) {
list(, $uidString, $fieldName) = explode(':', $key);
list($uidValue) = explode('/', $uidString);
$diff = '';
$edit = TRUE;
$noChangeFlag = !strcmp(trim($tData['diffDefaultValue']), trim($tData['defaultValue']));
if ($uidValue === 'NEW') {
$diff = '<em>' . $LANG->getLL('render_overview.new.message') . '</em>';
$flags['new']++;
} elseif (!isset($tData['diffDefaultValue'])) {
$diff = '<em>' . $LANG->getLL('render_overview.nodiff.message') . '</em>';
$flags['unknown']++;
} elseif ($noChangeFlag) {
$diff = $LANG->getLL('render_overview.nochange.message');
$edit = TRUE;
$flags['noChange']++;
} else {
$diff = $this->diffCMP($tData['diffDefaultValue'], $tData['defaultValue']);
$flags['update']++;
}
if (!$this->modeOnlyChanged || !$noChangeFlag) {
$fieldCells = array();
$fieldCells[] = '<b>' . htmlspecialchars($fieldName) . '</b>' . ($tData['msg'] ? '<br/><em>' . htmlspecialchars($tData['msg']) . '</em>' : '');
$fieldCells[] = nl2br(htmlspecialchars($tData['defaultValue']));
$fieldCells[] = $edit && $this->modeWithInlineEdit ? $tData['fieldType'] === 'text' ? '<textarea name="' . htmlspecialchars('translation[' . $table . '][' . $elementUid . '][' . $key . ']') . '" cols="60" rows="5">' . t3lib_div::formatForTextarea($tData['translationValue']) . '</textarea>' : '<input name="' . htmlspecialchars('translation[' . $table . '][' . $elementUid . '][' . $key . ']') . '" value="' . htmlspecialchars($tData['translationValue']) . '" size="60" />' : nl2br(htmlspecialchars($tData['translationValue']));
$fieldCells[] = $diff;
if ($page['header']['prevLang']) {
reset($tData['previewLanguageValues']);
$fieldCells[] = nl2br(htmlspecialchars(current($tData['previewLanguageValues'])));
}
$FtableRows[] = '<tr class="db_list_normal"><td>' . implode('</td><td>', $fieldCells) . '</td></tr>';
}
}
}
}
if (count($FtableRows) || $noAnalysis) {
// Link:
if ($this->modeShowEditLinks) {
reset($data['fields']);
list(, $uidString) = explode(':', key($data['fields']));
if (substr($uidString, 0, 3) !== 'NEW') {
$editId = is_array($data['translationInfo']['translations'][$sysLang]) ? $data['translationInfo']['translations'][$sysLang]['uid'] : $data['translationInfo']['uid'];
$editLink = ' - <a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[' . $data['translationInfo']['translation_table'] . '][' . $editId . ']=edit', $this->doc->backPath)) . '"><em>[' . $LANG->getLL('render_overview.clickedit.message') . ']</em></a>';
} else {
$editLink = ' - <a href="' . htmlspecialchars($this->doc->issueCommand('&cmd[' . $table . '][' . $data['translationInfo']['uid'] . '][localize]=' . $sysLang)) . '"><em>[' . $LANG->getLL('render_overview.clicklocalize.message') . ']</em></a>';
}
} else {
$editLink = '';
}
$tableRows[] = '<tr class="t3-row-header">
<td colspan="2" style="width:300px;"><a href="' . htmlspecialchars('index.php?id=' . t3lib_div::_GET('id') . '&showSingle=' . rawurlencode($table . ':' . $elementUid)) . '">' . htmlspecialchars($table . ':' . $elementUid) . '</a>' . $editLink . '</td>
<td colspan="3" style="width:200px;">' . htmlspecialchars(t3lib_div::arrayToLogString($flags)) . '</td>
</tr>';
if (!$showSingle || $showSingle === $table . ':' . $elementUid) {
$tableRows[] = '<tr class="bgColor-20 tableheader">
<td>Fieldname:</td>
<td width="25%">Default:</td>
<td width="25%">Translation:</td>
<td width="25%">Diff:</td>
' . ($page['header']['prevLang'] ? '<td width="25%">PrevLang:</td>' : '') . '
</tr>';
$tableRows = array_merge($tableRows, $FtableRows);
}
}
//.........这里部分代码省略.........
示例13: processStoreControl
/**
* Processing of the storage command LOAD, SAVE, REMOVE
*
* @param string Name of the module to store the settings for. Default: $GLOBALS['SOBE']->MCONF['name'] (current module)
* @return string Storage message. Also set in $this->msg
*/
function processStoreControl()
{
$this->initStorage();
$storeControl = t3lib_div::_GP('selStoreControl');
$storeIndex = $storeControl['STORE'];
if ($this->writeDevLog) {
t3lib_div::devLog('Store command: ' . (is_array($storeControl) ? t3lib_div::arrayToLogString($storeControl) : $storeControl), 'tx_dam_selStorage', 0);
}
$msg = '';
$saveSettings = FALSE;
$writeArray = array();
if (is_array($storeControl)) {
//
// processing LOAD
//
if ($storeControl['LOAD'] and $storeIndex) {
$GLOBALS['SOBE']->selection->sl->setFromSerialized($this->storedSettings[$storeIndex]['definition']);
$msg = "'" . $this->storedSettings[$storeIndex]['title'] . "' preset loaded!";
//
// processing SAVE
//
} elseif ($storeControl['SAVE']) {
if (trim($storeControl['title'])) {
// get the data to store
$newEntry = $this->compileEntry($storeControl);
$GLOBALS['TYPO3_DB']->exec_INSERTquery($this->table, $newEntry);
$this->initStorage();
if ($this->writeDevLog) {
t3lib_div::devLog('Settings stored:' . $this->msg, 'tx_dam_selStorage', 0);
}
$msg = "'" . $newEntry['title'] . "' preset saved!";
} else {
$msg = 'Please enter a name for the preset!';
}
//
// processing REMOVE
//
} elseif ($storeControl['REMOVE'] and $storeIndex) {
// Removing entry
$msg = "'" . $this->storedSettings[$storeIndex]['title'] . "' preset entry removed!";
$GLOBALS['TYPO3_DB']->exec_DELETEquery($this->table, 'uid=' . $storeIndex);
}
$this->msg = $msg;
}
return $this->msg;
}
示例14: _submitContentAndGetFlexFormDiff
/**
* Submit incoming content to database. Must match what is available in $accum.
*
* @param array $accum Translation configuration
* @param array $inputArray Array with incoming translation. Must match what is found in $accum
* @return mixed False if error - else flexFormDiffArray (if $inputArray was an array and processing was performed.)
*/
function _submitContentAndGetFlexFormDiff($accum, $inputArray)
{
//CLI $accum and $inputArray OK!
//print "<pre>";
//print_r($accum);
//print_r($inputArray);
//print "</pre>";
if (is_array($inputArray)) {
// Initialize:
/** @var $flexToolObj t3lib_flexformtools */
$flexToolObj = t3lib_div::makeInstance('t3lib_flexformtools');
$TCEmain_data = array();
$TCEmain_cmd = array();
$_flexFormDiffArray = array();
// Traverse:
foreach ($accum as $pId => $page) {
foreach ($accum[$pId]['items'] as $table => $elements) {
foreach ($elements as $elementUid => $data) {
if (is_array($data['fields'])) {
foreach ($data['fields'] as $key => $tData) {
if (is_array($tData) && isset($inputArray[$table][$elementUid][$key])) {
list($Ttable, $TuidString, $Tfield, $Tpath) = explode(':', $key);
list($Tuid, $Tlang, $TdefRecord) = explode('/', $TuidString);
if (!$this->createTranslationAlsoIfEmpty && $inputArray[$table][$elementUid][$key] == '' && $Tuid == 'NEW') {
//if data is empty do not save it
unset($inputArray[$table][$elementUid][$key]);
continue;
}
// If new element is required, we prepare for localization
if ($Tuid === 'NEW') {
//print "\nNEW\n";
$TCEmain_cmd[$table][$elementUid]['localize'] = $Tlang;
}
// If FlexForm, we set value in special way:
if ($Tpath) {
if (!is_array($TCEmain_data[$Ttable][$TuidString][$Tfield])) {
$TCEmain_data[$Ttable][$TuidString][$Tfield] = array();
}
//TCEMAINDATA is passed as reference here:
$flexToolObj->setArrayValueByPath($Tpath, $TCEmain_data[$Ttable][$TuidString][$Tfield], $inputArray[$table][$elementUid][$key]);
$_flexFormDiffArray[$key] = array('translated' => $inputArray[$table][$elementUid][$key], 'default' => $tData['defaultValue']);
} else {
$TCEmain_data[$Ttable][$TuidString][$Tfield] = $inputArray[$table][$elementUid][$key];
}
unset($inputArray[$table][$elementUid][$key]);
// Unsetting so in the end we can see if $inputArray was fully processed.
} else {
//debug($tData,'fields not set for: '.$elementUid.'-'.$key);
//debug($inputArray[$table],'inputarray');
}
}
if (is_array($inputArray[$table][$elementUid]) && !count($inputArray[$table][$elementUid])) {
unset($inputArray[$table][$elementUid]);
// Unsetting so in the end we can see if $inputArray was fully processed.
}
}
}
if (is_array($inputArray[$table]) && !count($inputArray[$table])) {
unset($inputArray[$table]);
// Unsetting so in the end we can see if $inputArray was fully processed.
}
}
}
//debug($TCEmain_cmd,'$TCEmain_cmd');
//debug($TCEmain_data,'$TCEmain_data');
// Execute CMD array: Localizing records:
/** @var $tce t3lib_TCEmain */
$tce = t3lib_div::makeInstance('t3lib_TCEmain');
if ($this->extensionConfiguration['enable_neverHideAtCopy'] == 1) {
$tce->neverHideAtCopy = TRUE;
}
$tce->stripslashes_values = FALSE;
if (count($TCEmain_cmd)) {
$tce->start(array(), $TCEmain_cmd);
$tce->process_cmdmap();
if (count($tce->errorLog)) {
debug($tce->errorLog, 'TCEmain localization errors:');
}
}
// Before remapping
if (TYPO3_DLOG) {
t3lib_div::sysLog(__FILE__ . ': ' . __LINE__ . ': TCEmain_data before remapping: ' . t3lib_div::arrayToLogString($TCEmain_data), 'l10nmgr');
}
// Remapping those elements which are new:
$this->lastTCEMAINCommandsCount = 0;
foreach ($TCEmain_data as $table => $items) {
foreach ($TCEmain_data[$table] as $TuidString => $fields) {
list($Tuid, $Tlang, $TdefRecord) = explode('/', $TuidString);
$this->lastTCEMAINCommandsCount++;
if ($Tuid === 'NEW') {
if ($tce->copyMappingArray_merged[$table][$TdefRecord]) {
$TCEmain_data[$table][t3lib_BEfunc::wsMapId($table, $tce->copyMappingArray_merged[$table][$TdefRecord])] = $fields;
} else {
//.........这里部分代码省略.........