Ejemplo n.º 1
0
 public function download()
 {
     global $config;
     $post = $this->post();
     $files = isset($post['files']) ? $post['files'] : array();
     $disabled = isset($post['disabled']) ? $post['disabled'] : array();
     $compress = isset($post['compress']) ? true : false;
     $pkg = new Packager($config['packages']);
     foreach ($disabled as $key => $package) {
         if ($package) {
             $pkg->remove_package($package);
         } else {
             unset($disabled[$key]);
         }
     }
     $contents = $pkg->build_from_files($files);
     $useonly = count($disabled) ? $pkg->get_packages() : null;
     if ($compress) {
         $contents = $this->compress($contents);
     }
     header('Content-Type: ' . $config['packager']['contenttype'] . '; charset=' . $config['packager']['charset']);
     header('Content-Disposition: attachment; filename="' . $config['packager']['exports'] . '"');
     echo $this->get_packager_command($files, $useonly);
     if ($compress) {
         echo $this->get_headers($pkg, $files);
     }
     echo $contents;
 }
Ejemplo n.º 2
0
    public function filterLoad(AssetInterface $asset)
    {
        static $manifest = <<<EOF
name: Application%s
sources: [source.js]

EOF;
        $hash = substr(sha1(time() . rand(11111, 99999)), 0, 7);
        $package = sys_get_temp_dir() . '/assetic_packager_' . $hash;
        mkdir($package);
        file_put_contents($package . '/package.yml', sprintf($manifest, $hash));
        file_put_contents($package . '/source.js', $asset->getContent());
        $packager = new \Packager(array_merge(array($package), $this->packages));
        $content = $packager->build(array(), array(), array('Application' . $hash));
        unlink($package . '/package.yml');
        unlink($package . '/source.js');
        rmdir($package);
        $asset->setContent($content);
    }
Ejemplo n.º 3
0
 /**
  * load a package
  * 
  * @access public
  * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
  */
 function load()
 {
     if (@BitBase::verifyId($this->mPackagerId)) {
         $selectSql = $joinSql = $orderSql = $whereSql = "";
         $bindVars = $ret = array();
         $whereSql = "WHERE pkgv.`packager_id`=?";
         $bindVars[] = $this->mPackagerId;
         $query = "\n\t\t\t\tSELECT pkgv.*, pkgp.*, pkgi.`download_date`, pkgi.`install_date`\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "packager_versions` pkgv\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "packager_packages` pkgp ON( pkgv.`package`=pkgp.`package` )\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "packager_installed` pkgi ON( pkgv.`packager_id`=pkgi.`packager_id` )\n\t\t\t\t{$whereSql}";
         if ($aux = $this->mDb->getRow($query, $bindVars)) {
             $this->mInfo = $aux;
             $this->mInfo['filename'] = $this->getPackageFilename($this->mInfo);
             $this->mInfo['mime_type'] = 'application/zip';
             $this->mInfo['last_modified'] = $this->mInfo['release_date'];
             $this->mInfo['source_file'] = $this->getPackageFilepath($this->mInfo);
             $this->mInfo['package_display_url'] = Packager::getDisplayUrlFromHash($aux);
             $this->mInfo['display_url'] = $this->getDisplayUrlFromHash($aux);
             $this->mInfo['package_url'] = $this->getPackageUrl($aux);
             $this->mInfo['changelog'] = $this->getChangelog();
             $this->mInfo['dependencies'] = $this->getDependencies();
         }
     }
     return count($this->mInfo);
 }
Ejemplo n.º 4
0
function log(message){
	try {
		console.log('' + message)
	}
	catch (e){}
}

var domreadyCallbacks = []
function DomReady(fn){
	domreadyCallbacks.push(fn)
}
 <?php 
if (!isset($_GET['plain'])) {
    $core = dirname(__FILE__) . '/../../../';
    require $core . 'Packager/packager.php';
    $pkg = new Packager(array($core));
    echo $pkg->build(array('DOMReady'), array(), array(), array());
} else {
    ?>
document.write('<scr'+'ipt src="./DOMReady.js?' + (new Date) + '"><'+'/script>');
document.write('<scr'+'ipt src="../../../Source/Utilities/DOMReady.js?' + (new Date) + '"><'+'/script>');
 <?php 
}
?>
</script>

<script>
var loadScript = function(type){
	var count = 0;
	new Element('script', {
		src: '../../Configuration.js?' + type + (new Date),
Ejemplo n.º 5
0
<?php

$config = (include 'config.php');
header('Content-Type: text/javascript');
require dirname(__FILE__) . '/Packager/packager.php';
$pkg = new Packager($config['sources']);
$components = $_GET['require'];
$files = empty($components) ? $pkg->get_all_files() : $pkg->components_to_files(explode(',', $components));
$files = $pkg->complete_files($files);
$exclude_blocks = isset($config['exclude-blocks']) ? $config['exclude-blocks'] : array();
if (isset($_GET['12compat'])) {
    foreach ($exclude_blocks as $i => $block) {
        if ($block == '1.2compat') {
            unset($exclude_blocks[$i]);
        }
    }
}
$output = $pkg->build($files, array(), array(), $exclude_blocks);
echo PHP_EOL . '// Required Files' . PHP_EOL;
foreach ($files as $file) {
    echo "// - {$file}: [" . implode(", ", $pkg->get_file_provides($file)) . "]\n";
}
echo PHP_EOL;
echo $output;
Ejemplo n.º 6
0
<?php

$gBitSystem->verifyPackage('packager');
require_once PACKAGER_PKG_PATH . "Packager.php";
$gPackager = new Packager();
$feedback = array();
// display error when sent back here from the next page
if (!empty($_REQUEST['noselection'])) {
    $feedback['warning'] = "You need to select at least one package to upgrade.";
}
$listHash = $_REQUEST;
$packageList = $gPackager->getList($listHash);
$gBitSmarty->assign('packageList', $packageList);
$gBitSmarty->assign('gPackager', $gPackager);
$gBitSmarty->assign('feedback', $feedback);
$gBitSmarty->assign('next_step', $step + 1);
Ejemplo n.º 7
0
 public static function __import__()
 {
     self::$tgz_dir = Rhaco::def("generic.Packager@path", Rhaco::work("tgz"));
 }
Ejemplo n.º 8
0
#!/usr/bin/php -dphar.readonly=0
<?php 
/**
 * The packager sub-stub for bin/pharext
 */
namespace pharext;

spl_autoload_register(function ($c) {
    return include strtr($c, "\\_", "//") . ".php";
});
set_include_path('phar://' . __FILE__ . ":" . get_include_path());
if (!extension_loaded("Phar")) {
    fprintf(STDERR, "ERROR: Phar extension not loaded\n\n");
    fprintf(STDERR, "\tPlease load the phar extension in your php.ini\n" . "\tor rebuild PHP with the --enable-phar flag.\n\n");
    exit(1);
}
if (ini_get("phar.readonly")) {
    fprintf(STDERR, "ERROR: Phar is configured read-only\n\n");
    fprintf(STDERR, "\tPlease specify phar.readonly=0 in your php.ini\n" . "\tor run this command with php -dphar.readonly=0\n\n");
    exit(1);
}
\Phar::interceptFileFuncs();
\Phar::mapPhar();
$packager = new Packager();
$packager->run($argc, $argv);
__halt_compiler();
Ejemplo n.º 9
0
<?
include(dirname(__FILE__) . "/../packager/packager.php");
header('Content-type: text/javascript');
$packager = new Packager(array(dirname(__FILE__) . "/../core/"));
echo $packager->build_from_files($packager->get_all_files());
?>
Ejemplo n.º 10
0
$packageDir = __DIR__;
$buildDir = __DIR__ . '/Build';
$vendorDir = __DIR__ . '/Vendor';
$sourceDir = __DIR__ . '/Source';
$stylesDir = __DIR__ . '/Styles';
if (!is_dir($buildDir)) {
    mkdir($buildDir);
}
if (!is_dir($buildDir . '/Flames')) {
    mkdir($buildDir . '/Flames');
}
if (!is_dir($buildDir . '/Fuels')) {
    mkdir($buildDir . '/Fuels');
}
// Packager
$pkg = new Packager($packageDir);
echo "Building Lighter.js\n";
foreach ($pkg->get_all_files() as $file) {
    printf("* %s \n", $file);
}
$pkg->write_from_files($buildDir . '/Lighter.js', $pkg->get_all_files());
echo "\n";
// Custom Build
$loader = new UniversalClassLoader();
$loader->registerNamespaces(array('Symfony\\Component' => $vendorDir));
$loader->register();
$fuels = Finder::create()->files()->name('/^Fuel\\.(\\w+)\\.js$/')->in($sourceDir);
echo "Copying Fuels\n";
foreach ($fuels as $fuel) {
    copy($fuel->getRealPath(), $buildDir . '/Fuels/' . $fuel->getFilename());
    printf("* %s \n", $fuel->getFilename());
Ejemplo n.º 11
0
<?php

if (!empty($_REQUEST['package'])) {
    $gPackager = new Packager($_REQUEST['package']);
    $gPackager->load();
} else {
    $gPackager = new Packager();
}
if (@BitBase::verifyId($_REQUEST['packager_id'])) {
    $gVersions = new PackagerVersions($_REQUEST['packager_id']);
    $gVersions->load();
} else {
    $gVersions = new PackagerVersions();
}
$gPackager->verifyServer();
$gBitSmarty->assign_by_ref('gPackager', $gPackager);
$gBitSmarty->assign_by_ref('gVersions', $gVersions);
Ejemplo n.º 12
0
 /**
  * Include a single squeeze package as a single one containing the
  * squeezed source code of all files comprising the package.
  *
  * @param Packager $packager  the packager instance to use
  * @param string   $package   the name of a package
  *
  * @return an array containing PageLayout style HTML elements
  */
 function packageAsCompressedURL($packager, $package)
 {
     return array(array('name' => 'script', 'attributes' => array('src' => $packager->packageURL($package), 'charset' => 'utf-8'), 'content' => ''));
 }
Ejemplo n.º 13
0
<?php

require_once "../kernel/setup_inc.php";
$gBitSystem->verifyPackage('packager');
// we need to find a way to verify that the computer that is downloading is a bitweaver install
//$gBitSystem->verifyPermission( 'p_packager_download_package' );
require_once PACKAGER_PKG_PATH . "Packager.php";
if (empty($_REQUEST['table'])) {
    $gBitSystem->fatalError('Without a table, we do not know what file you want to download.');
} else {
    $gPackager = new Packager();
    $fileHash['source_file'] = $gPackager->getXmlFilepath($_REQUEST['table']);
    if (is_readable($fileHash['source_file'])) {
        $fileHash['last_modified'] = filemtime($fileHash['source_file']);
        $fileHash['mime_type'] = 'text/xml';
        $fileHash['filename'] = $_REQUEST['table'] . '.xml';
        require_once PACKAGER_PKG_PATH . 'download_inc.php';
        exit;
    } else {
        $gBitSystem->fatalError(tra('The requested file could not be found.'));
    }
}