/**
  * Lädt ein COnfigurations Objekt nach mit der TS aus der Extension
  * Dabei wird alles geholt was in "plugin.tx_$extKey", "lib.$extKey." und
  * "lib.links." liegt
  *
  * @param string $extKey Extension, deren TS Config geladen werden soll
  * @param string $extKeyTS Extension, deren Konfig innerhalb der
  *     TS Config geladen werden soll.
  *     Es kann also zb. das TS von mklib geladen werden aber darin die konfig für
  *     das plugin von mkxyz
  * @param string $sStaticPath pfad zum TS
  * @param array $aConfig zusätzliche Konfig, die die default  überschreibt
  * @param boolean $resolveReferences sollen referenzen die in lib.
  *     und plugin.tx_$extKeyTS stehen aufgelöst werden?
  * @param boolean $forceTsfePreparation
  * @return tx_rnbase_configurations
  */
 public static function loadConfig4BE($extKey, $extKeyTs = null, $sStaticPath = '', $aConfig = array(), $resolveReferences = false, $forceTsfePreparation = false)
 {
     $extKeyTs = is_null($extKeyTs) ? $extKey : $extKeyTs;
     if (!$sStaticPath) {
         $sStaticPath = '/static/ts/setup.txt';
     }
     if (file_exists(t3lib_div::getFileAbsFileName('EXT:' . $extKey . $sStaticPath))) {
         t3lib_extMgm::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $extKey . $sStaticPath . '">');
     }
     tx_rnbase::load('tx_rnbase_configurations');
     tx_rnbase::load('tx_rnbase_util_Misc');
     $tsfePreparationOptions = array();
     if ($forceTsfePreparation) {
         $tsfePreparationOptions['force'] = true;
     }
     // Ist bei Aufruf aus BE notwendig! (@TODO: sicher???)
     tx_rnbase_util_Misc::prepareTSFE($tsfePreparationOptions);
     $GLOBALS['TSFE']->config = array();
     $cObj = t3lib_div::makeInstance('tslib_cObj');
     $pageTsConfig = self::getPagesTSconfig(0);
     $tempConfig = $pageTsConfig['plugin.']['tx_' . $extKeyTs . '.'];
     $tempConfig['lib.'][$extKeyTs . '.'] = $pageTsConfig['lib.'][$extKeyTs . '.'];
     $tempConfig['lib.']['links.'] = $pageTsConfig['lib.']['links.'];
     if ($resolveReferences) {
         $GLOBALS['TSFE']->tmpl->setup['lib.'][$extKeyTs . '.'] = $tempConfig['lib.'][$extKeyTs . '.'];
         $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_' . $extKeyTs . '.'] = $pageTsConfig['plugin.']['tx_' . $extKeyTs . '.'];
     }
     $pageTsConfig = $tempConfig;
     $qualifier = $pageTsConfig['qualifier'] ? $pageTsConfig['qualifier'] : $extKeyTs;
     // möglichkeit die default konfig zu überschreiben
     $pageTsConfig = t3lib_div::array_merge_recursive_overrule($pageTsConfig, $aConfig);
     $configurations = new tx_rnbase_configurations();
     $configurations->init($pageTsConfig, $cObj, $extKeyTs, $qualifier);
     return $configurations;
 }
 /**
  * Erstellt eine GoogleMap
  *
  * @param tx_rnbase_configurations $configurations
  * @param string $confId
  * @return tx_rnbase_maps_google_Map
  */
 static function createGoogleMap(&$configurations, $confId)
 {
     $map = self::createMap('tx_rnbase_maps_google_Map', $configurations, $confId);
     $keys = $configurations->getKeyNames($confId . 'poi.');
     if (isset($keys)) {
         tx_rnbase::load('tx_rnbase_maps_Util');
         foreach ($keys as $key) {
             $poi = $configurations->get($confId . 'poi.' . $key . '.');
             $poi = tx_rnbase::makeInstance('tx_rnbase_maps_POI', $poi);
             $bubble = tx_rnbase_maps_Util::createMapBubble($poi);
             if (!$bubble) {
                 continue;
             }
             $bubble->setDescription($poi->getDescription());
             // Prüfen, ob ein Icon konfiguriert ist
             $iconConfId = $confId . 'poi.' . $key . '.icon.';
             if ($configurations->get($iconConfId)) {
                 $icon = tx_rnbase::makeInstance('tx_rnbase_maps_google_Icon', $map);
                 $icon = new tx_rnbase_maps_google_Icon($map);
                 $image = $configurations->get($iconConfId . 'image', TRUE);
                 $icon->setImage($image, $configurations->getInt($iconConfId . 'image.file.maxW'), $configurations->getInt($iconConfId . 'image.file.maxH'));
                 $image = $configurations->get($iconConfId . 'shadow', TRUE);
                 $icon->setShadow($image, $configurations->getInt($iconConfId . 'shadow.file.maxW'), $configurations->getInt($iconConfId . 'shadow.file.maxH'));
                 $name = $configurations->get($iconConfId . 'name');
                 $icon->setName($name ? $name : tx_rnbase_util_Misc::createHash(array('name' => $image)));
                 $bubble->setIcon($icon);
             }
             $map->addMarker($bubble);
         }
     }
     return $map;
 }
 protected function getJoins($tableAliases)
 {
     $join = '';
     // Hook to append other tables
     tx_rnbase_util_Misc::callHook('rn_base', 'search_generic_getJoins_hook', array('join' => &$join, 'tableAliases' => $tableAliases), $this);
     return $join;
 }
 public static function callHook($bTest = false)
 {
     self::$test = $bTest;
     // hook aufrufen!!
     tx_rnbase_util_Misc::callHook('rn_base', 'searchbase_handleTableMapping', self::$data);
     return self::$test === false;
 }
 /**
  * Function executed from the Scheduler.
  * Sends an email
  *
  * @return	boolean
  */
 public function execute()
 {
     $success = TRUE;
     $taskId = $this->taskUid;
     tx_rnbase::load('tx_rnbase_util_Misc');
     try {
         $lastRun = $this->getLastRunTime($taskId);
         /* @var $srv tx_mklog_srv_WatchDog */
         $srv = tx_rnbase_util_Misc::getService('mklog', 'WatchDog');
         $filters = array();
         $options = array();
         $options['minimalSeverity'] = $this->getMinimalSeverity();
         $options['forceSummaryMail'] = $this->getForceSummaryMail();
         $options['includeDataVar'] = $this->getIncludeDataVar();
         //damit jede Nachricht nur einmal kommt, auch wenn sie mehrmals vorhanden ist
         if ($this->getGroupEntries()) {
             $options['groupby'] = Tx_Mklog_Utility_Devlog::getMessageFieldName() . ',extkey';
             // wir wollen aber wissen wie oft jede Nachricht vorhanden ist
             $options['count'] = TRUE;
         }
         $srv->triggerMails($this->getEmailReceiver(), $lastRun, $filters, $options);
         $this->updateLastRunTime($taskId);
     } catch (Exception $e) {
         tx_rnbase_util_Logger::fatal('WatchDog failed!', 'mklog', array('Exception' => $e->getMessage()));
         $success = FALSE;
     }
     return $success;
 }
예제 #6
0
 /**
  * It is possible to overwrite this method and return an array of tab functions
  *
  * @return array
  */
 protected function getSubMenuItems()
 {
     $menuItems = tx_t3socials_network_Config::getNewtorkCommunicators();
     array_unshift($menuItems, tx_rnbase::makeInstance('tx_t3socials_mod_handler_Trigger'));
     tx_rnbase_util_Misc::callHook('t3socials', 'modCommunicator_tabItems', array('tabItems' => &$menuItems), $this);
     return $menuItems;
 }
 /**
  * Interne Verarbeitung der Exception
  *
  * @param string $actionName
  * @param Exception $e
  * @param tx_rnbase_configurations $configurations
  *
  * @return string error message
  */
 public function handleException($actionName, Exception $e, tx_rnbase_configurations $configurations)
 {
     // wir prüfen erst mal, ob die exception gefangen werden soll
     $catch = $this->catchException($actionName, $e, $configurations);
     if ($catch !== NULL) {
         return $catch;
     }
     // wenn nicht senden wir ggf den header
     if ($this->send503HeaderOnException($configurations)) {
         header('HTTP/1.1 503 Service Unavailable');
     }
     // wir loggen nun den fehler
     tx_rnbase::load('tx_rnbase_util_Logger');
     if (tx_rnbase_util_Logger::isFatalEnabled()) {
         $extKey = $configurations->getExtensionKey();
         $extKey = $extKey ? $extKey : 'rn_base';
         tx_rnbase_util_Logger::fatal('Fatal error for action ' . $actionName, $extKey, array('Exception' => array('message' => $e->getMessage(), 'code' => $e->getCode(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => $e->getTraceAsString()), '_GET' => $_GET, '_POST' => $_POST));
     }
     // wir senden eine fehlermail
     $addr = tx_rnbase_configurations::getExtensionCfgValue('rn_base', 'sendEmailOnException');
     if ($addr) {
         tx_rnbase_util_Misc::sendErrorMail($addr, $actionName, $e);
     }
     // Now message for FE
     $ret = $this->getErrorMessage($actionName, $e, $configurations);
     return $ret;
 }
 /**
  * Returns content of a file. If it's an image the content of the file is not returned but rather an image tag is.
  * This method is taken from tslib_content
  * TODO: cache result
  *
  * @param string The filename, being a TypoScript resource data type or a FAL-Reference (file:123)
  * @param string Additional parameters (attributes). Default is empty alt and title tags.
  * @return string If jpg,gif,jpeg,png: returns image_tag with picture in. If html,txt: returns content string
  * @see FILE()
  */
 public static function getFileResource($fName, $options = array())
 {
     if (!(is_object($GLOBALS['TSFE']) && is_object($GLOBALS['TSFE']->tmpl))) {
         tx_rnbase::load('tx_rnbase_util_Misc');
         tx_rnbase_util_Misc::prepareTSFE(array('force' => TRUE));
     }
     if (self::isFALReference($fName)) {
         /** @var FileRepository $fileRepository */
         $fileRepository = TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository');
         $fileObject = $fileRepository->findByUid(intval(substr($fName, 5)));
         $incFile = is_object($fileObject) ? $fileObject->getForLocalProcessing(FALSE) : FALSE;
     } else {
         $incFile = self::getFileName($fName);
     }
     if ($incFile) {
         // Im BE muss ein absoluter Pfad verwendet werden
         $fullPath = TYPO3_MODE == 'BE' ? PATH_site . $incFile : $incFile;
         $utility = tx_rnbase_util_Typo3Classes::getGeneralUtilityClass();
         $fileinfo = $utility::split_fileref($incFile);
         if ($utility::inList('jpg,gif,jpeg,png', $fileinfo['fileext'])) {
             $imgFile = $incFile;
             $imgInfo = @getImageSize($imgFile);
             $addParams = isset($options['addparams']) ? $options['addparams'] : 'alt="" title=""';
             $ret = '<img src="' . $GLOBALS['TSFE']->absRefPrefix . $imgFile . '" width="' . $imgInfo[0] . '" height="' . $imgInfo[1] . '"' . self::getBorderAttr(' border="0"') . ' ' . $addParams . ' />';
         } elseif (file_exists($fullPath) && filesize($fullPath) < 1024 * 1024) {
             $ret = @file_get_contents($fullPath);
             $subpart = isset($options['subpart']) ? $options['subpart'] : '';
             if ($subpart) {
                 tx_rnbase::load('tx_rnbase_util_Templates');
                 $ret = tx_rnbase_util_Templates::getSubpart($ret, $subpart);
             }
         }
     }
     return $ret;
 }
 /**
  *
  * @param TYPO3\CMS\Core\Resource\FileReference $media
  */
 private function initFalReference($media)
 {
     $this->record = $media->getProperties();
     // Wir verwenden hier die UID der Referenz
     $this->uid = $media->getUid();
     $this->record['uid'] = $media->getUid();
     $this->record['file_path'] = $media->getPublicUrl();
     $this->record['file_abs_url'] = tx_rnbase_util_Misc::getIndpEnv('TYPO3_SITE_URL') . $this->record['file_path'];
 }
 /**
  * Converts the given mixed data into an hashArray
  * Method taken from tx_div
  *
  * @param   mixed       data to be converted
  * @param   string      string of characters used to split first argument
  * @return  array       an hashArray
  */
 private static function toHashArray($mixed, $splitCharacters = ',;:\\s')
 {
     if (is_string($mixed)) {
         tx_rnbase::load('tx_rnbase_util_Misc');
         $array = tx_rnbase_util_Misc::explode($mixed, $splitCharacters);
         // TODO: Enable empty values by defining a better explode functions.
         for ($i = 0, $len = count($array); $i < $len; $i = $i + 2) {
             $hashArray[$array[$i]] = $array[$i + 1];
         }
     } elseif (is_array($mixed)) {
         $hashArray = $mixed;
     } elseif (is_object($mixed) && method_exists($mixed, 'getArrayCopy')) {
         $hashArray = $mixed->getArrayCopy();
     } else {
         $hashArray = array();
     }
     return $hashArray;
 }
 public function test_encodeParams()
 {
     $params['dat1'] = '1';
     $params['dat2'] = array('1', '2');
     $params['dat3'] = 123;
     $hash1 = tx_rnbase_util_Misc::createHash($params);
     $this->assertEquals(8, strlen($hash1));
     $params['dat2'] = array('2', '2');
     $hash2 = tx_rnbase_util_Misc::createHash($params);
     $this->assertEquals($hash2, $hash1);
     $hash2 = tx_rnbase_util_Misc::createHash($params, FALSE);
     $this->assertTrue($hash2 != $hash1);
     $params = array('1', array(1, 2), 123);
     $hash2 = tx_rnbase_util_Misc::createHash($params);
     $this->assertEquals($hash2, $hash1);
     $params = array(array(1, 2), '1', 123);
     $hash2 = tx_rnbase_util_Misc::createHash($params);
     $this->assertEquals($hash2, $hash1);
 }
 /**
  * Enter description here...
  *
  * @param string $view default name of view
  * @param tx_rnbase_configurations $configurations
  * @return string
  */
 function render($view, &$configurations)
 {
     $this->_init($configurations);
     $templateCode = tx_rnbase_util_Files::getFileResource($this->getTemplate($view, '.html'));
     if (!strlen($templateCode)) {
         tx_rnbase::load('tx_rnbase_util_Misc');
         tx_rnbase_util_Misc::mayday('TEMPLATE NOT FOUND: ' . $this->getTemplate($view, '.html'));
     }
     // Die ViewData bereitstellen
     $viewData =& $configurations->getViewData();
     // Optional kann schon ein Subpart angegeben werden
     $subpart = $this->getMainSubpart($viewData);
     if (!empty($subpart)) {
         $templateCode = tx_rnbase_util_Templates::getSubpart($templateCode, $subpart);
         if (!strlen($templateCode)) {
             tx_rnbase::load('tx_rnbase_util_Misc');
             tx_rnbase_util_Misc::mayday('SUBPART NOT FOUND: ' . $subpart);
         }
     }
     $controller = $this->getController();
     if ($controller) {
         // disable substitution marker cache
         if ($configurations->getBool($controller->getConfId() . '_caching.disableSubstCache')) {
             tx_rnbase_util_Templates::disableSubstCache();
         }
     }
     $out = $templateCode;
     $out = $this->createOutput($templateCode, $viewData, $configurations, $configurations->getFormatter());
     $out = $this->renderPluginData($out, $configurations);
     if ($controller) {
         $params = array();
         $params['confid'] = $controller->getConfId();
         $params['item'] = $controller->getViewData()->offsetGet('item');
         $params['items'] = $controller->getViewData()->offsetGet('items');
         $markerArray = $subpartArray = $wrappedSubpartArray = array();
         tx_rnbase_util_BaseMarker::callModules($out, $markerArray, $subpartArray, $wrappedSubpartArray, $params, $configurations->getFormatter());
         $out = tx_rnbase_util_BaseMarker::substituteMarkerArrayCached($out, $markerArray, $subpartArray, $wrappedSubpartArray);
     }
     return $out;
 }
    /**
     * sendet eine error mail für alle tasks die hängen geblieben
     * sind. außerdem werden diese tasks auf freezdeteced = exectime gesetzt
     * @param array $aPossiblyFrozenTasks
     * @return void
     */
    protected function handleFrozenTasks($aPossiblyFrozenTasks)
    {
        //Nachrichten für den error mail versand
        $aMessages = $aUids = array();
        foreach ($aPossiblyFrozenTasks as $aPossiblyFrozenTask) {
            $classname = tx_rnbase_util_TYPO3::isTYPO62OrHigher() ? get_class(unserialize($aPossiblyFrozenTask['serialized_task_object'])) : $aPossiblyFrozenTask['classname'];
            $aMessages[] = '"' . $classname . ' (Task-Uid: ' . $aPossiblyFrozenTask['uid'] . ')"';
            $aUids[] = $aPossiblyFrozenTask['uid'];
        }
        //wir bauen eine exception damit die error mail von rnbase gebaut werden kann
        $sMsg = '
			Die folgenden Scheduler Tasks hängen seit mindestens ' . tx_mklib_util_Scheduler::getFormattedTime($this->getOption('threshold')) . ' : ' . implode(', ', $aMessages);
        $oException = new Exception($sMsg, 0);
        tx_rnbase::load('tx_rnbase_util_Misc');
        //die Mail soll immer geschickt werden
        $aOptions = array('ignoremaillock' => true);
        tx_rnbase_util_Misc::sendErrorMail($this->getOption('receiver'), 'tx_mklib_scheduler_CheckRunningTasks', $oException, $aOptions);
        //bei allen hängen geblibenen tasks freezedetected setzen
        //damit erst nach der errinerungszeit wieder eine mail versendet wird
        $this->setFreezeDetected($aUids);
        return $sMsg;
    }
 /**
  * Die Methode kann von Kindklassen verwendet werden.
  * @param string $template das HTML-Template
  * @param Tx_Rnbase_Domain_Model_RecordInterface $item
  * @param tx_rnbase_util_FormatUtil $formatter der zu verwendente Formatter
  * @param string $confId Pfad der TS-Config
  * @param string $marker Name des Markers
  * @return String das geparste Template
  */
 protected function prepareTemplate($template, $item, $formatter, $confId, $marker)
 {
     tx_rnbase_util_Misc::callHook('rn_base', 'mediaMarker_initRecord', array('item' => &$item, 'template' => &$template), $this);
     return $template;
 }
 /**
  * Returns TSFE.
  *
  * @return \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController or tslib_fe
  */
 public static function getTSFE()
 {
     if (!is_object($GLOBALS['TSFE'])) {
         tx_rnbase::load('tx_rnbase_util_Misc');
         tx_rnbase_util_Misc::prepareTSFE();
     }
     return $GLOBALS['TSFE'];
 }
 /**
  * Return file info for all references for the given reference data
  *
  * @param string $refTable
  * @param string $refField
  * @return array
  */
 public static function getReferencesFileInfo($refTable, $refUid, $refField)
 {
     $refs = self::getReferences($refTable, $refUid, $refField);
     $res = array();
     if (isset($refs['rows']) && count($refs['rows'])) {
         foreach ($refs['rows'] as $uid => $record) {
             $fileInfo = self::getFileInfo($record);
             if (isset($refs['files'][$uid])) {
                 $fileInfo['file_path_name'] = $refs['files'][$uid];
             }
             $fileInfo['file_abs_url'] = tx_rnbase_util_Misc::getIndpEnv('TYPO3_SITE_URL') . $fileInfo['file_path_name'];
             $res[$uid] = $fileInfo;
         }
     }
     return $res;
 }
 /**
  * @param boolean $defaultConfig
  *
  * @return tx_rnbase_configurations
  */
 private function getConfigurations($defaultConfig = false)
 {
     tx_rnbase_util_Misc::prepareTSFE();
     $configurations = new tx_rnbase_configurations();
     $cObj = t3lib_div::makeInstance('tslib_cObj');
     $config = array('myConfId.' => array('filter.' => array('sort.' => array('fields' => 'firstField,secondField', 'link.' => array('noHash' => 1)))));
     if ($defaultConfig) {
         $config['myConfId.']['filter.']['sort.']['default.'] = array('field' => 'firstField', 'sortOrder' => 'asc');
     }
     $configurations->init($config, $cObj, 'mklib', 'mklib');
     return $configurations;
 }
예제 #18
0
 /**
  * Liefert einen Sortierungslink für das gegebene Feld
  * @param string $sSortField
  * @return string
  */
 public function createSortLink($sSortField, $sLabel)
 {
     //das ist aktuell gesetzt
     $sCurrentSortField = tx_rnbase_parameters::getPostOrGetParameter('sortField');
     $sCurrentSortRev = tx_rnbase_parameters::getPostOrGetParameter('sortRev');
     //wir verweisen immer auf die aktuelle Seite
     //es kann aber schon ein sort parameter gesetzt sein
     //weshalb wir alte entfernen
     $sUrl = preg_replace('/&sortField=.*&sortRev=[^&]*/', '', tx_rnbase_util_Misc::getIndpEnv('TYPO3_REQUEST_URL'));
     //sort richtung rausfinden
     //beim initialen Aufruf (spalte noch nicht geklickt) wird immer aufsteigend sortiert
     if ($sCurrentSortField != $sSortField) {
         $sSortRev = 'asc';
     } else {
         //sonst das gegenteil vom aktuellen
         $sSortRev = $sCurrentSortRev == 'desc' ? 'asc' : 'desc';
     }
     //prüfen ob Parameter mit ? oder & angehängt werden müssen
     $sAddParamsWith = strstr($sUrl, '?') ? '&' : '?';
     //jetzt setzen wir den aktuellen Sort parameter zusammen
     $sSortUrl = $sUrl . $sAddParamsWith . 'sortField=' . $sSortField . '&sortRev=' . $sSortRev;
     //noch den Pfeil für die aktuelle Sortierungsrichtung ggf. einblenden
     $sSortArrow = $sCurrentSortField == $sSortField ? '<img' . Tx_Rnbase_Backend_Utility_Icons::skinImg($GLOBALS['BACK_PATH'], 'gfx/red' . ($sSortRev == 'asc' ? 'up' : 'down') . '.gif', 'width="7" height="4"') . ' alt="" />' : '';
     return '<a href="' . htmlspecialchars($sSortUrl) . '">' . $sLabel . $sSortArrow . '</a>';
 }
 protected static function getReferenceFileInfo(\TYPO3\CMS\Core\Resource\FileReference $reference)
 {
     // getProperties gets merged values from reference and the orig file
     $info = $reference->getProperties();
     // add some fileinfo
     $info['file_path_name'] = $reference->getOriginalFile()->getPublicUrl();
     $info['file_abs_url'] = tx_rnbase_util_Misc::getIndpEnv('TYPO3_SITE_URL') . $info['file_path_name'];
     $info['file_name'] = $info['name'];
     return $info;
 }
 /**
  * Create the panel of buttons for submitting the form or otherwise perform operations.
  *
  * @return	array	all available buttons as an assoc. array
  */
 function getButtons()
 {
     global $BACK_PATH, $BE_USER;
     $buttons = array('csh' => '', 'view' => '', 'record_list' => '', 'shortcut' => '');
     // TODO: CSH
     $buttons['csh'] = Tx_Rnbase_Backend_Utility::cshItem('_MOD_' . $this->MCONF['name'], '', $GLOBALS['BACK_PATH'], '', TRUE);
     if ($this->id && is_array($this->pageinfo)) {
         // View page
         $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(Tx_Rnbase_Backend_Utility::viewOnClick($this->pageinfo['uid'], $BACK_PATH, Tx_Rnbase_Backend_Utility::BEgetRootLine($this->pageinfo['uid']))) . '">' . '<img' . Tx_Rnbase_Backend_Utility_Icons::skinImg($BACK_PATH, 'gfx/zoom.gif') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '" hspace="3" alt="" />' . '</a>';
         // Shortcut
         if ($BE_USER->mayMakeShortcut()) {
             $buttons['shortcut'] = $this->getDoc()->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
         }
         // If access to Web>List for user, then link to that module.
         if ($BE_USER->check('modules', 'web_list')) {
             $href = $BACK_PATH . 'db_list.php?id=' . $this->pageinfo['uid'] . '&returnUrl=' . rawurlencode(tx_rnbase_util_Misc::getIndpEnv('REQUEST_URI'));
             $buttons['record_list'] = '<a href="' . htmlspecialchars($href) . '">' . '<img' . Tx_Rnbase_Backend_Utility_Icons::skinImg($BACK_PATH, 'gfx/list.gif') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList', 1) . '" alt="" />' . '</a>';
         }
     }
     return $buttons;
 }
 /**
  * This method is used to define new fields for adding or editing a task
  * In this case, it adds an email field
  *
  * @param	array					$taskInfo: reference to the array containing the info used in the add/edit form
  * @param	object					$task: when editing, reference to the current task object. Null when adding.
  * @param	tx_scheduler_Module		$parentObject: reference to the calling object (Scheduler's BE module)
  * @return	array					Array containg all the information pertaining to the additional fields
  *									The array is multidimensional, keyed to the task class name and each field's id
  *									For each field it provides an associative sub-array with the following:
  *										['code']		=> The HTML code for the field
  *										['label']		=> The label of the field (possibly localized)
  *										['cshKey']		=> The CSH key for the field
  *										['cshLabel']	=> The code of the CSH label
  */
 protected function _getAdditionalFields(array &$taskInfo, $task, $parentObject)
 {
     // Initialize extra field value
     if (!array_key_exists(MKLOG_FIELD_EMAIL, $taskInfo) || empty($taskInfo[MKLOG_FIELD_EMAIL])) {
         if ($parentObject->CMD == 'add') {
             // New task
             $taskInfo[MKLOG_FIELD_EMAIL] = '';
         } elseif ($parentObject->CMD == 'edit') {
             // Editing a task, set to internal value if data was not submitted already
             $taskInfo[MKLOG_FIELD_EMAIL] = $task->getEmailReceiver();
             $taskInfo[MKLOG_FIELD_FORCE] = $task->getForceSummaryMail();
             $taskInfo[MKLOG_FIELD_SEVERITY] = $task->getMinimalSeverity();
             $taskInfo[MKLOG_FIELD_DATAVAR] = $task->getIncludeDataVar();
             $taskInfo[MKLOG_FIELD_GROUP_ENTRIES] = $task->getGroupEntries();
         } else {
             // Otherwise set an empty value, as it will not be used anyway
             $taskInfo[MKLOG_FIELD_EMAIL] = '';
         }
     }
     // Write the code for the field
     $additionalFields = array();
     // Email
     $fieldID = 'field_' . MKLOG_FIELD_EMAIL;
     // Note: Name qualifier MUST be "tx_scheduler" as the tx_scheduler's BE module is used!
     $fieldCode = '<input type="text" name="tx_scheduler[' . MKLOG_FIELD_EMAIL . ']" id="' . $fieldID . '" value="' . $taskInfo[MKLOG_FIELD_EMAIL] . '" size="50" />';
     $additionalFields[$fieldID] = array('code' => $fieldCode, 'label' => 'LLL:EXT:mklog/locallang_db.xml:scheduler_watchdog_field_' . MKLOG_FIELD_EMAIL, 'cshKey' => '_MOD_tools_txschedulerM1');
     // Minimum severity
     $fieldID = 'field_' . MKLOG_FIELD_SEVERITY;
     $fieldCode = '<select name="tx_scheduler[' . MKLOG_FIELD_SEVERITY . ']" id="' . $fieldID . '">';
     $srv = tx_rnbase_util_Misc::getService('mklog', 'WatchDog');
     $severities = $srv->getSeverities();
     foreach ($severities as $key => $label) {
         $fieldCode .= '<option value="' . $key . '" ' . ($taskInfo[MKLOG_FIELD_SEVERITY] == $key ? 'selected="selected"' : '') . ' />' . $label . "</option>\n";
     }
     $fieldCode .= '</select>';
     $additionalFields[$fieldID] = array('code' => $fieldCode, 'label' => 'LLL:EXT:mklog/locallang_db.xml:scheduler_watchdog_field_' . MKLOG_FIELD_SEVERITY, 'cshKey' => '_MOD_tools_txschedulerM1');
     // Force summary
     $fieldID = 'field_' . MKLOG_FIELD_FORCE;
     $fieldCode = '<input type="radio" name="tx_scheduler[' . MKLOG_FIELD_FORCE . ']" id="' . $fieldID . '" value="1" ' . ($taskInfo[MKLOG_FIELD_FORCE] ? 'checked="checked"' : '') . ' /> Yes';
     $fieldCode .= '<input type="radio" name="tx_scheduler[' . MKLOG_FIELD_FORCE . ']" id="' . $fieldID . '" value="0" ' . ($taskInfo[MKLOG_FIELD_FORCE] ? '' : 'checked="checked"') . ' /> No';
     $additionalFields[$fieldID] = array('code' => $fieldCode, 'label' => 'LLL:EXT:mklog/locallang_db.xml:scheduler_watchdog_field_' . MKLOG_FIELD_FORCE, 'cshKey' => '_MOD_tools_txschedulerM1');
     // data_var
     $fieldID = 'field_' . MKLOG_FIELD_DATAVAR;
     $fieldCode = '<input type="radio" name="tx_scheduler[' . MKLOG_FIELD_DATAVAR . ']" id="' . $fieldID . '" value="1" ' . ($taskInfo[MKLOG_FIELD_DATAVAR] ? 'checked="checked"' : '') . ' /> Yes';
     $fieldCode .= '<input type="radio" name="tx_scheduler[' . MKLOG_FIELD_DATAVAR . ']" id="' . $fieldID . '" value="0" ' . ($taskInfo[MKLOG_FIELD_DATAVAR] ? '' : 'checked="checked"') . ' /> No';
     $additionalFields[$fieldID] = array('code' => $fieldCode, 'label' => 'LLL:EXT:mklog/locallang_db.xml:scheduler_watchdog_field_' . MKLOG_FIELD_DATAVAR, 'cshKey' => '_MOD_tools_txschedulerM1');
     // data_var
     $fieldID = 'field_' . MKLOG_FIELD_GROUP_ENTRIES;
     if (isset($taskInfo[MKLOG_FIELD_GROUP_ENTRIES])) {
         $fieldValue = $taskInfo[MKLOG_FIELD_GROUP_ENTRIES];
     } else {
         // default
         $fieldValue = 1;
     }
     $fieldCode = '<input type="radio" name="tx_scheduler[' . MKLOG_FIELD_GROUP_ENTRIES . ']" id="' . $fieldID . '" value="1" ' . ($fieldValue ? 'checked="checked"' : '') . ' /> Yes';
     $fieldCode .= '<input type="radio" name="tx_scheduler[' . MKLOG_FIELD_GROUP_ENTRIES . ']" id="' . $fieldID . '" value="0" ' . ($fieldValue ? '' : 'checked="checked"') . ' /> No';
     $additionalFields[$fieldID] = array('code' => $fieldCode, 'label' => 'LLL:EXT:mklog/locallang_db.xml:scheduler_watchdog_field_' . MKLOG_FIELD_GROUP_ENTRIES, 'cshKey' => '_MOD_tools_txschedulerM1');
     return $additionalFields;
 }
 function setup()
 {
     unset($GLOBALS['TSFE']);
     tx_rnbase_util_Misc::prepareTSFE();
 }
예제 #23
0
 /**
  * Send an exeption mail for all exceptions during the store log process
  *
  * @param \Exception $e
  *
  * @TODO: add recursive call check for exceptions (
  *     throw exception, only block at secnd exception.
  *     so the gelf logger can log the exception
  *     and only a recursion of logging will prevented.
  * )
  *
  * @return void
  */
 protected function handleExceptionDuringLogging(\Exception $e)
 {
     // try to send mail
     $addr = \tx_rnbase_configurations::getExtensionCfgValue('rn_base', 'sendEmailOnException');
     if ($addr) {
         \tx_rnbase_util_Misc::sendErrorMail($addr, 'Mklog\\DevlogLogger', $e);
     }
 }
 /**
  * sends a exception mail
  *
  * @param string $email
  * @param Exception $exception
  * @return void
  */
 protected function sendErrorMail($email, Exception $exception)
 {
     tx_rnbase::load('tx_rnbase_util_Misc');
     $options = array('ignoremaillock' => true);
     tx_rnbase_util_Misc::sendErrorMail($email, get_class($this), $exception, $options);
 }
 /**
  * Do the magic and publish all new messages thu the transport.
  *
  * @return bool Returns TRUE on successful execution, FALSE on error
  */
 public function execute()
 {
     $failures = $successes = array();
     $transport = $this->getTransport();
     // initialize the transport
     $transport->initialize($this->getOptions());
     /* @var $message \DMK\Mklog\Domain\Model\DevlogEntryModel */
     foreach ($this->findMessages() as $message) {
         try {
             $transport->publish($message);
             // mark entry as send for current transport
             $this->markAsTransported($message);
             $successes[$message->getUid()] = '';
         } catch (\Exception $e) {
             $failures[$message->getUid()] = $e->getMessage();
         }
     }
     // shutdown the transport
     $transport->shutdown();
     \tx_rnbase::load('tx_rnbase_util_Logger');
     $success = empty($failures);
     $msg = sprintf('WatchDog %1$s has %2$d messages send and %3$d failures.', $this->getTransportId(), count($successes), count($failures));
     \tx_rnbase_util_Logger::devLog($msg, 'mklog', $success ? \tx_rnbase_util_Logger::LOGLEVEL_DEBUG : \tx_rnbase_util_Logger::LOGLEVEL_WARN, array('transport' => $this->getTransportId(), 'successes' => $successes, 'failures' => $failures));
     // create a flash message for the beuser
     \tx_rnbase::load('tx_rnbase_util_TYPO3');
     if (\tx_rnbase_util_TYPO3::getBEUserUID()) {
         \tx_rnbase::load('tx_rnbase_util_Misc');
         \tx_rnbase_util_Misc::addFlashMessage($msg, 'MK LOGGER WatchDog', $success ? 0 : 2, false);
     }
     return $success;
 }
 /**
  * End TimeTrack section
  */
 protected function pullTT()
 {
     tx_rnbase_util_Misc::pullTT();
 }
 /**
  * @param tx_rnbase_parameters $parameters
  * @param tx_rnbase_configurations $configurations
  *
  * @return string
  */
 function execute(&$parameters, &$configurations)
 {
     $this->setConfigurations($configurations);
     $debugKey = $configurations->get($this->getConfId() . '_debugview');
     $debug = $debugKey && ($debugKey === '1' || $_GET['debug'] && array_key_exists($debugKey, array_flip(tx_rnbase_util_Strings::trimExplode(',', $_GET['debug']))) || $_POST['debug'] && array_key_exists($debugKey, array_flip(tx_rnbase_util_Strings::trimExplode(',', $_POST['debug']))));
     if ($debug) {
         $time = microtime(TRUE);
         $memStart = memory_get_usage();
     }
     if ($configurations->getBool($this->getConfId() . 'toUserInt')) {
         if ($debug) {
             tx_rnbase_util_Debug::debug('Converting to USER_INT!', 'View statistics for: ' . $this->getConfId() . ' Key: ' . $debugKey);
         }
         $configurations->convertToUserInt();
     }
     // Add JS or CSS files
     $this->addResources($configurations, $this->getConfId());
     $cacheHandler = $this->getCacheHandler($configurations, $this->getConfId() . '_caching.');
     $out = $cacheHandler ? $cacheHandler->getOutput() : '';
     $cached = !empty($out);
     if (!$cached) {
         $viewData =& $configurations->getViewData();
         tx_rnbase_util_Misc::pushTT(get_class($this), 'handleRequest');
         $out = $this->handleRequest($parameters, $configurations, $viewData);
         tx_rnbase_util_Misc::pullTT();
         if (!$out) {
             // View
             // It is possible to set another view via typoscript
             $viewClassName = $configurations->get($this->getConfId() . 'viewClassName');
             $viewClassName = strlen($viewClassName) > 0 ? $viewClassName : $this->getViewClassName();
             // TODO: error handling...
             $view = tx_rnbase::makeInstance($viewClassName);
             $view->setTemplatePath($configurations->getTemplatePath());
             if (method_exists($view, 'setController')) {
                 $view->setController($this);
             }
             // Das Template wird komplett angegeben
             $tmplName = $this->getTemplateName();
             if (!$tmplName || !strlen($tmplName)) {
                 tx_rnbase_util_Misc::mayday('No template name defined!');
             }
             $view->setTemplateFile($configurations->get($tmplName . 'Template', TRUE));
             tx_rnbase_util_Misc::pushTT(get_class($this), 'render');
             $out = $view->render($tmplName, $configurations);
             tx_rnbase_util_Misc::pullTT();
         }
         if ($cacheHandler) {
             $cacheHandler->setOutput($out);
         }
     }
     if ($debug) {
         $memEnd = memory_get_usage();
         tx_rnbase_util_Debug::debug(array('Action' => get_class($this), 'Conf Id' => $this->getConfId(), 'Execution Time' => microtime(TRUE) - $time, 'Memory Start' => $memStart, 'Memory End' => $memEnd, 'Memory Consumed' => $memEnd - $memStart, 'Cached?' => $cached ? 'yes' : 'no', 'CacheHandler' => is_object($cacheHandler) ? get_class($cacheHandler) : '', 'SubstCacheEnabled?' => tx_rnbase_util_Templates::isSubstCacheEnabled() ? 'yes' : 'no'), 'View statistics for: ' . $this->getConfId() . ' Key: ' . $debugKey);
     }
     // reset the substCache after each view!
     tx_rnbase_util_Templates::resetSubstCache();
     return $out;
 }
 protected static function getErrorMailHtml($e, $actionName)
 {
     $htmlPart = '<strong>This is an automatic email from TYPO3. Don\'t answer!</strong>';
     $htmlPart .= '<div><strong>UNCAUGHT EXCEPTION FOR VIEW: ' . $actionName . '</strong></div>';
     $htmlPart .= '<p><strong>Message:</strong><br />' . $e->getMessage() . '</p>';
     $htmlPart .= '<p><strong>Stacktrace:</strong><pre>' . $e->__toString() . '</pre></p>';
     $htmlPart .= '<p><strong>SITE_URL</strong><br />' . tx_rnbase_util_Misc::getIndpEnv('TYPO3_SITE_URL') . '</p>';
     $get = self::removePasswordParams($_GET);
     if (count($get)) {
         $htmlPart .= '<p><strong>_GET</strong><br />' . var_export($get, TRUE) . '</p>';
     }
     $post = self::removePasswordParams($_POST);
     if (count($post)) {
         $htmlPart .= '<p><strong>_POST</strong><br />' . var_export($post, TRUE) . '</p>';
     }
     $cookie = self::removePasswordParams($_COOKIE);
     if (count($cookie)) {
         $htmlPart .= '<p><strong>_COOKIE</strong><br />' . var_export($cookie, TRUE) . '</p>';
     }
     $htmlPart .= '<p><strong>_SERVER</strong><br />' . var_export(self::removePasswordParams($_SERVER), TRUE) . '</p>';
     if ($e instanceof tx_rnbase_util_Exception) {
         $additional = $e->getAdditional();
         if ($additional) {
             $htmlPart .= '<p><strong>Additional Data:</strong><br />' . strval($additional) . '</p>';
         }
     }
     tx_rnbase::load('tx_rnbase_util_TYPO3');
     $htmlPart .= '<p><strong>BE_USER:</strong> ' . tx_rnbase_util_TYPO3::getBEUserUID() . '</p>';
     $htmlPart .= '<p><strong>FE_USER:</strong> ' . tx_rnbase_util_TYPO3::getFEUserUID() . '</p>';
     return $htmlPart;
 }
 /**
  * wie über TS
  */
 public static function initSpamProtectionConfig()
 {
     tx_rnbase::load('tx_rnbase_util_Misc');
     tx_rnbase_util_Misc::prepareTSFE();
     $GLOBALS['TSFE']->spamProtectEmailAddresses = 2;
     $GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst'] = '&#8203;(at)&#8203';
     //tq_seo extension hat einen hook der auf das folgende feld zugreift.
     //wenn dieses nicht da ist bricht der test mit einer php warnung ab, was
     //wir verhindern wollen!
     $GLOBALS['TSFE']->rootLine[0]['uid'] = 1;
 }
 /**
  * @param int $pageId
  *
  * @return void
  */
 public static function enableLinkCreation($pageId = 1)
 {
     tx_rnbase_util_Misc::prepareTSFE();
     $GLOBALS['TSFE']->sys_page = tx_rnbase_util_TYPO3::getSysPage();
     $GLOBALS['TSFE']->initTemplate();
     $GLOBALS['TSFE']->id = $pageId;
 }