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/"; }
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); }
public function getContent() { /*if ($sendCookies) { $opts = array( 'http'=>array( 'method'=>"GET", 'header'=>"Accept-language: en\r\n" . "Cookie: ".$this->getCookieString() ) ); }*/ //--------------------------------------------------------- $context = stream_context_create($opts); //--------------------------------------------------------- $this->cookiePath = Import::getImportPath() . 'cookie.txt'; fopen($this->cookiePath, "w"); //--------------------------------------------------------- $ch = curl_init(); //--------------------------------------------------------- curl_setopt($ch, CURLOPT_URL, $this->url); if ($this->sendCookies) { curl_setopt($ch, CURLOPT_HTTPHEADER, array("Cookie: " . $this->getCookieString())); } curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); if ($this->getCookies) { curl_setopt($ch, CURLOPT_COOKIEJAR, $this->cookiePath); } curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTREDIR, 3); //--------------------------------------------------------- $this->content = curl_exec($ch); # This returns HTML //--------------------------------------------------------- curl_close($ch); //--------------------------------------------------------- if ($this->getCookies) { $this->setCookies(); } //--------------------------------------------------------- if (strpos($this->content, "<h1>Not Found</h1>") !== false) { throw new Exception('Page ' . $this->url . ' does not exist'); } return $this->content; }
public function file_exists_local($file) { if (strpos($file, "http://") !== false) { $file = GenFun::get_local_url($file); } //--------------------------------------------------------- if (file_exists($file)) { } else { if (file_exists(Import::uber_src_path() . $file)) { $file = Import::uber_src_path() . $file; } else { if (file_exists(Import::getImportPath() . $file)) { $file = Import::getImportPath() . $file; } } } return $file; }
private function absolute_CFG() { $this->absolute = Import::getImportPath(true); }
public static function getPrefix() { //---------------------------------------------------------- //init var //---------------------------------------------------------- $preifix = ""; //---------------------------------------------------------- if (substr(Import::getImportPath(), -1) == "/") { $string = substr(Import::getImportPath(), 0, -1); $arr = explode("/", $string); $arr = array_reverse($arr); $prefix = $arr[0] . "_"; } //---------------------------------------------------------- return $prefix; }
public static function cleanURL($file, $replace = "") { $file = str_replace(array(Import::$uber_src_path, Import::getImportPath(), GlobalMas::$filesPath_absolute . Compiler::$importTmpPath), $replace, $file); //--------------------------------------------- return $file; }
public function complete() { if ($this->getIncluded) { FileFolder::dupIncluded(Import::$uber_src_path . "server/", $this->compilePath . "/server/"); FileFolder::dupIncluded(Import::getImportPath(), $this->compilePath . "/", NULL, true); } FileFolder::delete(Compiler::$tmpPath); //FileFolder::dupIncluded("", $this->compilePath."/", NULL,true); }
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; }
function parse_match() { $index = array(); $num++; $txt = NULL; preg_match_all("/type(?:\\s|)=(?:\\s|)(?:[\\'\"])([\\-A-Za-z\\/_\\d\\.]+)(?:[\\'\"])/s", $this->match[3], $tmpl, PREG_SET_ORDER); if (isset($this->match[3]) && $this->match[3] != "") { preg_match("/src(?:\\s|)=(?:\\s|)[\\'\"](.*?)[\\'\"]/s", $this->match[3], $src); if (isset($src[1]) && $src[1] != "") { $filePath = $src[1]; $this->link_CFG($filePath); } } if (is_null($this->link_compile_file) && isset($this->match[4]) && $this->match[4] != "" && (sizeof($tmpl) == 0 || $tmpl[1] == "text/javascript")) { $this->content = $this->match[4]; $this->content = StringUtil::removeWhiteLines($this->content); //----------------------------------------------------- //krumo($this->content); //$this->content = StringUtil::removeAllJSComments($this->content); //krumo($this->content); //----------------------------------------------------- if ($this->getServices) { preg_match_all('/"([^\'"]*\\.(php)[\'"]?)"/', $txtNoComments, $php); if (sizeof($php[0]) > 0) { foreach ($php[1] as $service) { $bool = false; $service = MarkUp::go($service); if (strpos($service, "/") === false) { $service = Import::getImportPath() . $service; } $service = strpos($service, "http://") === false ? $service : GenFun::get_local_url($service); if (!is_null($this->getServices['except'])) { $bool = ArrayUtil::existIn($this->getServices['except'], $service, false); } if (file_exists($service) && !$bool) { $this->services[] = $service; } } } } } /*if (isset($this->match[4]) && $this->match[4] != "") { $filePath = $this->match[4]; $this->link_CFG($filePath); } else { $this->content = $this->match[5]; $this->content = StringUtil::removeWhiteLines($this->content); //----------------------------------------------------- //krumo($this->content); //$this->content = StringUtil::removeAllJSComments($this->content); //krumo($this->content); //----------------------------------------------------- if ($this->getServices) { preg_match_all('/"([^\'"]*\.(php)[\'"]?)"/', $txtNoComments, $php); if (sizeof($php[0]) > 0){ foreach ($php[1] as $service) { $bool = false; $service = MarkUp::go($service); if(strpos($service, "/") === false) $service = Import::getImportPath().$service; $service = (strpos($service, "http://") === false) ? $service : GenFun::get_local_url($service); if (!is_null($this->getServices['except'])) $bool = ArrayUtil::existIn($this->getServices['except'], $service, false); if (file_exists($service) && !$bool) $this->services[] = $service; } } } }*/ }
<?php //------------------------------------------------------------------------ require_once Import::$uber_src_path . "server/werm/services/Account_v0.php"; //-------------------------------------------------------------------- Account_v0::chk(); //-------------------------------------------------------------------- Import::services("bannerHub/BannerHub.php"); //-------------------------------------------------------------------- GlobalMas::$api = new BannerHub(); if (is_null(GlobalMas::$loggedIN) && $_SERVER["SCRIPT_FILENAME"] != Import::getImportPath() . "index.php") { header('Location: ' . Import::getImportPath(true)); } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
public static function get_full_url($file = "") { if (strrpos($file, "https://") === false && strrpos($file, "http://") === false) { if ($file[0] != "/" && strrpos($file, "www.") === false) { $file = Import::getImportPath() . $file; } $file = strpos($file, Import::getDocumentRoot()) === false ? Import::getHost() . $file : preg_replace("/" . str_replace("/", "\\/", Import::getDocumentRoot()) . "/", Import::getHost(), $file, 1); } return $file; /*$documentRoot = substr(Import::getDocumentRoot(), 0, -1); $documentRoot = explode("/", $documentRoot); //---------------------------------------------------------- $arr = array(); //---------------------------------------------------------- for ($i = 1; $i < sizeof($documentRoot); $i++) { $file = strtr($file,array("/".$documentRoot[$i]."/" =>'/')); } //---------------------------------------------------------- $file = str_replace($_SERVER["HTTP_HOST"], "", $file); //---------------------------------------------------------- $file = (substr($file, 0, 1) != "/") ? $file : substr($file, 1); //---------------------------------------------------------- $url = (strpos($_SERVER["HTTP_HOST"], "localhost")) ? "" : "http://"; $url .= (substr($s = $_SERVER["HTTP_HOST"], -1) != "/") ? $s .= "/" : $s; $url .= $file; krumo($url);*/ //---------------------------------------------------------- return $url; }
function __construct($obj) { SetPublicProp::go($this, $obj); $this->file_absolute = !$this->wUber ? Import::getImportPath() . $this->concat . $this->file : Import::$uber_src_path . $this->concat . $this->file; $this->file_web = GenFun::get_full_url($this->file_absolute); }
public function init() { Compiler::init(array("css" => "min_single", "js" => "min_single", "getServices" => array("except" => Import::getImportPath() . "service.php"), "global" => array("images" => array(), "code" => array("tmpl" => array("replace" => array("replaceSrc" => false, "\${images}" => Import::$uber_src_path . "/global/images/")))), "compile" => array(array("outputContent" => array("saveas" => "index.html"), "id" => "min_single", "copy" => array(Import::getImportPath() . "index.php"), "code" => array("css" => array("type" => "single", "path" => "global/css/"), "js" => array("type" => "seperate", "createImportFile" => true), "tmpl" => array("type" => "single", "path" => "global/tmpl/")))))); }
<?php require_once Import::$uber_src_path . "server/werm/services/Account_v0.php"; require_once Import::$uber_src_path . "server/werm/services/videoOrganizer/VideoOrganizer.php"; require_once Import::$uber_src_path . "server/werm/services/videoOrganizer/NewFiles.php"; require_once Import::$uber_src_path . "server/kaloyan/class.krumo.php"; //------------------------------------------------------------------------ $chk = Account_v0::chk(); //------------------------------------------------------------------------ //$obj = new NewFiles(); //$obj->archive(); if (file_exists(Import::getImportPath() . "ProjectGlobal.php")) { require Import::getImportPath() . "ProjectGlobal.php"; }