17 require_once SQ_INCLUDE_PATH.
'/asset.inc';
55 parent::__construct();
57 if (!$assetid)
return;
58 list($this->_bridgeid, $this->_shadowid) = explode(
':', $assetid);
60 $bridge = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($this->_bridgeid);
61 if (is_null($bridge))
return;
64 $this->data_path = $bridge->data_path.
'/physical_file';
65 $this->data_path_suffix = $bridge->data_path_suffix.
'/physical_file';
66 $this->data_path_public = $bridge->data_path_public.
'/physical_file';
69 if (!$this->_shadowid)
return;
73 foreach ($data as $attr_name => $attr_value) {
74 if (!isset($this->vars[$attr_name]))
continue;
75 $this->vars[$attr_name][
'value'] = ($this->vars[$attr_name][
'type'] ==
'serialise') ? unserialize($attr_value) : $attr_value;
79 $name = basename($full_path);
83 $this->short_name = $name;
84 $this->status = $bridge->status;
85 $this->version =
'0.1';
98 require_once SQ_FUDGE_PATH.
'/standards_lists/mime_types.inc';
99 require_once SQ_FUDGE_PATH.
'/general/file_system.inc';
104 if (SQ_IN_LIMBO && !(isset($_REQUEST[
'a']) && $_REQUEST[
'a'] == $this->
id)) {
105 return parent::printFrontend();
109 $GLOBALS[
'SQ_SYSTEM']->paintLogin(translate(
'login'), translate(
'cannot_access_asset', $this->name));
115 $GLOBALS[
'SQ_SYSTEM']->setGlobalDefine(
'SQ_REPLACE_MYSOURCE_LEVEL_KEYWORDS', FALSE);
120 $ssl_connection = FALSE;
121 $url_info = parse_url(current_url());
122 $protocol = (isset($url_info[
'scheme'])) ? $url_info[
'scheme'] : NULL;
123 if (!is_null($protocol) && $protocol ==
'https') {
124 $ssl_connection = TRUE;
127 $cm = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'cache_manager');
128 $using_ie6 = strpos($_SERVER[
'HTTP_USER_AGENT'],
'MSIE 6.') !== FALSE;
131 if (basename($_SERVER[
'PHP_SELF']) != SQ_CONF_NOCACHE_SUFFIX && ($GLOBALS[
'SQ_SYSTEM']->user instanceof
Public_User)
132 && $this->
effectiveUnrestricted() && empty($_POST) && SQ_CONF_SEND_CACHEABLE_HEADER && $cm->cacheableHeadersEnabledForCurrentProtocol()) {
134 $browser_cache_expiry = $cm->getBrowserCacheExpiry($this->
type(), $this->
id);
135 if (empty($browser_cache_expiry)) {
136 $browser_cache_expiry = $cm->getExpiry($this->
type(), $this->
id);
140 header(
'Expires: '.gmdate(
'D, d M Y H:i:s', time() + $browser_cache_expiry).
' GMT');
141 header(
'Cache-Control: max-age='.$browser_cache_expiry.
', public');
142 header(
'Pragma: cache');
143 header(
'Last-Modified: '.gmdate(
'D, d M Y H:i:s',$QWERTY).
' GMT');
144 }
else if (!$using_ie6 || !$ssl_connection) {
148 if (SQ_CONF_SEND_NO_CACHE_HEADER) {
149 header(
'Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
151 header(
'Cache-Control: must-revalidate, post-check=0, pre-check=0');
154 header(
'Pragma: no-cache');
155 header(
'Expires: '.gmdate(
'D, d M Y H:i:s', time()-3600).
' GMT');
161 header(
'Cache-Control: private, max-age=0, must-revalidate');
162 header(
'Pragma: private');
163 header(
'Expires: '.gmdate(
'D, d M Y H:i:s', time()-3600).
' GMT');
167 header(
'Content-Type: '.$type);
168 header(
'Content-Disposition: inline; filename='.$this->name.
';');
169 header(
'Content-Length: '.filesize($file_path));
171 readfile($file_path);
185 if (empty($this->bridgeid) && empty($this->_shadowid)) {
186 list($this->_bridgeid, $this->_shadowid) = explode(
':', $this->
id);
189 $bridge = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($this->_bridgeid);
190 if (is_null($bridge))
return '';
194 if (strpos($type,
'text') === 0) {
195 require_once (SQ_DATA_PATH.
'/private/conf/file_bridge.inc');
196 $location = FILE_BRIDGE_PATH;
197 $location = rtrim($location,
'/');
198 $full_path = $location.
'/'.$this->_shadowid;
200 $content = file_get_contents($full_path);
201 $content = nl2br($content);
216 if (empty($this->bridgeid) && empty($this->_shadowid)) {
217 list($this->_bridgeid, $this->_shadowid) = explode(
':', $this->
id);
220 $bridge = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($this->_bridgeid);
221 if (is_null($bridge))
return '';
223 require_once (SQ_DATA_PATH.
'/private/conf/file_bridge.inc');
224 $location = FILE_BRIDGE_PATH;
225 $location = rtrim($location,
'/');
226 $full_path = $location.
'/'.$this->_shadowid;
241 require SQ_FUDGE_PATH.
'/standards_lists/mime_types.inc';
242 $ext = get_file_type($this->name);
243 $type = array_get_index($standards_lists_mime_types, $ext,
'text/plain');