function &_getRowsSubpart($sTemplate)
 {
     $aRowsTmpl = array();
     if (($sAltRows = $this->_navConf("/template/alternaterows")) !== FALSE) {
         if (tx_ameosformidable::isRunneable($sAltRows)) {
             $sAltRows = tx_ameosformidable::isRunneable($sAltRows);
         }
         if (!is_string($sAltRows)) {
             $sAltRows = FALSE;
         } else {
             $sAltRows = trim($sAltRows);
         }
     }
     $aAltList = t3lib_div::trimExplode(",", $sAltRows);
     if (sizeof($aAltList) > 0) {
         $sRowsPart = t3lib_parsehtml::getSubpart($sTemplate, "###ROWS###");
         reset($aAltList);
         while (list(, $sAltSubpart) = each($aAltList)) {
             $sHtml = t3lib_parsehtml::getSubpart($sRowsPart, $sAltSubpart);
             if (empty($sHtml)) {
                 $this->oForm->mayday("renderlet:" . $this->_getType() . "[name=" . $this->getName() . "] - The given template with subpart marquer <b>'" . $sAltSubpart . "'</b> returned an empty string - Please check your template!");
             }
             $aRowsTmpl[] = $sHtml;
         }
     }
     return $aRowsTmpl;
 }
Ejemplo n.º 2
0
 /**
  * Main function, rendering the element browser in RTE mode.
  *
  * @return	void
  */
 function main()
 {
     // Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
     $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
     if ($altMountPoints) {
         $altMountPoints = t3lib_div::trimExplode(',', $altMountPoints);
         foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
             $GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly');
         }
         $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->returnFilemounts();
     }
     // Rendering type by user function
     $browserRendered = false;
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'] as $classRef) {
             $browserRenderObj = t3lib_div::getUserObj($classRef);
             if (is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render')) {
                 if ($browserRenderObj->isValid($this->mode, $this)) {
                     $this->content .= $browserRenderObj->render($this->mode, $this);
                     $browserRendered = true;
                     break;
                 }
             }
         }
     }
     // If type was not rendered, use default rendering functions
     if (!$browserRendered) {
         $GLOBALS['SOBE']->browser = t3lib_div::makeInstance('tx_rtehtmlarea_select_image');
         $GLOBALS['SOBE']->browser->init();
         $modData = $GLOBALS['BE_USER']->getModuleData('select_image.php', 'ses');
         list($modData, $store) = $GLOBALS['SOBE']->browser->processSessionData($modData);
         $GLOBALS['BE_USER']->pushModuleData('select_image.php', $modData);
         $this->content = $GLOBALS['SOBE']->browser->main_rte();
     }
 }
 /**
  * Fetches the items that should be disabled from the context menu
  *
  * @return array
  */
 protected function getDisableActions()
 {
     $tsConfig = $GLOBALS['BE_USER']->getTSConfig('options.contextMenu.' . $this->getContextMenuType() . '.disableItems');
     $disableItems = array();
     if (trim($tsConfig['value']) !== '') {
         $disableItems = t3lib_div::trimExplode(',', $tsConfig['value']);
     }
     $tsConfig = $GLOBALS['BE_USER']->getTSConfig('options.contextMenu.pageTree.disableItems');
     $oldDisableItems = array();
     if (trim($tsConfig['value']) !== '') {
         $oldDisableItems = t3lib_div::trimExplode(',', $tsConfig['value']);
     }
     $additionalItems = array();
     foreach ($oldDisableItems as $item) {
         if (!isset($this->legacyContextMenuMapping[$item])) {
             $additionalItems[] = $item;
             continue;
         }
         if (strpos($this->legacyContextMenuMapping[$item], ',')) {
             $actions = t3lib_div::trimExplode(',', $this->legacyContextMenuMapping[$item]);
             $additionalItems = array_merge($additionalItems, $actions);
         } else {
             $additionalItems[] = $item;
         }
     }
     return array_merge($disableItems, $additionalItems);
 }
 /**
  * The main method called by the controller
  *
  * @return array The probably modified GET/POST parameters
  */
 public function process()
 {
     //parse as float
     $fields = t3lib_div::trimExplode(',', $this->settings['parseFloatFields'], TRUE);
     $this->parseFloats($fields);
     return $this->gp;
 }
 function extraItemMarkerProcessor($markerArray, $row, $lConf, &$pObj)
 {
     $markerArray['###PROFESSOREN_LINK###'] = $this->gibProfessorenLink($row);
     $markerArray['###KANDIDAT###'] = $row['tx_hetools_kandidat_arbeit'];
     // configuration of chgallery
     $confDefault = $pObj->conf['genericmarkers.'];
     if (!is_array($confDefault)) {
         return $markerArray;
     }
     // merge with special configuration (based on chosen CODE [SINGLE, LIST, LATEST]) if this is available
     if (is_array($confDefault[$pObj->config['code'] . '.'])) {
         $conf = t3lib_div::array_merge_recursive_overrule($confDefault, $confDefault[$pObj->config['code'] . '.']);
     } else {
         $conf = $confDefault;
     }
     if (is_array($conf)) {
         if ($conf['data'] != '') {
             foreach (t3lib_div::trimExplode(',', $conf['data']) as $key) {
                 $pObj->cObj->data['generic_' . $key] = $row[$key];
             }
         }
         foreach ($conf as $key => $value) {
             $key2 = trim($key, '.');
             $markerArray['###GENERIC_' . strtoupper($key2) . '###'] = $pObj->cObj->cObjGetSingle($conf[$key2], $conf[$key]);
         }
     }
     return $markerArray;
 }
Ejemplo n.º 6
0
 /**
  * build an array of image instances
  * 
  * @param string|array $files string should use "," as seperator
  * @param string $path
  * @param string|array $alternateTexts string should use newline as seperator
  * @param string|array $captions string should use newline as seperator
  * @return array<Tx_CzEwlSponsor_Domain_Model_File>
  */
 public static function build($files, $path, $alternates = '', $captions = '')
 {
     $return = array();
     if (!is_array($files)) {
         $files = is_string($files) && !empty($files) ? t3lib_div::trimExplode(",", $files, false) : array();
     }
     if (!is_array($alternates)) {
         $alternates = is_string($alternates) && !empty($alternates) ? t3lib_div::trimExplode("\n", $alternates, false) : array();
     }
     if (!is_array($captions)) {
         $captions = is_string($captions) && !empty($captions) ? t3lib_div::trimExplode("\n", $captions, false) : array();
     }
     if ($path && substr($path, -1) !== '/') {
         $path = $path . '/';
     }
     foreach ($files as $key => $fileName) {
         if (empty($fileName)) {
             continue;
         }
         $file = new Tx_CzSimpleCal_Domain_Model_File();
         $file->setPath($path);
         $file->setFile($fileName);
         if (array_key_exists($key, $captions) && $captions[$key]) {
             $file->setCaption($captions[$key]);
         }
         if (array_key_exists($key, $alternates) && $alternates[$key]) {
             $file->setAlternateText($alternates[$key]);
         }
         $return[] = $file;
     }
     return $return;
 }
Ejemplo n.º 7
0
 protected function getSortingLinks()
 {
     $sortHelper = t3lib_div::makeInstance('Tx_Solr_Sorting', $this->configuration['search.']['sorting.']['options.']);
     $query = $this->search->getQuery();
     $queryLinkBuilder = t3lib_div::makeInstance('Tx_Solr_Query_LinkBuilder', $query);
     $queryLinkBuilder->setLinkTargetPageId($this->parentPlugin->getLinkTargetPageId());
     $sortOptions = array();
     $urlParameters = t3lib_div::_GP('tx_solr');
     $urlSortParameters = t3lib_div::trimExplode(',', $urlParameters['sort']);
     $configuredSortOptions = $sortHelper->getSortOptions();
     foreach ($configuredSortOptions as $sortOptionName => $sortOption) {
         $sortDirection = $this->configuration['search.']['sorting.']['defaultOrder'];
         if (!empty($this->configuration['search.']['sorting.']['options.'][$sortOptionName . '.']['defaultOrder'])) {
             $sortDirection = $this->configuration['search.']['sorting.']['options.'][$sortOptionName . '.']['defaultOrder'];
         }
         $sortIndicator = $sortDirection;
         $currentSortOption = '';
         $currentSortDirection = '';
         foreach ($urlSortParameters as $urlSortParameter) {
             $explodedUrlSortParameter = explode(' ', $urlSortParameter);
             if ($explodedUrlSortParameter[0] == $sortOptionName) {
                 list($currentSortOption, $currentSortDirection) = $explodedUrlSortParameter;
                 break;
             }
         }
         // toggle sorting direction for the current sorting field
         if ($currentSortOption == $sortOptionName) {
             switch ($currentSortDirection) {
                 case 'asc':
                     $sortDirection = 'desc';
                     $sortIndicator = 'asc';
                     break;
                 case 'desc':
                     $sortDirection = 'asc';
                     $sortIndicator = 'desc';
                     break;
             }
         }
         if (!empty($this->configuration['search.']['sorting.']['options.'][$sortOptionName . '.']['fixedOrder'])) {
             $sortDirection = $this->configuration['search.']['sorting.']['options.'][$sortOptionName . '.']['fixedOrder'];
         }
         $sortParameter = $sortOptionName . ' ' . $sortDirection;
         $temp = array('link' => $queryLinkBuilder->getQueryLink($sortOption['label'], array('sort' => $sortParameter)), 'url' => $queryLinkBuilder->getQueryUrl(array('sort' => $sortParameter)), 'optionName' => $sortOptionName, 'field' => $sortOption['field'], 'label' => $sortOption['label'], 'is_current' => '0', 'direction' => $sortDirection, 'indicator' => $sortIndicator, 'current_direction' => ' ');
         // set sort indicator for the current sorting field
         if ($currentSortOption == $sortOptionName) {
             $temp['selected'] = 'selected="selected"';
             $temp['current'] = 'current';
             $temp['is_current'] = '1';
             $temp['current_direction'] = $sortIndicator;
         }
         // special case relevance: just reset the search to normal behavior
         if ($sortOptionName == 'relevance') {
             $temp['link'] = $queryLinkBuilder->getQueryLink($sortOption['label'], array('sort' => NULL));
             $temp['url'] = $queryLinkBuilder->getQueryUrl(array('sort' => NULL));
             unset($temp['direction'], $temp['indicator']);
         }
         $sortOptions[] = $temp;
     }
     return $sortOptions;
 }
 /**
  * Parses parts of the mail message and sends it with the Swift Mailer functions
  *
  * @param string $to Email address to send the message to
  * @param string $subject Subject of mail message
  * @param string $messageBody Raw body (may be multipart)
  * @param array $additionalHeaders Additional mail headers
  * @param array $additionalParameters Extra parameters for the mail() command
  * @param bool $fakeSending If set fake sending a mail
  * @throws t3lib_exception
  * @return bool
  */
 public function mail($to, $subject, $messageBody, $additionalHeaders = NULL, $additionalParameters = NULL, $fakeSending = FALSE)
 {
     // report success for fake sending
     if ($fakeSending === TRUE) {
         return TRUE;
     }
     $this->message->setSubject($subject);
     // handle recipients
     $toAddresses = $this->parseAddresses($to);
     $this->message->setTo($toAddresses);
     // handle additional headers
     $headers = t3lib_div::trimExplode(LF, $additionalHeaders, TRUE);
     $this->messageHeaders = $this->message->getHeaders();
     foreach ($headers as $header) {
         list($headerName, $headerValue) = t3lib_div::trimExplode(':', $header, FALSE, 2);
         $this->setHeader($headerName, $headerValue);
     }
     // handle additional parameters (force return path)
     if (preg_match('/-f\\s*(\\S*?)/', $additionalParameters, $matches)) {
         $this->message->setReturnPath($this->unescapeShellArguments($matches[1]));
     }
     // handle from:
     $this->fixSender();
     // handle message body
     $this->setBody($messageBody);
     // send mail
     $result = $this->mailer->send($this->message);
     // report success/failure
     return (bool) $result;
 }
 /**
  * Main function
  *
  * @param clickMenu reference parent object
  * @param array menutitems for manipultation
  * @param string table name
  * @param int uid
  * @return array manipulated menuitems
  */
 function main(clickMenu $backRef, array $menuItems, $table, $uid)
 {
     if ($table != 'tx_crawler_configuration') {
         // early return without doing anything
         return $menuItems;
     }
     $localItems = array();
     $row = t3lib_BEfunc::getRecord($table, $uid, 'pid, name, processing_instruction_filter', '', true);
     if (!empty($row)) {
         if (version_compare(TYPO3_version, '4.5.0', '>=')) {
             $url = t3lib_extMgm::extRelPath('info') . 'mod1/index.php';
         } else {
             $url = $backRef->backPath . 'mod/web/info/index.php';
         }
         $url .= '?id=' . intval($row['pid']);
         $url .= '&SET[function]=tx_crawler_modfunc1';
         $url .= '&SET[crawlaction]=start';
         $url .= '&configurationSelection[]=' . $row['name'];
         foreach (t3lib_div::trimExplode(',', $row['processing_instruction_filter']) as $processing_instruction) {
             $url .= '&procInstructions[]=' . $processing_instruction;
         }
         // $onClick = $backRef->urlRefForCM($url);
         $onClick = "top.nextLoadModuleUrl='" . $url . "';top.goToModule('web_info',1);";
         $localItems[] = $backRef->linkItem('Crawl', $backRef->excludeIcon('<img src="' . $backRef->backPath . t3lib_extMgm::extRelPath('crawler') . 'icon_tx_crawler_configuration.gif" border="0" align="top" alt="" />'), $onClick, 0);
     }
     return array_merge($menuItems, $localItems);
 }
 /**
  * Error handling if no news entry is found
  *
  * @param string $configuration configuration what will be done
  * @throws InvalidArgumentException
  * @return void
  */
 protected function handleNoNewsFoundError($configuration)
 {
     if (empty($configuration)) {
         return;
     }
     $configuration = t3lib_div::trimExplode(',', $configuration, TRUE);
     switch ($configuration[0]) {
         case 'redirectToListView':
             $this->redirect('list');
             break;
         case 'redirectToPage':
             if (count($configuration) === 1 || count($configuration) > 3) {
                 $msg = sprintf('If error handling "%s" is used, either 2 or 3 arguments, splitted by "," must be used', $configuration[0]);
                 throw new InvalidArgumentException($msg);
             }
             /** @var $cObj tslib_cObj */
             $cObj = t3lib_div::makeInstance('tslib_cObj');
             $url = $cObj->typoLink_URL(array('parameter' => $configuration[1]));
             if (isset($configuration[2])) {
                 $header = 'HTTP_STATUS_' . $configuration[2];
                 t3lib_utility_Http::redirect($url, $header);
             } else {
                 t3lib_utility_Http::redirect($url);
             }
             break;
         case 'pageNotFoundHandler':
             $GLOBALS['TSFE']->pageNotFoundAndExit('No news entry found.');
             break;
         default:
             // Do nothing, it might be handled in the view.
     }
 }
 function main($linktxt, $conf, $linkHandlerKeyword, $linkHandlerValue, $link_param, &$pObj)
 {
     $this->pObj =& $pObj;
     $pageTSConfig = $GLOBALS['TSFE']->getPagesTSconfig($GLOBALS['TSFE']->id);
     $linkConfig = $pageTSConfig['RTE.']['default.']['linkhandler.'];
     if (!is_array($linkConfig)) {
         return $linktxt;
     }
     $linkHandlerData = t3lib_div::trimExplode(':', $linkHandlerValue);
     if (!isset($linkConfig[$linkHandlerData[0] . '.'])) {
         return $linktxt;
     }
     $localcObj = t3lib_div::makeInstance('tslib_cObj');
     $row = $this->getRecordRow($linkHandlerData[0], $linkHandlerData[1]);
     $localcObj->start($row, '');
     $lconf = array();
     if (is_array($linkConfig[$linkHandlerData[0] . '.'][$row['pid'] . '.'])) {
         $lconf = $linkConfig[$linkHandlerData[0] . '.'][$row['pid'] . '.'];
     } else {
         $lconf = $linkConfig[$linkHandlerData[0] . '.']['default.'];
     }
     $link_paramA = t3lib_div::unQuoteFilenames($link_param, true);
     $linkClass = $link_paramA[2] == '-' ? '' : $link_paramA[2];
     $lconf['ATagParams'] = $this->pObj->getATagParams($conf) . ($linkClass ? ' class="' . $linkClass . '"' : '');
     if ($link_paramA[3]) {
         $lconf['title'] = $link_paramA[3];
     }
     // remove the tinymce_rte specific attributes
     unset($lconf['select'], $lconf['sorting']);
     return $localcObj->typoLink($linktxt, $lconf);
 }
 /**
  * Validates that a specified field's value is a valid date
  *
  * @param array &$check The TypoScript settings for this error check
  * @param string $name The field name
  * @param array &$gp The current GET/POST parameters
  * @return string The error string
  */
 public function check(&$check, $name, &$gp)
 {
     $checkFailed = '';
     if (isset($gp[$name]) && strlen(trim($gp[$name])) > 0) {
         # find out separator
         $pattern = Tx_Formhandler_StaticFuncs::getSingle($check['params'], 'pattern');
         preg_match('/^[d|m|y]*(.)[d|m|y]*/i', $pattern, $res);
         $sep = $res[1];
         // normalisation of format
         $pattern = $this->normalizeDatePattern($pattern, $sep);
         // find out correct positioins of "d","m","y"
         $pos1 = strpos($pattern, 'd');
         $pos2 = strpos($pattern, 'm');
         $pos3 = strpos($pattern, 'y');
         $dateCheck = t3lib_div::trimExplode($sep, $gp[$name]);
         if (sizeof($dateCheck) !== 3) {
             $checkFailed = $this->getCheckFailed($check);
         } elseif (intval($dateCheck[0]) === 0 || intval($dateCheck[1]) === 0 || intval($dateCheck[2]) === 0) {
             $checkFailed = $this->getCheckFailed($check);
         } elseif (!checkdate($dateCheck[$pos2], $dateCheck[$pos1], $dateCheck[$pos3])) {
             $checkFailed = $this->getCheckFailed($check);
         } elseif (strlen($dateCheck[$pos3]) !== 4) {
             $checkFailed = $this->getCheckFailed($check);
         }
     }
     return $checkFailed;
 }
Ejemplo n.º 13
0
 /**
  * Returns information about this extension's pi1 plugin
  *
  * @param array $params Parameters to the hook
  * @param mixed $pObj A reference to calling object
  * @return string Information about pi1 plugin
  */
 public function getExtensionSummary(array $params, $pObj)
 {
     $result = $actionTranslationKey = '';
     if ($this->showExtensionTitle()) {
         $result .= '<strong>' . $GLOBALS['LANG']->sL(self::LLPATH . 'pi1_title', TRUE) . '</strong>';
     }
     if ($params['row']['list_type'] == self::KEY . '_pi1') {
         $this->flexformData = t3lib_div::xml2array($params['row']['pi_flexform']);
         // if flexform data is found
         $actions = $this->getFieldFromFlexform($this->flexformData, 'switchableControllerActions');
         if (!empty($actions)) {
             $actionList = t3lib_div::trimExplode(';', $actions);
             // translate the first action into its translation
             $actionTranslationKey = strtolower(str_replace('->', '_', $actionList[0]));
             $actionTranslation = $GLOBALS['LANG']->sL(self::LLPATH . 'flexforms_general.mode.' . $actionTranslationKey);
             $result .= '<h5>' . $actionTranslation . '</h5>';
         } else {
             $result = $GLOBALS['LANG']->sL(self::LLPATH . 'flexforms_general.mode.not_configured');
         }
         if (is_array($this->flexformData)) {
             switch ($actionTranslationKey) {
                 case 'news_list':
                     $this->getStartingPoint();
                     $this->getTimeRestrictionSetting();
                     $this->getTopNewsRestrictionSetting();
                     $this->getOrderSettings();
                     $this->getCategorySettings();
                     $this->getArchiveSettings();
                     $this->getOffsetLimitSettings();
                     $this->getDetailPidSetting();
                     $this->getListPidSetting();
                     break;
                 case 'news_detail':
                     $this->getSingleNewsSettings();
                     $this->getDetailPidSetting();
                     break;
                 case 'news_datemenu':
                     $this->getStartingPoint();
                     $this->getTimeRestrictionSetting();
                     $this->getTopNewsRestrictionSetting();
                     $this->getDateMenuSettings();
                     $this->getCategorySettings();
                     break;
                 case 'category_list':
                     $this->getCategorySettings(FALSE);
                     break;
                 case 'tag_list':
                     $this->getStartingPoint(FALSE);
                     $this->getListPidSetting();
                     break;
                 default:
             }
             // for all views
             $this->getOverrideDemandSettings();
             $this->getTemplateLayoutSettings();
             $result .= $this->renderSettingsAsTable($params['row']);
         }
     }
     return $result;
 }
Ejemplo n.º 14
0
function test($urls,$config,$title,$displayOnlyOnStateNo=0)	{

		// Init object:
	$urlObj = t3lib_div::makeInstance('tx_realurl');
	$urlObj->extConf = $config;

		// Traverse URLs:
	$urls = t3lib_div::trimExplode(chr(10),$urls,1);
	$resultPairs = array();
	foreach($urls as $k => $singleUrl)	{

			// Encode:
		$uParts = parse_url($singleUrl);
		$SpURL = $urlObj->encodeSpURL_doEncode($uParts['query']);

			// Decode:
		$uParts = parse_url($SpURL);
		$GETvars = $urlObj->decodeSpURL_doDecode($uParts['path']);
		$remainingP = $uParts['query'];

		list(,$origP) = explode('?',$singleUrl,2);
		$origP = orderParameters($origP);
		$vars = orderParameters('id='.$GETvars['id'].($remainingP ? '&'.$remainingP : '').t3lib_div::implodeArrayForUrl('', $GETvars['GET_VARS'], '', 0, 1));
		$stateNo = $origP!=$vars;

		if ($stateNo || !$displayOnlyOnStateNo)
			$resultPairs[$k] = array($singleUrl, $SpURL, $GETvars, $origP, $vars, $stateNo ? 'NO!!' : 'YES');
	}

	debug($resultPairs,$title);
}
 /**
  * Default action.
  *
  * @return array
  * @throws RuntimeException
  */
 public function main()
 {
     $this->init();
     $allowedIps = t3lib_div::trimExplode(',', $this->config['allowedIps'], true);
     if ($this->config['debug']) {
         t3lib_div::sysLog('Connection from ' . t3lib_div::getIndpEnv('REMOTE_ADDR'), self::$extKey);
     }
     if ($this->config['mode'] !== 'M' || count($allowedIps) && !t3lib_div::inArray($allowedIps, t3lib_div::getIndpEnv('REMOTE_ADDR'))) {
         $this->denyAccess();
     }
     $this->initTSFE();
     if (!empty($this->config['synchronizeDeletedAccounts']) && $this->config['synchronizeDeletedAccounts']) {
         $additionalFields = ', deleted';
         $additionalWhere = '';
     } else {
         $additionalFields = '';
         $additionalWhere = ' AND deleted=0';
     }
     $administrators = $this->getDatabaseConnection()->exec_SELECTgetRows('username, admin, disable, realName, email, TSconfig, starttime, endtime, lang, tx_openid_openid' . $additionalFields, 'be_users', 'admin=1 AND tx_openid_openid<>\'\'' . $additionalWhere);
     if (count($administrators)) {
         $key = $this->config['preSharedKey'];
         $data = json_encode($administrators);
         $encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $data, MCRYPT_MODE_CBC, md5(md5($key)));
         $encrypted = base64_encode($encrypted);
         return $encrypted;
     } else {
         throw new RuntimeException('No administrators found', 1327586994);
     }
 }
 /**
  * Manipulating the input array, $params, adding new selectorbox items.
  *
  * @param	array	array of select field options (reference)
  * @param	object	parent object (reference)
  * @return	void
  */
 function main(&$params, &$pObj)
 {
     t3lib_div::loadTCA('tt_address');
     // TODO consolidate with list in pi1
     $coreSortFields = 'gender, first_name, middle_name, last_name, title, company, ' . 'address, building, room, birthday, zip, city, region, country, email, www, phone, mobile, ' . 'fax, addressgroup';
     $sortFields = t3lib_div::trimExplode(',', $coreSortFields);
     $selectOptions = array();
     foreach ($sortFields as $field) {
         $label = $GLOBALS['LANG']->sL($GLOBALS['TCA']['tt_address']['columns'][$field]['label']);
         $label = substr($label, 0, -1);
         $selectOptions[] = array('field' => $field, 'label' => $label);
     }
     // add sorting by order of single selection
     $selectOptions[] = array('field' => 'singleSelection', 'label' => $GLOBALS['LANG']->sL('LLL:EXT:tt_address/pi1/locallang_ff.xml:pi1_flexform.sortBy.singleSelection'));
     // sort by labels
     $labels = array();
     foreach ($selectOptions as $key => $v) {
         $labels[$key] = $v['label'];
     }
     $labels = array_map('strtolower', $labels);
     array_multisort($labels, SORT_ASC, $selectOptions);
     // add fields to <select>
     foreach ($selectOptions as $option) {
         $params['items'][] = array($option['label'], $option['field']);
     }
 }
 /**
  * Get the base pages
  *
  * @return array
  */
 protected function getBasePages()
 {
     $startPage = intval($this->settings['startpoint']);
     $depth = intval($this->settings['depth']);
     $pages = $this->configurationManager->getContentObject()->getTreeList($startPage, $depth, 0, true);
     return t3lib_div::trimExplode(',', $pages . ',' . $startPage, true);
 }
Ejemplo n.º 18
0
 /**
  * 
  * @return string
  */
 public function indexAction()
 {
     try {
         $options = $this->widgetConfiguration['options'];
         $apiKey = $this->widgetConfiguration['apiKey'];
         if (!empty($this->widgetConfiguration['templatePathAndName'])) {
             $this->view->setTemplatePathAndFilename(t3lib_div::getFileAbsFileName($this->widgetConfiguration['templatePathAndName']));
         }
         $flickr = new Tx_T3orgFlickrfeed_Utility_Flickr($apiKey);
         if ($this->widgetConfiguration['type'] == 1 || $this->widgetConfiguration['type'] === 'tag') {
             // tagSearch
             $this->view->assign('result', $flickr->tagSearch($this->widgetConfiguration['tags'], $options));
             if (is_array($this->widgetConfiguration['tags']) || $this->widgetConfiguration['tags'] instanceof Traversable) {
                 $tags = $this->widgetConfiguration['tags'];
             } else {
                 $tags = t3lib_div::trimExplode(',', $this->widgetConfiguration['tags'], true);
             }
             $this->view->assign('tags', $tags);
         } elseif ($this->widgetConfiguration['type'] == 2 || $this->widgetConfiguration['type'] === 'user') {
             // people.getPublicPhotos
             $this->view->assign('result', $flickr->userSearch($this->widgetConfiguration['user_id'], $options));
         } else {
             $this->view->assign('result', $flickr->groupPoolGetPhotos($this->widgetConfiguration['group_id'], $options));
         }
     } catch (Exception $e) {
         t3lib_div::sysLog($e->getMessage(), $this->request->getControllerExtensionKey(), LOG_ERR);
         $this->view->assign('error', $e->getMessage());
     }
 }
Ejemplo n.º 19
0
 /**
  * Registers a command and its command class for several plugins
  *
  * @param string $plugins comma separated list of plugin names (without pi_ prefix)
  * @param string $commandName command name
  * @param string $commandClass name of the class implementing the command
  * @param integer $requirements Bitmask of which requirements need to be met for a command to be executed
  */
 public static function registerPluginCommand($plugins, $commandName, $commandClass, $requirements = Tx_Solr_PluginCommand::REQUIREMENT_HAS_SEARCHED)
 {
     if (!array_key_exists($commandName, self::$commands)) {
         $plugins = t3lib_div::trimExplode(',', $plugins, TRUE);
         self::$commands[$commandName] = array('plugins' => $plugins, 'commandName' => $commandName, 'commandClass' => $commandClass, 'requirements' => $requirements);
     }
 }
 /**
  * Remove values of a comma separated list from another comma separated list
  *
  * @param string $result string comma separated list
  * @param $toBeRemoved string comma separated list
  * @return string
  */
 public static function removeValuesFromString($result, $toBeRemoved)
 {
     $resultAsArray = t3lib_div::trimExplode(',', $result, TRUE);
     $idListAsArray = t3lib_div::trimExplode(',', $toBeRemoved, TRUE);
     $result = implode(',', array_diff($resultAsArray, $idListAsArray));
     return $result;
 }
 /**
  * Renders the TypoScript object in the given TypoScript setup path.
  *
  * @param string $typoscriptObjectPath the TypoScript setup path of the TypoScript object to render
  * @param mixed $data the data to be used for rendering the cObject. Can be an object, array or string. If this argument is not set, child nodes will be used
  * @param string $currentValueKey
  * @return string the content of the rendered TypoScript object
  * @author Bastian Waidelich <*****@*****.**>
  * @author Niels Pardon <*****@*****.**>
  */
 public function render($typoscriptObjectPath, $data = NULL, $currentValueKey = NULL)
 {
     if ($data === NULL) {
         $data = $this->renderChildren();
     }
     $currentValue = NULL;
     if (is_object($data)) {
         $data = Tx_Extbase_Reflection_ObjectAccess::getAccessibleProperties($data);
     } elseif (is_string($data)) {
         $currentValue = $data;
         $data = array($data);
     }
     $this->contentObject->start($data);
     if ($currentValue !== NULL) {
         $this->contentObject->setCurrentVal($currentValue);
     } elseif ($currentValueKey !== NULL && isset($data[$currentValueKey])) {
         $this->contentObject->setCurrentVal($data[$currentValueKey]);
     }
     $pathSegments = t3lib_div::trimExplode('.', $typoscriptObjectPath);
     $lastSegment = array_pop($pathSegments);
     $setup = $this->typoScriptSetup;
     foreach ($pathSegments as $segment) {
         if (!array_key_exists($segment . '.', $setup)) {
             throw new Tx_Fluid_Core_ViewHelper_Exception('TypoScript object path "' . htmlspecialchars($typoscriptObjectPath) . '" does not exist', 1253191023);
         }
         $setup = $setup[$segment . '.'];
     }
     return $this->contentObject->cObjGetSingle($setup[$lastSegment], $setup[$lastSegment . '.']);
 }
 /**
  * Validates that a specified field contains at least one of the specified words
  *
  * @param array &$check The TypoScript settings for this error check
  * @param string $name The field name
  * @param array &$gp The current GET/POST parameters
  * @return string The error string
  */
 public function check(&$check, $name, &$gp)
 {
     $checkFailed = '';
     $formValue = trim($gp[$name]);
     if (strlen($formValue) > 0) {
         $checkValue = Tx_Formhandler_StaticFuncs::getSingle($check['params'], 'words');
         if (!is_array($checkValue)) {
             $checkValue = t3lib_div::trimExplode(',', $checkValue);
         }
         $error = FALSE;
         $array = preg_split('//', $formValue, -1, PREG_SPLIT_NO_EMPTY);
         foreach ($array as $idx => $char) {
             if (!in_array($char, $checkValue)) {
                 $error = TRUE;
             }
         }
         if ($error) {
             //remove userfunc settings and only store comma seperated words
             $check['params']['words'] = implode(',', $checkValue);
             unset($check['params']['words.']);
             $checkFailed = $this->getCheckFailed($check);
         }
     }
     return $checkFailed;
 }
Ejemplo n.º 23
0
 /**
  * Validate ordering as extbase can't handle that currently
  *
  * @param string $fieldToCheck
  * @param string $allowedSettings
  * @return boolean
  */
 public static function isValidOrdering($fieldToCheck, $allowedSettings)
 {
     $isValid = TRUE;
     if (empty($fieldToCheck)) {
         return $isValid;
     } elseif (empty($allowedSettings)) {
         return FALSE;
     }
     $fields = t3lib_div::trimExplode(',', $fieldToCheck, TRUE);
     foreach ($fields as $field) {
         if ($isValid === TRUE) {
             $split = t3lib_div::trimExplode(' ', $field, TRUE);
             $count = count($split);
             switch ($count) {
                 case 1:
                     if (!t3lib_div::inList($allowedSettings, $split[0])) {
                         $isValid = FALSE;
                     }
                     break;
                 case 2:
                     if (strtolower($split[1]) !== 'desc' && strtolower($split[1]) !== 'asc' || !t3lib_div::inList($allowedSettings, $split[0])) {
                         $isValid = FALSE;
                     }
                     break;
                 default:
                     $isValid = FALSE;
             }
         }
     }
     return $isValid;
 }
 public function registrationProcess_beforeConfirmCreate(&$recordArray, &$controlDataObj)
 {
     // in the case of this hook, the record array is passed by reference
     // in this example hook, we generate a username based on the first and last names of the user
     $cmdKey = $controlDataObj->getCmdKey();
     $theTable = $controlDataObj->getTable();
     if ($controlDataObj->getFeUserData('preview') && $controlDataObj->conf[$cmdKey . '.']['generateUsername']) {
         $firstName = trim($recordArray['first_name']);
         $lastName = trim($recordArray['last_name']);
         $name = trim($recordArray['name']);
         if ((!$firstName || !$lastName) && $name) {
             $nameArray = t3lib_div::trimExplode(' ', $name);
             $firstName = $firstName ? $firstName : $nameArray[0];
             $lastName = $lastName ? $lastName : $nameArray[1];
         }
         $recordArray['username'] = substr(strtolower($firstName), 0, 5) . substr(strtolower($lastName), 0, 5);
         $DBrows = $GLOBALS['TSFE']->sys_page->getRecordsByField($theTable, 'username', $recordArray['username'], 'LIMIT 1');
         $counter = 0;
         while ($DBrows) {
             $counter = $counter + 1;
             $DBrows = $GLOBALS['TSFE']->sys_page->getRecordsByField($theTable, 'username', $recordArray['username'] . $counter, 'LIMIT 1');
         }
         if ($counter) {
             $recordArray['username'] = $recordArray['username'] . $counter;
         }
     }
 }
 /**
  * Constructor
  */
 function tx_kickstarter_wizard()
 {
     $this->modData = t3lib_div::_POST($this->varPrefix);
     $version = class_exists('t3lib_utility_VersionNumber') ? t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) : t3lib_div::int_from_ver(TYPO3_version);
     if ($version < 4006000) {
         $LOCAL_LANG = t3lib_div::readLLXMLfile(t3lib_extMgm::extPath('setup') . '/mod/locallang.xml', 'default');
         // Getting the available languages
         $theLanguages = t3lib_div::trimExplode('|', TYPO3_languages);
     } else {
         /** @var $xliffParser t3lib_l10n_parser_Xliff */
         $xliffParser = t3lib_div::makeInstance('t3lib_l10n_parser_Xliff');
         $LOCAL_LANG = $xliffParser->getParsedData(t3lib_extMgm::extPath('setup') . '/mod/locallang.xlf', 'default');
         /** @var $locales t3lib_l10n_Locales */
         $locales = t3lib_div::makeInstance('t3lib_l10n_Locales');
         // Getting the available languages
         $theLanguages = $locales->getLocales();
     }
     foreach ($theLanguages as $val) {
         if ($val !== 'default') {
             if ($version < 4006000) {
                 $localLabel = htmlspecialchars($LOCAL_LANG['default']['lang_' . $val]);
             } else {
                 $localLabel = htmlspecialchars($LOCAL_LANG['default']['lang_' . $val][0]['target']);
             }
             $this->languages[$val] = $localLabel;
         }
     }
     asort($this->languages);
     // init reserved words
     $resWords = t3lib_div::makeInstance('tx_kickstarter_reservedWords');
     $this->reservedWords = $resWords->getReservedWords();
 }
 /**
  * This test creates an extension based on a JSON file, generated
  * with version 1.0 of the ExtensionBuilder and compares all
  * generated files with the originally created ones
  * This test should help, to find compatibility breaking changes
  *
  * @test
  */
 function generateExtensionFromVersion1Configuration()
 {
     $this->configurationManager = $this->getMock($this->buildAccessibleProxy('Tx_ExtensionBuilder_Configuration_ConfigurationManager'), array('dummy'));
     $this->extensionSchemaBuilder = $this->objectManager->get('Tx_ExtensionBuilder_Service_ExtensionSchemaBuilder');
     $testExtensionDir = PATH_typo3conf . 'ext/extension_builder/Tests/Examples/TestExtensions/test_extension_v1/';
     $jsonFile = $testExtensionDir . Tx_ExtensionBuilder_Configuration_ConfigurationManager::EXTENSION_BUILDER_SETTINGS_FILE;
     if (file_exists($jsonFile)) {
         // compatibility adaptions for configurations from older versions
         $extensionConfigurationJSON = json_decode(file_get_contents($jsonFile), TRUE);
         $extensionConfigurationJSON = $this->configurationManager->fixExtensionBuilderJSON($extensionConfigurationJSON);
     } else {
         $this->fail('JSON file not found');
     }
     $this->extension = $this->extensionSchemaBuilder->build($extensionConfigurationJSON);
     $this->codeGenerator->setSettings(array('codeTemplateRootPath' => PATH_typo3conf . 'ext/extension_builder/Resources/Private/CodeTemplates/Extbase/', 'extConf' => array('enableRoundtrip' => '0')));
     $newExtensionDir = vfsStream::url('testDir') . '/';
     $this->extension->setExtensionDir($newExtensionDir . 'test_extension/');
     $this->codeGenerator->build($this->extension);
     $referenceFiles = t3lib_div::getAllFilesAndFoldersInPath(array(), $testExtensionDir);
     foreach ($referenceFiles as $referenceFile) {
         $createdFile = str_replace($testExtensionDir, $this->extension->getExtensionDir(), $referenceFile);
         if (!in_array(basename($createdFile), array('ExtensionBuilder.json'))) {
             // json file is generated by controller
             $referenceFileContent = str_replace(array('2011-08-11', '###YEAR###'), array(date('Y-m-d'), date('Y')), file_get_contents($referenceFile));
             //t3lib_div::writeFile(PATH_site.'fileadmin/'.basename($createdFile), file_get_contents($createdFile));
             $this->assertFileExists($createdFile, 'File ' . $createdFile . ' was not created!');
             $this->assertEquals(t3lib_div::trimExplode("\n", $referenceFileContent, TRUE), t3lib_div::trimExplode("\n", file_get_contents($createdFile), TRUE), 'File ' . $createdFile . ' was not equal to original file.');
         }
     }
 }
Ejemplo n.º 27
0
 public function getAllowedActions($config)
 {
     $pid = $config['row']['pid'];
     $tsConfig = t3lib_befunc::getPagesTSconfig($pid);
     $flexConfig =& $tsConfig['options.']['cz_simple_cal_pi1.']['flexform.'];
     if (empty($flexConfig) || !isset($flexConfig['allowedActions.'])) {
         return;
     }
     $allowedActions = array();
     if (isset($flexConfig['allowedActions'])) {
         $enabled = array();
         foreach (t3lib_div::trimExplode(',', $flexConfig['allowedActions'], true) as $i) {
             $enabled[$i . '.'] = '';
         }
         $allowedActions = array_intersect_key($flexConfig['allowedActions.'], $enabled);
     } else {
         $allowedActions = $flexConfig['allowedActions.'];
     }
     foreach ($allowedActions as $name => $action) {
         $name = rtrim($name, '.');
         $label = $GLOBALS['LANG']->sL($action['label']);
         if (empty($label)) {
             $label = $name;
         }
         $config['items'][$name] = array($label, $name);
     }
 }
 /**
  * Constructor
  *
  * @param int $nodeLimit (optional)
  */
 public function __construct($nodeLimit = NULL)
 {
     if ($nodeLimit === NULL) {
         $nodeLimit = $GLOBALS['BE']['pageTree']['preloadLimit'];
     }
     $this->nodeLimit = abs(intval($nodeLimit));
     $this->hiddenRecords = t3lib_div::trimExplode(',', $GLOBALS['BE_USER']->getTSConfigVal('options.hideRecords.pages'));
 }
 function manualHeader($conf)
 {
     $aRes = array();
     if (array_key_exists("load", $conf)) {
         $aLoad = t3lib_div::trimExplode(",", strtolower($conf["load"]));
         reset($aLoad);
         while (list($sKey, ) = each($aLoad)) {
             switch ($aLoad[$sKey]) {
                 case "minified":
                     $aRes[] = $this->wrapScriptTag(PATH_formidable . "res/jsfwk/minified/formidable.minified.prototype.js", $conf["pathonly"]);
                     break;
                 case "minifiedjquery":
                     $aRes[] = $this->wrapScriptTag(PATH_formidable . "res/jsfwk/minified/formidable.minified.jquery.js", $conf["pathonly"]);
                     break;
                 case "minified+gzipped":
                     $aRes[] = $this->wrapScriptTag(PATH_formidable . "res/jsfwk/minified/formidable.minified.prototype.js.php", $conf["pathonly"]);
                     break;
                 case "minified+gzippedjquery":
                     $aRes[] = $this->wrapScriptTag(PATH_formidable . "res/jsfwk/minified/formidable.minified.jquery.js.php", $conf["pathonly"]);
                     break;
                 case "jsframework":
                     $aRes[] = $this->wrapScriptTag(PATH_formidable . "res/jsfwk/formidable/formidable.prototype.js", $conf["pathonly"]);
                     $aRes[] = $this->wrapScriptTag(PATH_formidable . "res/jsfwk/framework.js", $conf["pathonly"]);
                     break;
                 case "jsframeworkjquery":
                     $aRes[] = $this->wrapScriptTag(PATH_formidable . "res/jsfwk/formidable/formidable.jquery.js", $conf["pathonly"]);
                     $aRes[] = $this->wrapScriptTag(PATH_formidable . "res/jsfwk/framework.js", $conf["pathonly"]);
                     break;
                 case "prototype":
                     $aRes[] = $this->wrapScriptTag(PATH_formidable . "res/jsfwk/prototype/prototype.js", $conf["pathonly"]);
                     break;
                 case "prototype+addons":
                     $aRes[] = $this->wrapScriptTag(PATH_formidable . "res/jsfwk/prototype/prototype.js", $conf["pathonly"]);
                     $aRes[] = $this->wrapScriptTag(PATH_formidable . "res/jsfwk/prototype/addons/lowpro/lowpro.js", $conf["pathonly"]);
                     $aRes[] = $this->wrapScriptTag(PATH_formidable . "res/jsfwk/prototype/addons/base/Base.js", $conf["pathonly"]);
                     $aRes[] = $this->wrapScriptTag(PATH_formidable . "res/jsfwk/json/json.js", $conf["pathonly"]);
                     break;
                 case "prototype_addonsonly":
                     $aRes[] = $this->wrapScriptTag(PATH_formidable . "res/jsfwk/prototype/addons/lowpro/lowpro.js", $conf["pathonly"]);
                     $aRes[] = $this->wrapScriptTag(PATH_formidable . "res/jsfwk/prototype/addons/base/Base.js", $conf["pathonly"]);
                     $aRes[] = $this->wrapScriptTag(PATH_formidable . "res/jsfwk/json/json.js", $conf["pathonly"]);
                     break;
                 case "scriptaculous":
                     $aRes[] = $this->wrapScriptTag(PATH_formidable . "res/jsfwk/scriptaculous/scriptaculous.js", $conf["pathonly"]);
                     $aRes[] = $this->wrapScriptTag(PATH_formidable . "res/jsfwk/scriptaculous/effects.js", $conf["pathonly"]);
                     break;
                 case "scriptaculous_dragdrop":
                     $aRes[] = $this->wrapScriptTag(PATH_formidable . "res/jsfwk/scriptaculous/dragdrop.js", $conf["pathonly"]);
                     break;
                 case "scriptaculous_builder":
                     $aRes[] = $this->wrapScriptTag(PATH_formidable . "res/jsfwk/scriptaculous/builder.js", $conf["pathonly"]);
                     break;
             }
         }
     }
     reset($aRes);
     return implode("\n", $aRes);
 }
Ejemplo n.º 30
0
 /**
  * Expects a page ID of a page. Returns a Solr hierarchy notation for the
  * rootline of the page ID.
  *
  * @param array Array of values, an array because of multivalued fields
  * @return array Modified array of values
  */
 public function process(array $values)
 {
     $results = array();
     foreach ($values as $value) {
         list($rootPageUid, $mountPoint) = t3lib_div::trimExplode(',', $value, TRUE, 2);
         $results[] = $this->getSolrRootlineForPageId($rootPageUid, $mountPoint);
     }
     return $results;
 }