TYPO3 CMS  TYPO3_6-2
Bootstrap.php
Go to the documentation of this file.
1 <?php
3 
20 
26 class Bootstrap {
31  protected $extbaseConfiguration = array(
32  'vendorName' => 'TYPO3\\CMS',
33  'extensionName' => 'SysNote',
34  'pluginName' => 'Note',
35  );
36 
41 
46 
51  $this->databaseConnection = $databaseConnection ?: $GLOBALS['TYPO3_DB'];
52  }
53 
62  public function run($controllerName, $actionName, array $arguments = array()) {
63  if (!$this->expectOutput($arguments)) {
64  return '';
65  }
66  $arguments['controller'] = ucfirst(trim($controllerName));
67  $arguments['action'] = lcfirst(trim($actionName));
68  $this->overrideGetArguments($arguments);
70  $extbaseBootstrap = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Core\\Bootstrap');
71  $content = $extbaseBootstrap->run('', $this->extbaseConfiguration);
72  $this->revertGetArguments();
73  return $content;
74  }
75 
84  protected function expectOutput(array $arguments = array()) {
85  // no pids set
86  if (!isset($arguments['pids']) || empty($arguments['pids']) || empty($GLOBALS['BE_USER']->user['uid'])) {
87  return FALSE;
88  }
89  $pidList = $this->databaseConnection->cleanIntList($arguments['pids']);
90  if (empty($pidList)) {
91  return FALSE;
92  }
93  // check if there are records
94  return ($this->databaseConnection->exec_SELECTcountRows('*', 'sys_note', 'pid IN (' . $pidList . ')' . BackendUtility::deleteClause('sys_note')) > 0);
95  }
96 
107  protected function overrideGetArguments(array $arguments) {
108  $this->currentGetArguments = $_GET;
109  $_GET['tx_sysnote_note'] = $arguments;
110  }
111 
117  protected function revertGetArguments() {
118  if (is_array($this->currentGetArguments)) {
120  }
121  }
122 }
__construct(DatabaseConnection $databaseConnection=NULL)
Definition: Bootstrap.php:50
overrideGetArguments(array $arguments)
Definition: Bootstrap.php:107
expectOutput(array $arguments=array())
Definition: Bootstrap.php:84
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static deleteClause($table, $tableAlias='')