projects
/
Pman.Core
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix #8131 - chinese translations
[Pman.Core]
/
Asset.php
diff --git
a/Asset.php
b/Asset.php
index
503a94e
..
3e49f8e
100644
(file)
--- a/
Asset.php
+++ b/
Asset.php
@@
-26,6
+26,7
@@
class Pman_Core_Asset extends Pman {
var $types = array(
'css' => 'text/css',
'js' => 'text/javascript',
var $types = array(
'css' => 'text/css',
'js' => 'text/javascript',
+ 'map' => 'application/json'
);
function getAuth()
);
function getAuth()
@@
-36,11
+37,6
@@
class Pman_Core_Asset extends Pman {
function get($s='', $opts = Array())
{
function get($s='', $opts = Array())
{
- if(!empty($_REQUEST['_clear_cache'])) {
- $this->clearCompiledFilesCache();
- }
-
-
$this->sessionState(0);
$bits = explode('/', $s);
$this->sessionState(0);
$bits = explode('/', $s);
@@
-49,18
+45,23
@@
class Pman_Core_Asset extends Pman {
$this->jerr("invalid url");
}
$this->jerr("invalid url");
}
+ $ext = $bits[0];
+ if (preg_match('/\.map$/',$_SERVER['REQUEST_URI'])) {
+ $ext = 'map';
+ }
+
$s = str_replace('/', '-', $bits[1]);
$s = str_replace('/', '-', $bits[1]);
+
$ui = posix_getpwuid(posix_geteuid());
$ff = HTML_FlexyFramework::get();
$ui = posix_getpwuid(posix_geteuid());
$ff = HTML_FlexyFramework::get();
- $compile = session_save_path() . '/' .
- $ui['name'] . '-' . $ff->project . '-' . $ff->version . '-'. $bits[0] . 'compile';
-
- $fn = $compile . '/'. $s .'.'. $bits[0];
+ $compile = self::getCompileDir($bits[0], '', false);
+
+ $fn = $compile . '/'. $s .'.'. $ext;
if (!file_exists($fn)) {
if (!file_exists($fn)) {
- header('Content-Type: '. $this->types[$
bits[0]
]);
+ header('Content-Type: '. $this->types[$
ext
]);
echo "// compiled file not found = $fn";
exit;
echo "// compiled file not found = $fn";
exit;
@@
-111,7
+112,7
@@
class Pman_Core_Asset extends Pman {
$fh = fopen($fn,'r');
fpassthru($fh);
fclose($fh);
$fh = fopen($fn,'r');
fpassthru($fh);
fclose($fh);
- $content = $data;
+
}
}
@@
-121,6
+122,10
@@
class Pman_Core_Asset extends Pman {
}
function post($s='') {
}
function post($s='') {
+ if(!empty($_REQUEST['_clear_cache'])) {
+ $this->clearCompiledFilesCache();
+ }
+
die('invalid');
}
die('invalid');
}
@@
-132,11
+137,15
@@
class Pman_Core_Asset extends Pman {
$compile_dir = session_save_path() . "/";
$compile_dir = session_save_path() . "/";
- $module = (empty($module)) ? $ff->project : $module;
+ if (empty($module)) {
+ $module = $ff->project . (isset($ff->appNameShort) ? '_' . $ff->appNameShort : '');
+ }
+
switch($type) {
case 'js':
case 'css':
switch($type) {
case 'js':
case 'css':
+ case 'scss':
$compile_dir .= implode("-", array(
$ui['name'],
$module,
$compile_dir .= implode("-", array(
$ui['name'],
$module,
@@
-149,6
+158,7
@@
class Pman_Core_Asset extends Pman {
return false;
}
return false;
}
+
if (file_exists($compile_dir)) {
return $compile_dir;
}
if (file_exists($compile_dir)) {
return $compile_dir;
}
@@
-166,19
+176,28
@@
class Pman_Core_Asset extends Pman {
function clearCompiledFilesCache()
{
function clearCompiledFilesCache()
{
+ $au = $this->getAuthUser();
+ if (!$au && !in_array($_SERVER['REMOTE_ADDR'] , array('127.0.0.1','::1'))) {
+ $this->jerr("Cache can only be cleared by authenticated users");
+ }
+
require_once 'System.php';
require_once 'System.php';
+ $ff = HTML_FlexyFramework::get();
+
$mods = $this->modulesList();
$mods = $this->modulesList();
+ $mods[] = $ff->project; // Pman - this was the old format...
+ $mods[] = ''; // Pman + appshortname..
- foreach ($mods as $mod) {
+ foreach ($mods as $mod
ule
) {
$compile_dir = $this->getCompileDir('js', $module, false);
if(!empty($compile_dir)) {
$compile_dir = $this->getCompileDir('js', $module, false);
if(!empty($compile_dir)) {
- System::rm(array('-r', $compiledir));
+ System::rm(array('-r', $compile
_
dir));
}
$compile_dir = $this->getCompileDir('css', $module, false);
if(!empty($compile_dir)) {
}
$compile_dir = $this->getCompileDir('css', $module, false);
if(!empty($compile_dir)) {
- System::rm(array('-r', $compiledir));
+ System::rm(array('-r', $compile
_
dir));
}
}
}
}