public static function getExCss($file) { if ($file[0] == "/") { $file = GenFun::get_full_url($file); } return '<link rel="stylesheet" type="text/css" href="' . $file . '">'; }
function __construct($img, $obj = NULL) { $this->img = $img; SetPublicProp::go($this, $obj); if (is_null($this->dir)) { $this->dir = $_SERVER['DOCUMENT_ROOT'] . "/" . $this->projectPath; } $this->fullURL = GenFun::get_full_url($this->dir); }
function __construct($conn = NULL, $database = NULL) { if (is_null(GlobalMas::$conn)) { GlobalMas::$conn = GenFun::hostConnect($database); } $this->filesRelPath = $_SERVER['DOCUMENT_ROOT'] . "/" . $this->projectPath . "files/"; $this->filesPath = GenFun::get_full_url($this->filesRelPath); $this->commentRatingMngr = new Rating('commentRatings', 'comments'); $this->commentMngr = new Comment(1, $this->filesPath); }
public static function init() { GlobalMas::$host = 'mydatabase.ctla99hip1d5.us-west-2.rds.amazonaws.com:3306'; GlobalMas::$user = '******'; GlobalMas::$pass = '******'; GlobalMas::$database = "compiler"; GlobalMas::$filesPath_relative = "/Modules/generated_files/compiler/"; GlobalMas::$filesPath_absolute = $_SERVER["DOCUMENT_ROOT"] . GlobalMas::$filesPath_relative; GlobalMas::$filesPath_web = GenFun::get_full_url(GlobalMas::$filesPath_absolute) . "/"; //------------------------------------------------------ ProjectGlobal::$compileObj = array("compile" => array(array("save_path" => "", "compileType" => "inject", "outputContent" => array("saveas" => "index.html"), "imagesProp" => array("base64" => true, "fileProp" => array("fileTypeProp" => array("png" => array("quality" => 100), "jpeg" => array("quality" => 90)))), "files" => array("data.js" => array("base64" => false)), "getIncluded" => false, "minify" => true))); }
public static function init() { Compiler::init(array("css" => "min_single", "js" => "min_single", "getServices" => array("except" => Import::getImportPath() . "service.php"), "global" => array("copy" => array(Import::$uber_src_path . "service.php", Import::getImportPath() . "index.php"), "getImages" => true, "code" => array("tmpl" => array("replace" => array("replaceSrc" => false, "\${images}" => Import::$uber_src_path . "/global/images/")))), "compile" => array(array("id" => "min_single", "minify" => true, "copy" => array(), "code" => array("css" => array("singleFile" => true, "path" => "global/css/"), "js" => array("singleFile" => true, "path" => "global/js/"))), array("id" => "min_multi", "minify" => true, "code" => array("css" => array("singleFile" => false, "path" => "global/css/"), "js" => array("singleFile" => false, "path" => "global/js/"))), array("id" => "unmin", "code" => array("css" => array("singleFile" => false, "path" => "global/css/"), "js" => array("singleFile" => false, "path" => "global/js/"))), array("id" => "unmin_raw", "raw" => true)))); //------------------------------------------------ GlobalMas::$host = self::$host; GlobalMas::$pass = self::$pass; GlobalMas::$user = self::$user; GlobalMas::$database = self::$database; UploadHandler::$projectFilesPath = ProjectGlobal::$projectFilesPath; //UploadHandler::$rootFilesPath = "/upload/generated_files/"; self::$filesLocalPath = $_SERVER['DOCUMENT_ROOT'] . "/" . UploadHandler::$rootFilesPath . self::$projectFilesPath; self::$filesPath = GenFun::get_full_url(self::$filesLocalPath); }
function __construct($initialize = true) { $options = json_decode(stripslashes($_REQUEST['options']), true); $default_local_url = GenFun::get_local_url('/Modules/generated_files'); $default_url = GenFun::get_full_url('/Modules/generated_files'); $this->options = array('script_url' => $default_local_url, 'upload_dir' => isset($_REQUEST['dir']) ? $default_local_url . "/" . $_REQUEST['dir'] . '/' : $default_local_url . '/', 'upload_url' => isset($_REQUEST['dir']) ? $default_url . "/" . $_REQUEST['dir'] . '/' : $default_url . '/', 'user_dirs' => false, 'mkdir_mode' => 0755, 'param_name' => 'files', 'delete_type' => 'DELETE', 'access_control_allow_origin' => '*', 'access_control_allow_credentials' => false, 'access_control_allow_methods' => array('OPTIONS', 'HEAD', 'GET', 'POST', 'PUT', 'PATCH', 'DELETE'), 'access_control_allow_headers' => array('Content-Type', 'Content-Range', 'Content-Disposition'), 'download_via_php' => false, 'inline_file_types' => '/\\.(gif|jpe?g|png)$/i', 'accept_file_types' => '/.+$/i', 'max_file_size' => null, 'min_file_size' => 1, 'max_number_of_files' => null, 'max_width' => null, 'max_height' => null, 'min_width' => 1, 'min_height' => 1, 'discard_aborted_uploads' => true, 'orient_image' => true, 'image_versions' => array('thumbnail' => array('max_width' => 80, 'max_height' => 80))); if ($options) { $this->options = array_merge($this->options, $options); } if ($initialize) { $this->initialize(); } }
function __construct($conn = NULL, $database = "{DATABASE}") { if (is_null($conn)) { $this->conn = GenFun::hostConnect($database); } $this->videoRelPath = $_SERVER['DOCUMENT_ROOT'] . "/" . $this->projectPath . "files/"; $this->thumbRelPath = $this->videoRelPath . "thumb/"; $this->videoPath = GenFun::get_full_url($this->videoRelPath); $this->thumbPath = $this->videoPath . "thumb/"; $this->uploadClass = new UploadHandler(null, false); $this->videoRatingMngr = new Rating('videoRatings', 'videos'); $this->commentRatingMngr = new Rating('commentRatings', 'comments'); $this->videoCommentMngr = new Comment('videoComments', $this->s3Path . "thumb/"); }
function __construct($conn = NULL, $database = NULL) { if (is_null($conn)) { $this->conn = GenFun::hostConnect($database); } $this->videoPath = GenFun::get_full_url(dirname(__FILE__)) . "files/"; $this->thumbPath = $this->videoPath . "thumb/"; $this->videoRelPath = dirname(__FILE__) . "/files/"; $this->thumbRelPath = $this->videoRelPath . "thumb/"; //------------------------------------------------------------------------- $this->newVideoPath = GenFun::get_full_url(dirname(__FILE__)) . "new_files/"; $this->newThumbPath = $this->newVideoPath . "thumb/"; $this->newVideoRelPath = dirname(__FILE__) . "/new_files/"; $this->newThumbRelPath = $this->newVideoRelPath . "thumb/"; }
function __construct($conn = NULL, $database = "{DATABASE}") { if (is_null($conn)) { $this->conn = GenFun::hostConnect($database); } $this->generated_files_path = $_SERVER["DOCUMENT_ROOT"] . "/Modules/generated_files/videoOrganizer_v0/"; $this->videoRelPath = $this->generated_files_path . "files/"; $this->thumbRelPath = $this->videoRelPath . "thumb/"; $this->videoPath = GenFun::get_full_url($this->generated_files_path . "files/"); $this->thumbPath = $this->videoPath . "thumb/"; //------------------------------------------------------------------------- $this->newVideoRelPath = $_SERVER["DOCUMENT_ROOT"] . "/Modules/generated_files/videoOrganizer_v0/new_files/"; $this->newThumbRelPath = $this->newVideoRelPath . "thumb/"; $this->newVideoPath = GenFun::get_full_url($this->newVideoRelPath); $this->newThumbPath = $this->newVideoPath . "thumb/"; }
public function codiad_CFG($hash) { $dir_relative = GlobalMas::$filesPath_relative . $hash . "/"; $dir = GlobalMas::$filesPath_absolute . $hash . "/"; //----------------------------------------------------- if (!file_exists($dir . "codiad")) { Archive::extract(GlobalMas::$filesPath_absolute . "/codiad.zip", $dir); //----------------------------------------------------- $config_contents = FileFolder::file_get_contents($dir . "codiad/config.php"); $config_contents = str_replace("{BASE_PATH}", $dir . "codiad", $config_contents); $config_contents = str_replace("{BASE_URL}", GenFun::get_full_url($dir . "codiad"), $config_contents); FileFolder::file_put_contents($dir . "codiad/config.php", $config_contents); //--------------------------------------------------------- exec("ln -s " . $dir . "compile " . $dir . "codiad/workspace/compile" . " 2>&1", $output); exec("ln -s " . $dir . " " . $dir . "codiad/workspace/root" . " 2>&1", $output); //--------------------------------------------------------- if (strpos(join($output), "Errno::") !== false) { krumo($output); die; } } }
function archive($folderPath = NULL) { $folderPath = dirname(__FILE__) . "/files/new_files/"; //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, "func" => "archive"); $dirArray = array(); $myDirectory; //---------------------------------------------------------- //$this->move(dirname(__FILE__)."/files/videoOrganizer/thumb/",$folderPath.'thumb/'); //$this->move(dirname(__FILE__)."/files/videoOrganizer/",$folderPath); //---------------------------------------------------------- $myDirectory = opendir($folderPath); //---------------------------------------------------------- $videoPath = GenFun::get_full_url(dirname(__FILE__)) . "files/videoOrganizer/"; //---------------------------------------------------------- $this->move($folderPath, $folderPath, " ", "_"); //---------------------------------------------------------- $this->move($folderPath . 'thumb/', $folderPath . 'thumb/', " ", "_"); //---------------------------------------------------------- while ($entryName = readdir($myDirectory)) { if (stristr($entryName, '.mp4')) { array_push($dirArray, array('title' => $entryName, 'orig_title' => $entryName, 'hash' => GenFun::encrypt($entryName), 'path' => $videoPath, 'mp4' => $entryName, 'thumbnail_url' => "thumb/" . GenFun::str_lreplace(".mp4", ".png", $entryName))); } } //---------------------------------------------------------- $this->move($folderPath, $folderPath, "_", " "); //---------------------------------------------------------- $this->move($folderPath . 'thumb/', $folderPath . 'thumb/', "_", " "); //---------------------------------------------------------- $this->move($folderPath . 'thumb/', dirname(__FILE__) . "/files/videoOrganizer/thumb/"); $this->move($folderPath, dirname(__FILE__) . "/files/videoOrganizer/"); //---------------------------------------------------------- $chk = $this->_insertContents($dirArray); return $chk; }
<?php require_once dirname(__FILE__) . "/ProjectGlobal.php"; require_once Import::$uber_src_path . "/server/smarty/libs/Smarty.class.php"; //------------------------------------------------------------------------------------------------ function compile_CFG($prop) { $smarty = new Smarty(); $smarty->assign($prop); $string = $smarty->fetch(dirname(__FILE__) . '/compile.tpl'); return $string; } //---------------------------------------- if (isset($_GET['compile']) && $_GET['compile'] == 1 && !isset($_COOKIE['compile_curl'])) { $compiler = new Compiler(ProjectGlobal::$compileObj); foreach ($compiler->compilers as $key => $compile) { $zipPath = rtrim(GenFun::get_full_url($compile->compilePath), "/") . ".zip"; $prop = ["save_path" => $compile->save_path, "filesize" => number_format(FileFolder::getFileSize($zipPath)), "zipPath" => $zipPath, "fullPath" => GenFun::get_full_url($compile->compilePath), "width" => $_GET['width'], "height" => $_GET['height']]; if ($key == 0) { $prop['style'] = true; } echo compile_CFG($prop); } //krumo($compiler); } //----------------------------------------
public static function currentCss($fileName, $concat = 'global/css/') { $file = GenFun::get_full_url(self::getImportPath()) . $concat . $fileName; if (self::chk($file, false)) { self::exCss($file); } }
public function getCompile($hash) { //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, 'result' => array(), "func" => "getCompile"); //---------------------------------------------------------- if (is_null($hash)) { $chk['bool'] = false; $chk['message'] = $this->notifications_CFG(["head" => "Error:", "message" => "hash was empty or null"]); return $chk; } //---------------------------------------------------------- $chk = Result::go("Select Concat('" . GlobalMas::$filesPath_web . "', compiles.dir) as url, compiles.*, \r\n\t\tfiles.hash as files_hash \r\n\t\tFrom \r\n\t\tcompiles, files\r\n\t\tWhere \r\n\t\tcompiles.files_id = files.id \r\n\t\tAND \r\n\t\tcompiles.hash = '" . $hash . "'"); //---------------------------------------------------------- $chk['result'][0]['download_link'] = GenFun::get_full_url(Import::$uber_src_path . "server/werm/services/Download.php") . "?url=" . rtrim($chk['result'][0]['url'], "/") . ".zip"; //---------------------------------------------------------- return $chk; }
function __construct() { $this->fullURL = GenFun::get_full_url(dirname(__FILE__) . "/" . $this->largeImg_dir); $this->largeImg_dir = dirname(__FILE__) . "/" . $this->largeImg_dir; $this->thumbImg_dir = dirname(__FILE__) . "/" . $this->thumbImg_dir; }
public function getDownloadUrl() { return $this->downloadUrl = GenFun::get_full_url(FileFolder::getPathFromFile($_SERVER["SCRIPT_FILENAME"])) . "Download.php"; }
<?php $example_root = dirname($_SERVER["SCRIPT_FILENAME"]) . "/"; if ($_POST["comb"] == "init") { ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="<?php echo GenFun::get_full_url(dirname(__FILE__) . "/"); ?> index.css"> <title><?php echo basename($example_root); ?> </title> <?php Import::uber("default_import.php"); //------------------------------------------------ $result = StringUtil::replaceOverlap($example_root, Import::$uber_src_path, ""); $result = str_replace("examples/", "", $result["result"][0]); $result = StringUtil::str_lreplace("/", "", $result) . ".php"; if (file_exists(Import::$uber_src_path . "client/" . $result)) { Import::uber("client/" . $result); } //------------------------------------------------ Import::css(array("index.css", "index.scss"), ["notExistException" => false, "wUber" => false]); } else { if ($_POST["comb"] == "post") {
var GlobalCls = Class.extend({ host:window.location.protocol+"//"+window.location.host, uber_src:"<?php echo Import::$uber_src_path; ?> ", uber_src_whost:"<?php echo GenFun::get_full_url(Import::$uber_src_path); ?> ", imagePath:"<?php echo GenFun::get_full_url(Import::$uber_src_path); ?> global/images/", gateway:"<?php echo file_exists($path = dirname($_SERVER['SCRIPT_FILENAME']) . "/service.ignore.php") ? GenFun::get_full_url($path) : GenFun::get_full_url(Import::$uber_src_path . "service.ignore.php"); ?> ", defaultService:undefined, //gateway:"http://awwthentic.com/Modules/DOM/uber_src/service.php", //gateway:"service.php", css:window.location.protocol+"//"+window.location.host+"/Modules/DOM/uber_src/global/css/", tmpl:window.location.protocol+"//"+window.location.host+"/Modules/DOM/uber_src/global/tmpls/", //agent:true, width:undefined, height:undefined, styles:[], classIDCount:0, //baseURL:"http://www.awwthentic.com/Modules/DOM/examples/sites/pmbl/", //baseURL:"http://localhost:8888/Modules/current/pmbl/", highestZ:[],
public function chk() { //------------------------------------------- //init var //------------------------------------------- $bool = true; $delete = false; $file = $this->file_absolute; //------------------------------------------- foreach (Import::$filesLoaded as &$value) { if ($file == $value) { $bool = false; } } if ($bool) { $bool = Import::fileExist($file, $this->notExistException); //--------------------------------------- if (!$bool) { return $bool; } //--------------------------------------- array_push(Import::$filesLoaded, $file); //--------------------------------------- if ($this->ext == "js") { echo Html::getExJs($file) . PHP_EOL; return $bool; } else { if ($this->ext == "css") { echo Html::getExCss($file) . PHP_EOL; return $bool; } else { if ($this->ext == "scss") { $file = GenFun::get_full_url(self::compileSass($file)); echo Html::getExCss($file) . PHP_EOL; return $bool; } else { if ($this->importFunction == "include") { require_once "Compiler.php"; $modified = "HHH" . filectime($file) . "HHH"; $newPath = $this->newPath_CFG($file) . "_" . $modified . ".php"; // krumo(Import::$latestFiles); /*if (isset(Import::$latestFiles[$file]) && FileFolder::file_exists($newPath) && Import::$latestFiles[$file] == filectime($newPath)){ //print_r("kdhsf"); unset(Import::$latestFiles[$file]); }*/ //----------------------------------- //krumo(Import::$latestFiles); if (!FileFolder::file_exists($newPath)) { $content = file_get_contents($file); //----------------------------------- $prop = array("output" => $content, "onRemoveMatch" => array("Import", "onRemoveMatch"), "src_path" => $file, "matchProp" => array("ignoreIfExistInMatch" => array("<link"))); //--------------------------------------------- $css = new Compile_CSS($prop); $content = $css->output_updated; //$newPath = self::newPath_CFG($file); //--------------------------------------------- //krumo($file); /*$newScss = $newPath.".scss"; $content = self::replaceEnv(Import::$uber_src_path."GlobalSass.scss"); FileFolder::file_put_contents($newScss, $content.$css->mergedCode_noTag); $newCss = $newPath.".css"; //$output = shell_exec("/usr/local/bin/sass --scss -t uncompressed --sourcemap=none ".$newScss." ".$newCss); exec("/usr/local/bin/sass --scss --sourcemap=none ".$newScss." ".$newCss." 2>&1", $output);*/ /*if (strpos(join($output), "Errno::") !== false) { krumo($output); die(); };*/ FileFolder::file_put_contents($newPath, $content); $this->file_absolute_tmp = $file = $newPath; $this->compile_css = $css; $file = Compiler::brand_CFG($file); } else { $file = $newPath; $file = Compiler::brand_CFG($file); } //--------------------------------------------- /*if (sizeof($code->tmpl->matches) > 0) { echo '<!--{'.$file.'}-->'.$code->tmpl->mergedCode; }*/ //--------------------------------------------- /*$txt = Compiler::brand("script", $orig_txt, $file); $txt = Compiler::brand("style", $txt, $file); //----------------------------------- if ($txt != $orig_txt) { $delete = true; //------------------------------- $file = FileFolder::getPathFromFile($file).FileFolder::getFileName($file).".".FileFolder::getFileExt($file); $file = str_replace(array(Import::$uber_src_path, Import::getImportPath()), Compiler::$unminifiedPath_raw, $file); FileFolder::file_put_contents($file, $txt); }*/ //----------------------------------- //if($delete) FileFolder::delete($file); } } } } if ($bool && !is_null($this->importFunction) && !$this->externalLink) { eval($this->importFunction . " '" . $file . "';"); } } //------------------------------------------- return $bool; }
public function fileFromCrop() { //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, "func" => "fileFromCrop"); //---------------------------------------------------------- $this->src = urldecode($this->src); //---------------------------------------------------------- if (strrpos($this->src, "://") !== false) { $this->src = GenFun::get_local_url($this->src); } else { $this->src = Import::getImportPath() . $this->src; } //---------------------------------------------------------- clearstatcache(); //---------------------------------------------------------- if (!file_exists($this->src)) { $chk['bool'] = false; $chk['message'] = "{$this->src} does not exist"; return $chk; } //---------------------------------------------------------- $what = getimagesize($this->src); //---------------------------------------------------------- $ratio = $this->curWidth / $what[0]; $this->coor['w'] = $this->coor['w'] / $ratio; $this->coor['h'] = $this->coor['h'] / $ratio; //---------------------------------------------------------- $this->coor['x'] = $this->coor['x'] / $ratio; $this->coor['y'] = $this->coor['y'] / $ratio; //---------------------------------------------------------- if (is_null($this->width)) { $this->width = $this->coor['w']; } if (is_null($this->height)) { $this->height = $this->coor['h']; } //---------------------------------------------------------- $jpeg_quality = 100; //---------------------------------------------------------- if (is_null($this->src)) { $chk['bool'] = false; $chk['message'] = "src is undefined"; return $chk; } //---------------------------------------------------------- $name = explode("/", $this->src); $name = end($name); $name = substr($name, 0, -4); $name = str_replace(' ', '_', $name); //---------------------------------------------------------- switch (strtolower($what['mime'])) { case 'image/png': $img_r = imagecreatefrompng($this->src); $ext = ".png"; break; case 'image/jpeg': $img_r = imagecreatefromjpeg($this->src); $ext = ".jpg"; break; case 'image/gif': $img_r = imagecreatefromgif($this->src); $ext = ".gif"; break; case 'image/jpg': $img_r = imagecreatefromjpeg($this->src); $ext = ".jpg"; break; default: $chk['bool'] = false; $chk['message'] = "ext is not accepted!!!"; return $chk; } //---------------------------------------------------------- $dst_r = ImageCreateTrueColor($this->width, $this->height); //---------------------------------------------------------- imagecopyresampled($dst_r, $img_r, 0, 0, $this->coor['x'], $this->coor['y'], $this->width, $this->height, $this->coor['w'], $this->coor['h']); //---------------------------------------------------------- $hash = MySQL::getNextInsertID('files'); //---------------------------------------------------------- if (is_object($hash)) { return $hash; } //---------------------------------------------------------- $name = $name . "_crop" . $ext; //---------------------------------------------------------- $filePath = ProjectGlobal::$filesLocalPath . $name; //---------------------------------------------------------- header('Content-type: image/jpeg'); imagejpeg($dst_r, $filePath, $jpeg_quality); //---------------------------------------------------------- $filePath = FileFolder::moveToFolder($filePath, $hash . "/"); //---------------------------------------------------------- $chk['file'] = GenFun::get_full_url($filePath); $chk['rel'] = $filePath; $chk['src'] = $this->src; $chk['ratio'] = $ratio; $chk['result'] = Upload::insertFile($hash . "/" . $name); //---------------------------------------------------------- return $chk; }
<?php Import::modules("checkboxMngr/CheckboxMngr_v0.php"); ?> <script> var GlobalCls = Class.extend({ host:window.location.protocol+"//"+window.location.host, uber_src:"<?php echo GenFun::get_full_url(Import::$uber_src_path); ?> ", imagePath:"<?php echo GenFun::get_full_url(Import::$uber_src_path); ?> global/images/", //gateway:"http://awwthentic.com/Modules/DOM/uber_src/service.php", gateway:"service.php", css:window.location.protocol+"//"+window.location.host+"/Modules/DOM/uber_src/global/css/", tmpl:window.location.protocol+"//"+window.location.host+"/Modules/DOM/uber_src/global/tmpls/", //agent:true, width:undefined, height:undefined, styles:[], classIDCount:0, //baseURL:"http://www.awwthentic.com/Modules/DOM/examples/sites/pmbl/", baseURL:"http://localhost:8888/Modules/current/pmbl/", highestZ:[], loggedIN:0, checkIfLoggedIN:false, defaultService:"{SERVICES_PATH}videoOrganizer/VideoOrganizer.php", //defaultService:"{SERVICES_PATH}Pmbl.php",
public static function init() { self::$filesPath_relative = "/Modules/generated_files/"; self::$filesPath_absolute = $_SERVER["DOCUMENT_ROOT"] . self::$filesPath_relative; self::$filesPath_web = GenFun::get_full_url(self::$filesPath_absolute) . "/"; }
function __construct($obj) { $this->compilers = array(); //------------------------------------------------------------ SetPublicProp::go($this, $obj); //------------------------------------------------------------ $this->compilerGlobal = new Compiler_Global(); //------------------------------------------------------------ //$this->compilePath = array(); //------------------------------------------------------------ $this->compile_id = Compiler::getCompile_id(); //------------------------------------------------------------ //if (is_null($this->compilePath)) $this->compilePath = dirname(Import::getImportPath())."/".$this->compile_id."/"; if (is_null($this->compilePath)) { $this->compilePath = GlobalMas::$filesPath_absolute . "compiler/" . FileFolder::getLastDir($_SERVER["SCRIPT_FILENAME"]) . $this->compile_id . "/"; } //----------------------------------------------------- if (isset($_GET['pageID']) && isset($_COOKIE['compile_curl'])) { GenFun::setCookie("compile_curl", false); } //----------------------------------------------------- $this->compilerGlobal->compilePath = $this->compilePath; //----------------------------------------------------- $this->refresh(); if (is_null($this->url)) { $this->url = GenFun::get_full_url($_SERVER["SCRIPT_NAME"]); } //----------------------------------------------------- $this->compilerGlobal->url = $this->url; //----------------------------------------------------- if (isset($_GET['compile']) && $_GET['compile'] == "1" && !isset($_COOKIE['compile_curl'])) { Compiler::$disabled = false; GenFun::setCookie("compile", true, 1); $this->start(); //die(); } else { if (!isset($_GET['refresh'])) { register_shutdown_function("Compiler::callRegisteredShutdown"); } } }
public function start() { if (is_null($this->folderName)) { if (isset($_GET['pageID'])) { $this->folderName = $_GET['pageID']; } } //--------------------------------------------------------- $folderName = Compile::$minifiedPath; //--------------------------------------------------------- $GET = array_merge($_GET, array()); //--------------------------------------------------------- unset($GET["pageID"]); //--------------------------------------------------------- //$GET["compile"]=0; //$GET['print_cookie'] = 1; unset($GET['refresh']); $_COOKIE['compile_curl'] = 1; //--------------------------------------------------------- $this->url .= "?" . http_build_query($GET); //--------------------------------------------------------- if (is_null($folderName) && FileFolder::getFileName($this->url) != "") { $folderName = explode("/", $this->url); end($folderName); $folderName = prev($folderName); } //--------------------------------------------------------- $this->fileCss = Compile::$minifiedPath . "global/css/" . $this->folderName . "/min.css"; $this->fileJs = Compile::$minifiedPath . "global/js/" . $this->folderName . "/min.js"; $this->fileTmpl = Compile::$minifiedPath . $this->folderName . "/min.php"; //--------------------------------------------------------- $this->fileCssAb = GenFun::get_full_url($this->fileCss); $this->fileJsAb = GenFun::get_full_url($this->fileJs); //--------------------------------------------------------- FileFolder::createFolderStructure($this->fileCss); //--------------------------------------------------------- FileFolder::folderCopy(Import::getImportPath(), Compile::$minifiedPath); FileFolder::folderCopy(Import::getImportPath(), Compile::$unminifiedPath); //--------------------------------------------------------- $this->content = CurlUtil::go(array("url" => $this->url)); //--------------------------------------------------------- preg_match_all('/Fatal error(.*?)<br \\/>/s', $this->content, $errors); //--------------------------------------------------------- if (sizeof($errors[0]) > 0) { krumo($errors[0]); die; } //--------------------------------------------------------- $this->content = $this->css_CFG(); $this->script_CFG(); $this->content = str_replace("<head>", '<head><script type="text/javascript" src="' . $this->fileJsAb . '"></script>' . PHP_EOL, $this->content); $this->content = str_replace("<head>", '<head><link rel="stylesheet" type="text/css" href="' . $this->fileCssAb . '"/>' . PHP_EOL, $this->content); $this->content = str_replace("<head>", '<head>' . PHP_EOL . file_get_contents($this->fileTmpl), $this->content); //--------------------------------------------------------- $this->project = str_replace("<head>", '<head>' . PHP_EOL . file_get_contents($this->fileTmpl), $this->project); //--------------------------------------------------------- FileFolder::delete($this->fileTmpl); //--------------------------------------------------------- $this->project = StringUtil::removeWhiteLines($this->project); //--------------------------------------------------------- file_put_contents(Import::getImportPath() . "project/index.php", $this->project); //--------------------------------------------------------- $this->content = StringUtil::removeWhiteLines($this->content); FileFolder::file_put_contents(Compile::$minifiedPath . "index.php", $this->content); //--------------------------------------------------------- return $this->content; }
static $host = 'mybizpage.db.2585794.hostedresource.com'; static $user = '******'; static $pass = '******'; static $database = "mybizpage"; //---------------------------------------------------- static $email = '*****@*****.**'; static $name = 'heresthebiz'; static $confirmation_url = NULL; static $forgot_url = NULL; //---------------------------------------------------- static $mysqli = NULL; static $projectFilesPath = "fileUploader/files/"; static $filesLocalPath = NULL; static $filesPath = NULL; //---------------------------------------------------- public static function init() { Constants::$host = self::$host; Constants::$pass = self::$pass; Constants::$user = self::$user; Constants::$database = self::$database; Account_v0::$confirmation_url = Import::getImportPath(true) . "confirmation.php"; Account_v0::$forgot_url = Import::getImportPath(true) . "forgot.php"; UploadHandler::$projectFilesPath = ProjectGlobal::$projectFilesPath; UploadHandler::$rootFilesPath = "upload/generated_files/"; } } ProjectGlobal::init(); ProjectGlobal::$filesLocalPath = $_SERVER['DOCUMENT_ROOT'] . "/" . UploadHandler::$rootFilesPath . ProjectGlobal::$projectFilesPath; ProjectGlobal::$filesPath = GenFun::get_full_url(ProjectGlobal::$filesLocalPath);