本文整理汇总了PHP中t3lib_BEfunc::getRecordsByField方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_BEfunc::getRecordsByField方法的具体用法?PHP t3lib_BEfunc::getRecordsByField怎么用?PHP t3lib_BEfunc::getRecordsByField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_BEfunc
的用法示例。
在下文中一共展示了t3lib_BEfunc::getRecordsByField方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLangModes
/**
* Check all "root" sys_templates and try to find the value for config.sys_language_mode
*/
public function getLangModes()
{
$message = '';
$checked = array('ok' => array(), 'fail' => array());
$value = $GLOBALS['LANG']->sL('LLL:EXT:languagevisibility/locallang_db.xml:reports.ok.value');
$severity = tx_reports_reports_status_Status::OK;
$rootTpls = t3lib_BEfunc::getRecordsByField('sys_template', 'root', '1', '', 'pid');
foreach ($rootTpls as $tpl) {
/**
* @var t3lib_tsparser_ext
*/
$tmpl = t3lib_div::makeInstance("t3lib_tsparser_ext");
$tmpl->tt_track = 0;
$tmpl->init();
// Gets the rootLine
$sys_page = t3lib_div::makeInstance("t3lib_pageSelect");
$rootLine = $sys_page->getRootLine($tpl['pid']);
$tmpl->runThroughTemplates($rootLine, $tpl['uid']);
$tplRow = $tmpl->ext_getFirstTemplate($tpl['pid'], $tpl['uid']);
$tmpl->generateConfig();
if (!isset($tmpl->setup['config.']['sys_language_mode']) || $tmpl->setup['config.']['sys_language_mode'] != 'ignore') {
$checked['fail'][] = array($tpl['pid'], $tpl['uid'], $tmpl->setup['config.']['sys_language_mode']);
}
}
if (count($checked['fail'])) {
$severity = tx_reports_reports_status_Status::WARNING;
$value = $GLOBALS['LANG']->sL('LLL:EXT:languagevisibility/locallang_db.xml:reports.fail.value');
$message .= $GLOBALS['LANG']->sL('LLL:EXT:languagevisibility/locallang_db.xml:reports.fail.message') . '<br/>';
foreach ($checked['fail'] as $fail) {
$message .= vsprintf($GLOBALS['LANG']->sL('LLL:EXT:languagevisibility/locallang_db.xml:reports.fail.message.detail'), $fail) . '<br />';
}
}
return t3lib_div::makeInstance('tx_reports_reports_status_Status', 'EXT:languagevisibility config.sys_language_mode', $value, $message, $severity);
}
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:37,代码来源:class.tx_languagevisibility_reports_ConfigurationStatus.php
示例2: getAllSubPages
/**
* @param integer $uid
* @return array
*/
protected function getAllSubPages($uid) {
$completeRecords = t3lib_BEfunc::getRecordsByField('pages', 'pid', $uid);
$return = array($uid);
if (count($completeRecords) > 0) {
foreach ($completeRecords as $record) {
$return = array_merge($return, $this->getAllSubPages($record['uid']));
}
}
return $return;
}
开发者ID:rafu1987,项目名称:t3bootstrap-project,代码行数:14,代码来源:class.tx_templavoila_renamefieldinpageflexwizard.php
示例3: getRootLineUpwards
/**
* Gets rootline of a table downwards
*
* @param string $theTable: Database table
* @param string $parentField: Database field to check with third parameter
* @param mixed $uids: Uids of (different) parents
* @return string An rootline array
*
*/
public static function getRootLineUpwards($theTable, $parentField, $uids)
{
if (!is_array($uids)) {
$uids = tx_cpsdevlib_div::explode($uids);
}
$rootLine = array();
foreach ($uids as $uid) {
$result = t3lib_BEfunc::getRecordsByField($theTable, 'uid', $uid);
$rL = array();
if (count($result)) {
$rL = self::getRootLineUpwards($theTable, $parentField, $result[0][$parentField]);
}
$rootLine[$uid] = $rL;
}
return $rootLine;
}
示例4: menuConfig
/**
* Adds items to the ->MOD_MENU array. Used for the function menu selector.
*
* @return void
*/
function menuConfig()
{
global $LANG;
$this->MOD_MENU = array('users' => array('-1' => $LANG->getLL('loggedInUsers'), '0' => $LANG->getLL('notLoggedIn'), '' => '------------------------------'), 'mode' => array('-1' => $LANG->getLL('allTime'), '1' => $LANG->getLL('byTime')));
foreach (t3lib_BEfunc::getRecordsByField('fe_users', 1, 1) as $user) {
$this->MOD_MENU['users'][$user['uid']] = $user['username'];
}
parent::menuConfig();
$set = t3lib_div::_GP('SET');
if ($set['time']) {
$dateFrom = strtotime($set['time']['from']);
$dateTo = strtotime($set['time']['to']);
$set['time']['from'] = $dateFrom > 0 ? date('d.m.Y', $dateFrom) : '';
$set['time']['to'] = $dateTo > 0 ? date('d.m.Y', $dateTo) : '';
$mergedSettings = t3lib_div::array_merge($this->MOD_SETTINGS, $set);
$GLOBALS['BE_USER']->pushModuleData($this->MCONF['name'], $mergedSettings);
$this->MOD_SETTINGS = $mergedSettings;
}
}
示例5: addLocalizedPagesToCache
/**
* add localized page records to a cache/globalArray
* This is much faster than requesting the DB for each tt_content-record
*
* @param array $pageRow
* @return void
*/
public function addLocalizedPagesToCache($pageRow)
{
// create entry in cachedPageRecods for default language
$this->cachedPageRecords[0][$pageRow['uid']] = $pageRow;
// create entry in cachedPageRecods for additional languages, skip default language 0
foreach ($this->sysLanguages as $sysLang) {
if ($sysLang[1] > 0) {
if (TYPO3_VERSION_INTEGER >= 7000000) {
list($pageOverlay) = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('pages_language_overlay', 'pid', $pageRow['uid'], 'AND sys_language_uid=' . intval($sysLang[1]));
} else {
list($pageOverlay) = t3lib_BEfunc::getRecordsByField('pages_language_overlay', 'pid', $pageRow['uid'], 'AND sys_language_uid=' . intval($sysLang[1]));
}
if ($pageOverlay) {
if (TYPO3_VERSION_INTEGER >= 7000000) {
$this->cachedPageRecords[$sysLang[1]][$pageRow['uid']] = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge($pageRow, $pageOverlay);
} else {
$this->cachedPageRecords[$sysLang[1]][$pageRow['uid']] = t3lib_div::array_merge($pageRow, $pageOverlay);
}
}
}
}
}
示例6: deleteL10nOverlayRecords
/**
* Find l10n-overlay records and perform the requested delete action for these records.
*
* @param string $table: Record Table
* @param string $uid: Record UID
* @return void
*/
function deleteL10nOverlayRecords($table, $uid)
{
// Check whether table can be localized or has a different table defined to store localizations:
if (!t3lib_BEfunc::isTableLocalizable($table) || !empty($GLOBALS['TCA'][$table]['ctrl']['transForeignTable']) || !empty($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'])) {
return;
}
$where = '';
if (isset($GLOBALS['TCA'][$table]['ctrl']['versioningWS'])) {
$where = ' AND t3ver_oid=0';
}
$l10nRecords = t3lib_BEfunc::getRecordsByField($table, $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'], $uid, $where);
if (is_array($l10nRecords)) {
foreach ($l10nRecords as $record) {
$this->deleteAction($table, intval($record['t3ver_oid']) > 0 ? intval($record['t3ver_oid']) : intval($record['uid']));
}
}
}
示例7: renderQuickEdit
/**
* Rendering the quick-edit view.
*
* @return void
*/
function renderQuickEdit()
{
global $LANG, $BE_USER, $BACK_PATH;
// Alternative template
$this->doc->setModuleTemplate('templates/db_layout_quickedit.html');
// Alternative form tag; Quick Edit submits its content to tce_db.php.
$this->doc->form = '<form action="' . htmlspecialchars($BACK_PATH . 'tce_db.php?&prErr=1&uPT=1') . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">';
// Setting up the context sensitive menu:
$this->doc->getContextMenuCode();
// Set the edit_record value for internal use in this function:
$edit_record = $this->edit_record;
// If a command to edit all records in a column is issue, then select all those elements, and redirect to alt_doc.php:
if (substr($edit_record, 0, 9) == '_EDIT_COL') {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'pid=' . intval($this->id) . ' AND colPos=' . intval(substr($edit_record, 10)) . ' AND sys_language_uid=' . intval($this->current_sys_language) . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : t3lib_BEfunc::BEenableFields('tt_content')) . t3lib_BEfunc::deleteClause('tt_content') . t3lib_BEfunc::versioningPlaceholderClause('tt_content'), '', 'sorting');
$idListA = array();
while ($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$idListA[] = $cRow['uid'];
}
$url = $BACK_PATH . 'alt_doc.php?edit[tt_content][' . implode(',', $idListA) . ']=edit&returnUrl=' . rawurlencode($this->local_linkThisScript(array('edit_record' => '')));
t3lib_utility_Http::redirect($url);
}
// If the former record edited was the creation of a NEW record, this will look up the created records uid:
if ($this->new_unique_uid) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_log', 'userid=' . intval($BE_USER->user['uid']) . ' AND NEWid=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->new_unique_uid, 'sys_log'));
$sys_log_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
if (is_array($sys_log_row)) {
$edit_record = $sys_log_row['tablename'] . ':' . $sys_log_row['recuid'];
}
}
// Creating the selector box, allowing the user to select which element to edit:
$opt = array();
$is_selected = 0;
$languageOverlayRecord = '';
if ($this->current_sys_language) {
list($languageOverlayRecord) = t3lib_BEfunc::getRecordsByField('pages_language_overlay', 'pid', $this->id, 'AND sys_language_uid=' . intval($this->current_sys_language));
}
if (is_array($languageOverlayRecord)) {
$inValue = 'pages_language_overlay:' . $languageOverlayRecord['uid'];
$is_selected += intval($edit_record == $inValue);
$opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $LANG->getLL('editLanguageHeader', 1) . ' ]</option>';
} else {
$inValue = 'pages:' . $this->id;
$is_selected += intval($edit_record == $inValue);
$opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $LANG->getLL('editPageProperties', 1) . ' ]</option>';
}
// Selecting all content elements from this language and allowed colPos:
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'pid=' . intval($this->id) . ' AND sys_language_uid=' . intval($this->current_sys_language) . ' AND colPos IN (' . $this->colPosList . ')' . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : t3lib_BEfunc::BEenableFields('tt_content')) . t3lib_Befunc::deleteClause('tt_content') . t3lib_BEfunc::versioningPlaceholderClause('tt_content'), '', 'colPos,sorting');
$colPos = '';
$first = 1;
$prev = $this->id;
// Page is the pid if no record to put this after.
while ($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
t3lib_BEfunc::workspaceOL('tt_content', $cRow);
if (is_array($cRow)) {
if ($first) {
if (!$edit_record) {
$edit_record = 'tt_content:' . $cRow['uid'];
}
$first = 0;
}
if (strcmp($cRow['colPos'], $colPos)) {
$colPos = $cRow['colPos'];
$opt[] = '<option value=""></option>';
$opt[] = '<option value="_EDIT_COL:' . $colPos . '">__' . $LANG->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'colPos', $colPos), 1) . ':__</option>';
}
$inValue = 'tt_content:' . $cRow['uid'];
$is_selected += intval($edit_record == $inValue);
$opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>' . htmlspecialchars(t3lib_div::fixed_lgd_cs($cRow['header'] ? $cRow['header'] : '[' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.no_title') . '] ' . strip_tags($cRow['bodytext']), $BE_USER->uc['titleLen'])) . '</option>';
$prev = -$cRow['uid'];
}
}
// If edit_record is not set (meaning, no content elements was found for this language) we simply set it to create a new element:
if (!$edit_record) {
$edit_record = 'tt_content:new/' . $prev . '/' . $colPos;
$inValue = 'tt_content:new/' . $prev . '/' . $colPos;
$is_selected += intval($edit_record == $inValue);
$opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $LANG->getLL('newLabel', 1) . ' ]</option>';
}
// If none is yet selected...
if (!$is_selected) {
$opt[] = '<option value=""></option>';
$opt[] = '<option value="' . $edit_record . '" selected="selected">[ ' . $LANG->getLL('newLabel', 1) . ' ]</option>';
}
// Splitting the edit-record cmd value into table/uid:
$this->eRParts = explode(':', $edit_record);
// Delete-button flag?
$this->deleteButton = t3lib_div::testInt($this->eRParts[1]) && $edit_record && ($this->eRParts[0] != 'pages' && $this->EDIT_CONTENT || $this->eRParts[0] == 'pages' && $this->CALC_PERMS & 4);
// If undo-button should be rendered (depends on available items in sys_history)
$this->undoButton = 0;
$undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->eRParts[0], 'sys_history') . ' AND recuid=' . intval($this->eRParts[1]), '', 'tstamp DESC', '1');
if ($this->undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) {
$this->undoButton = 1;
}
// Setting up the Return URL for coming back to THIS script (if links take the user to another script)
$R_URL_parts = parse_url(t3lib_div::getIndpEnv('REQUEST_URI'));
//.........这里部分代码省略.........
示例8: isCrawlerUserNotAdmin
/**
* Indicate that the required be_user "_cli_crawler" is
* has no admin rights.
*
* @access protected
* @return boolean
*
* @author Michael Klapper <michael.klapper@aoemedia.de>
*/
protected function isCrawlerUserNotAdmin()
{
$isAvailable = false;
$userArray = t3lib_BEfunc::getRecordsByField('be_users', 'username', '_cli_crawler');
if (is_array($userArray) && $userArray[0]['admin'] == 0) {
$isAvailable = true;
}
return $isAvailable;
}
示例9: parseCurUrl
/**
* For RTE/link: Parses the incoming URL and determines if it's a page, file, external or mail address.
*
* @param string HREF value tp analyse
* @param string The URL of the current website (frontend)
* @return array Array with URL information stored in assoc. keys: value, act (page, file, spec, mail), pageid, cElement, info
*/
function parseCurUrl($href, $siteUrl)
{
$href = trim($href);
if ($href) {
$info = array();
// Default is "url":
$info['value'] = $href;
$info['act'] = 'url';
$specialParts = explode('#_SPECIAL', $href);
if (count($specialParts) == 2) {
// Special kind (Something RTE specific: User configurable links through: "userLinks." from ->thisConfig)
$info['value'] = '#_SPECIAL' . $specialParts[1];
$info['act'] = 'spec';
} elseif (t3lib_div::isFirstPartOfStr($href, $siteUrl)) {
// If URL is on the current frontend website:
$rel = substr($href, strlen($siteUrl));
if (file_exists(PATH_site . rawurldecode($rel))) {
// URL is a file, which exists:
$info['value'] = rawurldecode($rel);
if (@is_dir(PATH_site . $info['value'])) {
$info['act'] = 'folder';
} else {
$info['act'] = 'file';
}
} else {
// URL is a page (id parameter)
$uP = parse_url($rel);
if (!trim($uP['path'])) {
$pp = preg_split('/^id=/', $uP['query']);
$pp[1] = preg_replace('/&id=[^&]*/', '', $pp[1]);
$parameters = explode('&', $pp[1]);
$id = array_shift($parameters);
if ($id) {
// Checking if the id-parameter is an alias.
if (!t3lib_div::testInt($id)) {
list($idPartR) = t3lib_BEfunc::getRecordsByField('pages', 'alias', $id);
$id = intval($idPartR['uid']);
}
$pageRow = t3lib_BEfunc::getRecordWSOL('pages', $id);
$titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']);
$info['value'] = $GLOBALS['LANG']->getLL('page', 1) . " '" . htmlspecialchars(t3lib_div::fixed_lgd_cs($pageRow['title'], $titleLen)) . "' (ID:" . $id . ($uP['fragment'] ? ', #' . $uP['fragment'] : '') . ')';
$info['pageid'] = $id;
$info['cElement'] = $uP['fragment'];
$info['act'] = 'page';
$info['query'] = $parameters[0] ? '&' . implode('&', $parameters) : '';
}
}
}
} else {
// Email link:
if (strtolower(substr($href, 0, 7)) == 'mailto:') {
$info['value'] = trim(substr($href, 7));
$info['act'] = 'mail';
}
}
$info['info'] = $info['value'];
} else {
// NO value inputted:
$info = array();
$info['info'] = $GLOBALS['LANG']->getLL('none');
$info['value'] = '';
$info['act'] = 'page';
}
// let the hook have a look
foreach ($this->hookObjects as $hookObject) {
$info = $hookObject->parseCurrentUrl($href, $siteUrl, $info);
}
return $info;
}
示例10: addButton
/**
* Checks access to the record and adds the clear cache button
*
* @param array $params
* @param template $pObj
*
* @return void
*/
public function addButton($params, $pObj)
{
$this->params = $params;
$this->pObj = $pObj;
$record = array();
$table = '';
// For web -> page view or web -> list view
if ($this->pObj->scriptID === 'ext/cms/layout/db_layout.php' || $this->pObj->scriptID === 'ext/recordlist/mod1/index.php') {
$id = t3lib_div::_GP('id');
if (is_object($GLOBALS['SOBE']) && $GLOBALS['SOBE']->current_sys_language) {
$table = 'pages_language_overlay';
$record = t3lib_BEfunc::getRecordsByField($table, 'pid', $id, ' AND ' . $table . '.sys_language_uid=' . intval($GLOBALS['SOBE']->current_sys_language), '', '', '1');
if (is_array($record) && !empty($record)) {
$record = $record[0];
}
} else {
$table = 'pages';
$record = array('uid' => $id, 'pid' => $id);
}
} elseif ($this->pObj->scriptID === 'typo3/alt_doc.php') {
// For record edit
$editConf = t3lib_div::_GP('edit');
if (is_array($editConf) && !empty($editConf)) {
// Finding the current table
reset($editConf);
$table = key($editConf);
// Finding the first id and get the records pid
reset($editConf[$table]);
$recordUid = key($editConf[$table]);
// If table is pages we need uid (as pid) to get TSconfig
if ($table === 'pages') {
$record['uid'] = $recordUid;
$record['pid'] = $recordUid;
} else {
$record = t3lib_BEfunc::getRecord($table, $recordUid, 'uid, pid');
}
}
}
if (isset($record['pid']) && $record['pid'] > 0) {
if ($this->isModuleAccessible($record['pid'], $table)) {
// Process last request
$button = $this->process($table, $record['uid']);
// Generate button with form for list view
if ($this->pObj->scriptID === 'ext/recordlist/mod1/index.php') {
$button .= $this->generateButton(TRUE);
} else {
// Generate plain input button
$button .= $this->generateButton();
}
// Add button to button list and extend layout
$this->params['buttons']['vcc'] = $button;
$buttonWrap = t3lib_parsehtml::getSubpart($pObj->moduleTemplate, '###BUTTON_GROUP_WRAP###');
$this->params['markers']['BUTTONLIST_LEFT'] .= t3lib_parsehtml::substituteMarker($buttonWrap, '###BUTTONS###', trim($button));
}
}
}
示例11: getSystemLanguages
/**
* Obtains system languages.
*
* @return array
*/
protected function getSystemLanguages() {
$languages = (array)t3lib_BEfunc::getRecordsByField('sys_language','pid',0,'','','title');
$defaultLanguageLabel = $this->getDefaultLanguageName();
array_unshift($languages, array('uid' => 0, 'title' => $defaultLanguageLabel));
array_unshift($languages, array('uid' => '', 'title' => $GLOBALS['LANG']->getLL('all_languages')));
return $languages;
}
示例12: getPageIdFromAlias
/**
* Look up and return page uid for alias
*
* @param integer Page alias string value
* @return integer Page uid corresponding to alias value.
*/
function getPageIdFromAlias($link_param)
{
$pRec = t3lib_BEfunc::getRecordsByField('pages', 'alias', $link_param);
return $pRec[0]['uid'];
}
示例13: processClearCacheCommand
/**
* Processes the CURL request and sends action to Varnish server
*
* @param string $url
* @param integer $pid
* @param string $host
* @param boolean $quote
*
* @return array
*/
protected function processClearCacheCommand($url, $pid, $host = '', $quote = TRUE)
{
$responseArray = array();
foreach ($this->serverArray as $server) {
$response = array('server' => $server);
// Build request
if ($this->stripSlash) {
$url = rtrim($url, '/');
}
$request = $server . '/' . ltrim($url, '/');
$response['request'] = $request;
// Check for curl functions
if (!function_exists('curl_init')) {
// TODO: Implement fallback to file_get_contents()
$response['status'] = t3lib_FlashMessage::ERROR;
$response['message'] = 'No curl_init available';
} else {
// If no host was given we need to loop over all
$hostArray = array();
if ($host !== '') {
$hostArray = t3lib_div::trimExplode(',', $host, 1);
} else {
// Get all (non-redirecting) domains from root
$rootLine = t3lib_BEfunc::BEgetRootLine($pid);
foreach ($rootLine as $row) {
$domainArray = t3lib_BEfunc::getRecordsByField('sys_domain', 'pid', $row['uid'], ' AND redirectTo="" AND hidden=0');
if (is_array($domainArray) && !empty($domainArray)) {
foreach ($domainArray as $domain) {
$hostArray[] = $domain['domainName'];
}
unset($domain);
}
}
unset($row);
}
// Fallback to current server
if (empty($hostArray)) {
$domain = rtrim(t3lib_div::getIndpEnv('TYPO3_SITE_URL'), '/');
$hostArray[] = substr($domain, strpos($domain, '://') + 3);
}
// Loop over hosts
foreach ($hostArray as $xHost) {
$response['host'] = $xHost;
// Curl initialization
$ch = curl_init();
// Disable direct output
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Only get header response
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
// Set url
curl_setopt($ch, CURLOPT_URL, $request);
// Set method and protocol
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $this->httpMethod);
curl_setopt($ch, CURLOPT_HTTP_VERSION, $this->httpProtocol === 'http_10' ? CURL_HTTP_VERSION_1_0 : CURL_HTTP_VERSION_1_1);
// Set X-Host and X-Url header
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-Host: ' . ($quote ? preg_quote($xHost) : $xHost), 'X-Url: ' . ($quote ? preg_quote($url) : $url)));
// Store outgoing header
curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
// Include preProcess hook (e.g. to set some alternative curl options
foreach ($this->hookObjects as $hookObject) {
/** @var tx_vcc_hook_communicationServiceHookInterface $hookObject */
$hookObject->preProcess($ch, $request, $response, $this);
}
unset($hookObject);
$header = curl_exec($ch);
if (!curl_error($ch)) {
$response['status'] = curl_getinfo($ch, CURLINFO_HTTP_CODE) == 200 ? t3lib_FlashMessage::OK : t3lib_FlashMessage::ERROR;
$response['message'] = preg_split('/(\\r|\\n)+/m', trim($header));
} else {
$response['status'] = t3lib_FlashMessage::ERROR;
$response['message'] = array(curl_error($ch));
}
$response['requestHeader'] = preg_split('/(\\r|\\n)+/m', trim(curl_getinfo($ch, CURLINFO_HEADER_OUT)));
// Include postProcess hook (e.g. to start some other jobs)
foreach ($this->hookObjects as $hookObject) {
/** @var tx_vcc_hook_communicationServiceHookInterface $hookObject */
$hookObject->postProcess($ch, $request, $response, $this);
}
unset($hookObject);
curl_close($ch);
// Log debug information
$logData = array('url' => $url, 'pid' => $pid, 'host' => $host, 'response' => $response);
$logType = $response['status'] == t3lib_FlashMessage::OK ? tx_vcc_service_loggingService::OK : tx_vcc_service_loggingService::ERROR;
$this->loggingService->log('CommunicationService::processClearCacheCommand', $logData, $logType, $pid, 3);
$responseArray[] = $response;
}
unset($xHost);
}
}
//.........这里部分代码省略.........
示例14: renderSearchForm
/**
* Create search form
*
* @return string HTML
*/
function renderSearchForm() {
$output.= '<br/>';
$output.= '<br/>';
// Language selector:
$sys_languages = t3lib_BEfunc::getRecordsByField('sys_language','pid',0,'','','title');
// Masi: fix if no sys_language records defined
if (!is_array($sys_languages)) {
$sys_languages = array();
}
array_unshift($sys_languages,array('uid' => 0, 'title' => 'Default'));
array_unshift($sys_languages,array('uid' => '', 'title' => 'All languages'));
$options = array();
$showLanguage = t3lib_div::_GP('showLanguage');
foreach($sys_languages as $record) {
$options[] = '
<option value="'.htmlspecialchars($record['uid']).'"'.(!strcmp($showLanguage,$record['uid']) ? 'selected="selected"' : '').'>'.htmlspecialchars($record['title'].' ['.$record['uid'].']').'</option>';
}
$output.= 'Only language: <select name="showLanguage">'.implode('', $options).'</select><br/>';
// Search path:
$output.= 'Path: <input type="text" name="pathPrefixSearch" value="'.htmlspecialchars(t3lib_div::_GP('pathPrefixSearch')).'" />';
$output.= '<input type="submit" name="_" value="Look up" />';
$output.= '<br/>';
// Search / Replace part:
if ($this->searchResultCounter && !t3lib_div::_POST('_replace') && !t3lib_div::_POST('_delete')) {
$output.= '<br/><b>'.sprintf('%s results found.',$this->searchResultCounter).'</b><br/>';
$output.= 'Replace with: <input type="text" name="pathPrefixReplace" value="'.htmlspecialchars(t3lib_div::_GP('pathPrefixSearch')).'" />';
$output.= '<input type="submit" name="_replace" value="Replace" /> - <input type="submit" name="_delete" value="Delete" /><br/>';
}
// Hidden fields:
$output.= '<input type="hidden" name="id" value="'.htmlspecialchars($this->pObj->id).'" />';
$output.= '<br/>';
return $output;
}
示例15: setData
/**
* Set all deleted rows
*
* @param integer $id: UID from record
* @param string $table: Tablename from record
* @param integer $depth: How many levels recursive
* @param array $ctrl: TCA CTRL Array
* @param string $filter: Filter text
* @return void
*/
protected function setData($id = 0, $table, $depth, $tcaCtrl, $filter)
{
$id = intval($id);
if (array_key_exists('delete', $tcaCtrl)) {
// find the 'deleted' field for this table
$deletedField = tx_recycler_helper::getDeletedField($table);
// create the filter WHERE-clause
if (trim($filter) != '') {
$filterWhere = ' AND (' . (t3lib_div::testInt($filter) ? 'uid = ' . $filter . ' OR pid = ' . $filter . ' OR ' : '') . $tcaCtrl['label'] . ' LIKE "%' . $this->escapeValueForLike($filter, $table) . '%"' . ')';
}
// get the limit
if ($this->limit != '') {
// count the number of deleted records for this pid
$deletedCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $table, $deletedField . '!=0 AND pid = ' . $id . $filterWhere);
// split the limit
$parts = t3lib_div::trimExplode(',', $this->limit);
$offset = $parts[0];
$rowCount = $parts[1];
// subtract the number of deleted records from the limit's offset
$result = $offset - $deletedCount;
// if the result is >= 0
if ($result >= 0) {
// store the new offset in the limit and go into the next depth
$offset = $result;
$this->limit = implode(',', array($offset, $rowCount));
// do NOT query this depth; limit also does not need to be set, we set it anyways
$allowQuery = false;
$allowDepth = true;
$limit = '';
// won't be queried anyways
// if the result is < 0
} else {
// the offset for the temporary limit has to remain like the original offset
// in case the original offset was just crossed by the amount of deleted records
if ($offset != 0) {
$tempOffset = $offset;
} else {
$tempOffset = 0;
}
// set the offset in the limit to 0
$newOffset = 0;
// convert to negative result to the positive equivalent
$absResult = abs($result);
// if the result now is > limit's row count
if ($absResult > $rowCount) {
// use the limit's row count as the temporary limit
$limit = implode(',', array($tempOffset, $rowCount));
// set the limit's row count to 0
$this->limit = implode(',', array($newOffset, 0));
// do not go into new depth
$allowDepth = false;
} else {
// if the result now is <= limit's row count
// use the result as the temporary limit
$limit = implode(',', array($tempOffset, $absResult));
// subtract the result from the row count
$newCount = $rowCount - $absResult;
// store the new result in the limit's row count
$this->limit = implode(',', array($newOffset, $newCount));
// if the new row count is > 0
if ($newCount > 0) {
// go into new depth
$allowDepth = true;
} else {
// if the new row count is <= 0 (only =0 makes sense though)
// do not go into new depth
$allowDepth = false;
}
}
// allow query for this depth
$allowQuery = true;
}
} else {
$limit = '';
$allowDepth = true;
$allowQuery = true;
}
// query for actual deleted records
if ($allowQuery) {
$recordsToCheck = t3lib_BEfunc::getRecordsByField($table, $deletedField, '1', ' AND pid = ' . $id . $filterWhere, '', '', $limit, false);
if ($recordsToCheck) {
$this->checkRecordAccess($table, $recordsToCheck);
}
}
// go into depth
if ($allowDepth && $depth >= 1) {
// check recursively for elements beneath this page
$resPages = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'pid=' . $id, '', 'sorting');
if (is_resource($resPages)) {
while ($rowPages = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resPages)) {
//.........这里部分代码省略.........