This file is indexed.

/usr/share/php/Cake/View/ViewBlock.php is in cakephp 2.8.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<?php
/**
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @since         CakePHP(tm) v2.1
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */

/**
 * ViewBlock implements the concept of Blocks or Slots in the View layer.
 * Slots or blocks are combined with extending views and layouts to afford slots
 * of content that are present in a layout or parent view, but are defined by the child
 * view or elements used in the view.
 *
 * @package Cake.View
 */
class ViewBlock {

/**
 * Append content
 *
 * @var string
 */
	const APPEND = 'append';

/**
 * Prepend content
 *
 * @var string
 */
	const PREPEND = 'prepend';

/**
 * Block content. An array of blocks indexed by name.
 *
 * @var array
 */
	protected $_blocks = array();

/**
 * The active blocks being captured.
 *
 * @var array
 */
	protected $_active = array();

/**
 * Should the currently captured content be discarded on ViewBlock::end()
 *
 * @var bool
 * @see ViewBlock::end()
 * @see ViewBlock::startIfEmpty()
 */
	protected $_discardActiveBufferOnEnd = false;

/**
 * Start capturing output for a 'block'
 *
 * Blocks allow you to create slots or blocks of dynamic content in the layout.
 * view files can implement some or all of a layout's slots.
 *
 * You can end capturing blocks using View::end(). Blocks can be output
 * using View::get();
 *
 * @param string $name The name of the block to capture for.
 * @throws CakeException When starting a block twice
 * @return void
 */
	public function start($name) {
		if (in_array($name, $this->_active)) {
			throw new CakeException(__d('cake', "A view block with the name '%s' is already/still open.", $name));
		}
		$this->_active[] = $name;
		ob_start();
	}

/**
 * Start capturing output for a 'block' if it is empty
 *
 * Blocks allow you to create slots or blocks of dynamic content in the layout.
 * view files can implement some or all of a layout's slots.
 *
 * You can end capturing blocks using View::end(). Blocks can be output
 * using View::get();
 *
 * @param string $name The name of the block to capture for.
 * @return void
 */
	public function startIfEmpty($name) {
		if (empty($this->_blocks[$name])) {
			return $this->start($name);
		}
		$this->_discardActiveBufferOnEnd = true;
		ob_start();
	}

/**
 * End a capturing block. The compliment to ViewBlock::start()
 *
 * @return void
 * @see ViewBlock::start()
 */
	public function end() {
		if ($this->_discardActiveBufferOnEnd) {
			$this->_discardActiveBufferOnEnd = false;
			ob_end_clean();
			return;
		}
		if (!empty($this->_active)) {
			$active = end($this->_active);
			$content = ob_get_clean();
			if (!isset($this->_blocks[$active])) {
				$this->_blocks[$active] = '';
			}
			$this->_blocks[$active] .= $content;
			array_pop($this->_active);
		}
	}

/**
 * Concat content to an existing or new block.
 * Concating to a new block will create the block.
 *
 * Calling concat() without a value will create a new capturing
 * block that needs to be finished with View::end(). The content
 * of the new capturing context will be added to the existing block context.
 *
 * @param string $name Name of the block
 * @param mixed $value The content for the block
 * @param string $mode If ViewBlock::APPEND content will be appended to existing content.
 *   If ViewBlock::PREPEND it will be prepended.
 * @return void
 */
	public function concat($name, $value = null, $mode = ViewBlock::APPEND) {
		if (isset($value)) {
			if (!isset($this->_blocks[$name])) {
				$this->_blocks[$name] = '';
			}
			if ($mode === ViewBlock::PREPEND) {
				$this->_blocks[$name] = $value . $this->_blocks[$name];
			} else {
				$this->_blocks[$name] .= $value;
			}
		} else {
			$this->start($name);
		}
	}

/**
 * Append to an existing or new block. Appending to a new
 * block will create the block.
 *
 * Calling append() without a value will create a new capturing
 * block that needs to be finished with View::end(). The content
 * of the new capturing context will be added to the existing block context.
 *
 * @param string $name Name of the block
 * @param string $value The content for the block.
 * @return void
 * @deprecated 3.0.0 As of 2.3 use ViewBlock::concat() instead.
 */
	public function append($name, $value = null) {
		$this->concat($name, $value);
	}

/**
 * Set the content for a block. This will overwrite any
 * existing content.
 *
 * @param string $name Name of the block
 * @param mixed $value The content for the block.
 * @return void
 */
	public function set($name, $value) {
		$this->_blocks[$name] = (string)$value;
	}

/**
 * Get the content for a block.
 *
 * @param string $name Name of the block
 * @param string $default Default string
 * @return string The block content or $default if the block does not exist.
 */
	public function get($name, $default = '') {
		if (!isset($this->_blocks[$name])) {
			return $default;
		}
		return $this->_blocks[$name];
	}

/**
 * Check if a block exists
 *
 * @param string $name Name of the block
 * @return bool
 */
	public function exists($name) {
		return isset($this->_blocks[$name]);
	}

/**
 * Get the names of all the existing blocks.
 *
 * @return array An array containing the blocks.
 */
	public function keys() {
		return array_keys($this->_blocks);
	}

/**
 * Get the name of the currently open block.
 *
 * @return mixed Either null or the name of the last open block.
 */
	public function active() {
		return end($this->_active);
	}

/**
 * Get the names of the unclosed/active blocks.
 *
 * @return array An array of unclosed blocks.
 */
	public function unclosed() {
		return $this->_active;
	}

}