Example #1
0
 public static function callScript($script = null, $args = array())
 {
     if (is_null($script)) {
         throw new Exception("script is null");
     }
     //---------------------------------------------
     $script = $_ENV["phantomjs_scripts"] . '/' . $script;
     //---------------------------------------------
     $arr = FileFolder::fileExistInFolder($script, ["init.werm.js"], true);
     //---------------------------------------------
     $content = "";
     foreach ($arr as $value) {
         $content .= Import::replaceEnv($value);
         //krumo($content);
     }
     //---------------------------------------------
     $content .= FileFolder::file_get_contents($script);
     //print_r($arr);
     //---------------------------------------------
     FileFolder::file_put_contents($script = Import::newPath_CFG($script) . ".js", $content);
     //---------------------------------------------
     $cmd = $_ENV["phantomjs"] . ' ' . $script;
     //---------------------------------------------
     if (sizeof($args) > 0) {
         $cmd .= " " . implode(" ", $args);
     }
     //---------------------------------------------
     $cmd .= ' > /dev/null 2>/dev/null &';
     //---------------------------------------------
     exec($cmd, $outputAndErrors, $return_value);
     //---------------------------------------------
     return $outputAndErrors;
 }
Example #2
0
 public static function getContents($src, $fileLocation)
 {
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, 'traceID' => "minJs");
     //----------------------------------------------------------
     $fileLocation = FileFolder::getPathFromFile($fileLocation);
     //----------------------------------------------------------
     $arr = array_pop(explode(".", $src));
     if ($arr == "php" || $arr == "js" || $arr == "css" || strpos($src, "js?") !== false || strpos($src, "fonts.googleapis.com") !== false) {
         if (file_get_contents($src) == "") {
             $chk['bool'] = false;
             if (file_get_contents($_SERVER["DOCUMENT_ROOT"] . $fileLocation . $src) == "") {
                 $chk['bool'] = false;
                 $chk['message'] = $src . " and " . $_SERVER["DOCUMENT_ROOT"] . $fileLocation . $src . " does not exist!!!";
             } else {
                 $chk['bool'] = true;
                 $src = $_SERVER["DOCUMENT_ROOT"] . $fileLocation . $src;
             }
         }
         if (!$chk['bool']) {
             die(json_encode($chk));
         } else {
             $code = file_get_contents($src);
         }
     } else {
         $code = $src;
     }
     return $code;
 }
Example #3
0
 public function saveImg()
 {
     Trace::output($this->traceID, "saveImg");
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => 1);
     //----------------------------------------------------------
     $img = str_replace('data:image/png;base64,', '', $this->img);
     $img = str_replace(' ', '+', $img);
     $data = base64_decode($img);
     $date = new DateTime();
     //----------------------------------------------------------
     if (is_null($imgName) || $encrypt) {
         $imgName = alphaID($date->getTimestamp()) . ".png";
     }
     //----------------------------------------------------------
     if (file_exists($this->dir)) {
         FileFolder::file_put_contents($this->dir . $imgName, $data);
         $chk["result"] = $this->fullURL . $imgName;
     } else {
         $chk['bool'] = false;
         $chk['message'] = $this->fullURL . " does no exist!!";
     }
     //----------------------------------------------------------
     return $chk;
 }
Example #4
0
function comb($type, $file, $ext = "php")
{
    global $match;
    if (!isset($_POST['comb']) || $_POST['comb'] != "prevent") {
        $_POST['comb'] = $type;
        $arr = FileFolder::fileExistInFolder($file, [$match . "." . $ext, $type . "." . $match . "." . $ext], true);
        //$_POST['hey'] = $arr;
        foreach ($arr as $value) {
            strpos($value, "/" . $match . ".php") > 0 ? require $value : (require_once $value);
        }
    }
}
Example #5
0
 public function createLook($imgByteArr, $imgName, $styleId, $name, $thumbWidth, $thumbHeight)
 {
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => 1);
     //----------------------------------------------------------
     FileFolder::createFolderStructure($this->rootPath . $this->largeImg_dir);
     FileFolder::createFolderStructure($this->rootPath . $this->thumbImg_dir);
     //----------------------------------------------------------
     $chk = $this->saveAsJPEG($imgByteArr, $this->rootPath . $this->largeImg_dir . $imgName);
     //----------------------------------------------------------
     $chk = $this->saveThumb($this->rootPath . $this->largeImg_dir . $imgName, $this->rootPath . $this->thumbImg_dir . $imgName, $thumbWidth, $thumbHeight);
     //----------------------------------------------------------
     return (bool) $chk["bool"] ? $this->setData($styleId, $name, $this->largeImg_dir . $imgName, $this->thumbImg_dir . $imgName) : $chk;
 }
Example #6
0
 public static function go($fileName, $content, $fileLocation, $force)
 {
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, "func" => "createFile");
     //----------------------------------------------------------
     $chk = GenFun::error_CHK(array('fileName' => $fileName, 'content' => $content));
     //----------------------------------------------------------
     if (!$chk['bool']) {
         return $chk;
     }
     //----------------------------------------------------------
     $defaultLocation = $_SERVER["DOCUMENT_ROOT"];
     //----------------------------------------------------------
     if (substr($defaultLocation, -1) != "/") {
         $defaultLocation .= "/";
     }
     //----------------------------------------------------------
     $fileLocation = is_null($fileLocation) ? $defaultLocation : $defaultLocation . $fileLocation;
     //----------------------------------------------------------
     if (!is_dir($fileLocation)) {
         if ($force) {
             $fileLocation = FileFolder::getPathFromFile($fileLocation);
         }
         //------------------------------------------
         if (!is_dir($fileLocation)) {
             $chk['bool'] = false;
             $chk['message'] = $fileLocation . " directory does not exist";
             return $chk;
         }
     }
     //----------------------------------------------------------
     $file = $fileLocation . $fileName;
     //----------------------------------------------------------
     DupIncluded::createFolderStructure($file);
     //----------------------------------------------------------
     if (file_put_contents($file, $content)) {
         $chk['message'] = $file . " has been successfully created!!!!!";
     } else {
         $chk['bool'] = false;
         $chk['message'] = $file . " was not saved or did not save properly.";
     }
     //----------------------------------------------------------
     return $chk;
 }
Example #7
0
 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;
         }
     }
 }
Example #8
0
 public static function upload($file, $path = "", $fileName = NULL, $_mime = NULL)
 {
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, 'result' => array(), "func" => "upload");
     //----------------------------------------------------------
     $mime = FileFolder::getMimeType($file);
     if (!is_null($_mime)) {
         $mime = $_mime;
     }
     //----------------------------------------------------------
     $client = S3Client::factory(array('credentials' => array('key' => S3::$key, 'secret' => S3::$secret)));
     //----------------------------------------------------------
     try {
         $chk['result'] = $client->putObject(['Bucket' => S3::$bucket, 'Key' => $path . (!is_null($fileName) ? $fileName : basename($file)), 'Body' => fopen($file, r), 'ACL' => 'public-read', 'ContentType' => $mime]);
     } catch (S3Exception $e) {
         $chk['bool'] = false;
         $chk['message'] = "upload to s3 bucket: " . S3::$bucket . " failed!!!";
     }
     //----------------------------------------------------------
     return $chk;
 }
Example #9
0
 public function compile()
 {
     if ($this->compileType == "seperate") {
         if (!is_null($this->content)) {
             if (!is_null($this->save_path)) {
                 //$file = $this->save_path;
                 //$file = str_replace(array(Import::uber_src_path(), Import::getImportPath()), "", $file);
                 //-----------------------------------------------------
                 /*$path = (is_null($this->save_dir)) ? FileFolder::getFileName($file,true,true): $this->compilePath.$this->save_dir.FileFolder::getFileName($file,true);
                 		$file = $path.".".$this->saveas_ext;
                 		$this->save_path = $file;*/
                 //-----------------------------------------------------
                 FileFolder::file_put_contents($this->save_path, $this->content_updated);
             }
         }
     }
     if (!is_null($this->images)) {
         $this->images->compile();
     }
 }
Example #10
0
 public function index()
 {
     $path = isset($_GET['path']) ? $_GET['path'] : '';
     $this->filebrowser->set_path($path);
     if ($this->filebrowser->exists()) {
         $this->access->load_access($this->filebrowser->get_folder());
         if ($this->access->is_restricted()) {
             // if user is not logged in redirect to login screen
             if (!$this->auth->logged_in()) {
                 $this->session->set('return_path', $path);
                 $this->session->keep_flash();
                 url::redirect("/login");
                 exit;
             }
         }
         if ($this->access->check_access($this->auth->get_user())) {
             $is_folder = false;
             $single = $this->filebrowser->is_file();
             $folder = $this->filebrowser->get_folder();
             if (!$single) {
                 $fkind = $this->filekind->get_kind_by_file($folder);
                 $kind = isset($fkind['kind']) ? $fkind['kind'] : '';
                 if ($kind == "site") {
                     $single = true;
                     $is_folder = true;
                 } else {
                     if ($kind == "slide") {
                         $slide_files = $this->filebrowser->get_file_list();
                         $slide_files = $this->filebrowser->sort($slide_files);
                         if (sizeof($slide_files) > 0) {
                             $url = Subfolio::$filebrowser->get_link($slide_files[0]->name);
                             url::redirect($url);
                             exit;
                         }
                     }
                 }
             }
             $replace_dash_space = view::get_option('replace_dash_space', true);
             $replace_underscore_space = view::get_option('replace_underscore_space', true);
             $display_file_extensions = view::get_option('display_file_extensions', true);
             if ($single) {
                 $file = $this->filebrowser->get_file();
                 if ($is_folder) {
                 } else {
                     $fkind = $this->filekind->get_kind_by_file($file->name);
                     $kind = isset($fkind['kind']) ? $fkind['kind'] : '';
                 }
                 if (View::view_exists('pages/filekinds/' . $kind)) {
                     $content = View::factory('pages/filekinds/' . $kind);
                     $content->file = $file;
                     if (isset($folder)) {
                         $content->folder = $folder;
                     }
                 } else {
                     $content = View::factory('pages/filekinds/default');
                     $content->file = $file;
                 }
                 if ($folder != '.') {
                     $title_path = $folder . "/" . $file->name;
                 } else {
                     $title_path = $file->name;
                 }
                 $this->template->page_title = FileFolder::make_title_display($title_path, $replace_dash_space, $replace_underscore_space, $display_file_extensions);
                 $this->template->content = $content;
             } else {
                 $folder = $this->filebrowser->get_folder();
                 $content = View::factory('pages/listing');
                 $this->template->content = $content;
                 if ($folder != "") {
                     $this->template->page_title = $folder;
                     $this->template->page_title = FileFolder::make_title_display($folder, $replace_dash_space, $replace_underscore_space, $display_file_extensions);
                 }
             }
         } else {
             $content = View::factory('pages/denied');
             $this->template->content = $content;
         }
     } else {
         $content = View::factory('pages/notfound');
         $this->template->content = $content;
     }
 }
Example #11
0
 public static function pathRelativeToPath($src, $relToSrc, $explode = "")
 {
     $backString = "";
     $num = 0;
     $result = self::replaceOverlap($src, $relToSrc, "", $explode, true);
     //if (strpos($result["result"][1], "/") !== false) {
     $backAmt = explode("/", $result["result"][1]);
     foreach ($backAmt as $key => $value) {
         if ($value != "") {
             $backString .= "../";
             $num++;
         }
     }
     //}
     //krumo($result);
     $lastDir = FileFolder::getLastDir($src, $num);
     return $backString . $result["result"][0];
 }
Example #12
0
 public function getDownloadUrl()
 {
     return $this->downloadUrl = GenFun::get_full_url(FileFolder::getPathFromFile($_SERVER["SCRIPT_FILENAME"])) . "Download.php";
 }
Example #13
0
//-----------------------------------------------------------------------------
indexExist($_REQUEST, array('service', 'functionName'));
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//imports
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
preg_match("/{(.*?)}/", $_REQUEST['service'], $match);
$classPath = sizeof($match) == 0 ? Import::services() . $_REQUEST['service'] : MarkUp::go($_REQUEST['service']);
//----------------------------------------------------------
//if (!file_exists($classPath)) die($classPath." does not exist!!!!");
//----------------------------------------------------------
if (!isset($_REQUEST['service'])) {
    fail_CHK("service is not set!!");
} else {
    if (!FileFolder::file_exists($classPath)) {
        fail_CHK("service (" . $classPath . ") does not exist!!");
    }
}
//----------------------------------------------------------
$class = explode(".", $classPath);
//----------------------------------------------------------
if ($class[1] != "php") {
    fail_CHK("service does not end with '.php'");
}
//----------------------------------------------------------
$class = explode("/", $class[sizeof($class) - 2]);
//----------------------------------------------------------
$class = end($class);
//----------------------------------------------------------
require_once $classPath;
Example #14
0
 public function deleteFile($id, $hardDelete = false)
 {
     Trace::output(self::$traceID, "insertFile", func_get_args());
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, 'result' => array(), "func" => "deleteFile");
     $date = date("Y-m-d H:i:s");
     //----------------------------------------------------------
     if ($hardDelete) {
         $file = GetTable::go("files", array("id" => $id));
         $path = $file['result'][0]['hash'];
         $path = GlobalMas::$filesPath_absolute . $path;
         if (!FileFolder::delete($path)) {
             $chk['bool'] = false;
             $chk['message'] = "file was not deleted";
         }
     }
     if (!$chk['bool']) {
         return $chk;
     } else {
         $chk = Update::go("files", array("deleted" => $date), array('id' => $id));
     }
     //----------------------------------------------------------
     return $chk;
 }
Example #15
0
<?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);
}
//----------------------------------------
Example #16
0
 public function getFiles($css, $srcPath)
 {
     $srcName = FileFolder::getFileName($srcPath);
     $newFolder = FileFolder::getPathFromFile($this->fileCss) . $srcName . "/";
     //---------------------------------------------------------
     $origSrcFolder = FileFolder::getPathFromFile($srcPath);
     //---------------------------------------------------------
     preg_match_all('/(url\\(\\"|url\\(\'|url\\(|src=\')(.*?)(\\)|\'|\\")/s', $css, $files);
     //---------------------------------------------------------
     foreach ($files[2] as $file_key => $origFilePath) {
         $fileAbPath = NULL;
         $newAbPath = NULL;
         $origFilePath = Compile::getBetweenQuot($origFilePath);
         //-----------------------------------------------------
         if (strpos($origFilePath, "../") !== false) {
             $goBack = explode("../", $origFilePath);
             $goBackAmt = sizeof($goBack);
             $srcFolderArr = explode("/", $origSrcFolder);
             $fileLocationArr = array_slice($srcFolderArr, 0, -$goBackAmt);
             $srcFolder = implode($fileLocationArr, "/") . "/";
             $filePath = end($goBack);
         } else {
             $srcFolder = $origSrcFolder;
             $filePath = $origFilePath;
             if (strpos($filePath, "http://") !== false) {
                 $fileAbPath = $filePath;
                 $filePath = FileFolder::getFileName($filePath, false);
                 $newFilePath = $newFolder . $filePath;
             }
         }
         //-----------------------------------------------------
         $filePath = FileFolder::getFileName($filePath, false, true);
         //-----------------------------------------------------
         if (is_null($fileAbPath)) {
             $fileAbPath = $srcFolder . $filePath;
         }
         if (is_null($newAbPath)) {
             $newAbPath = $newFolder . $filePath;
         }
         //-----------------------------------------------------
         $newFilePath = $srcName . "/" . $filePath;
         //-----------------------------------------------------
         if (file_exists(Import::uber_src_path() . $fileAbPath)) {
             $fileAbPath = Import::uber_src_path() . $fileAbPath;
         }
         //-----------------------------------------------------
         if ($fileContent = file_get_contents($fileAbPath)) {
             if (!file_get_contents($newAbPath)) {
                 $css = str_replace($origFilePath, $newFilePath, $css);
                 FileFolder::file_put_contents($newAbPath, $fileContent);
                 FileFolder::file_put_contents(Compile::$unminifiedPath . $this->cleanURL($fileAbPath), $fileContent);
             }
         }
     }
     return $css;
 }
Example #17
0
function replaceFilename($str)
{
    return stripslashes(FileFolder::replaceSpecificChars($str, true));
}
Example #18
0
 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;
 }
Example #19
0
 public static function fileExistInFolder($dir, $lookFor, $recursive = false)
 {
     $dir = FileFolder::getPathFromFile($dir);
     $files = array();
     $arr = explode("/", $dir);
     $file_wType = NULL;
     $path = "";
     //$_POST['hey'] = array();
     //$_POST['hey']['dir'] = $dir;
     foreach ($arr as $value) {
         if ($value != "") {
             $path .= "/" . $value;
             if (strpos($path, $_ENV["werm_root"]) !== false) {
                 foreach ($lookFor as $lookFor_file) {
                     if (FileFolder::file_exists($file = $path . "/" . $lookFor_file)) {
                         array_push($files, $file);
                         //break;
                     }
                 }
             }
         }
     }
     return $files;
 }
Example #20
0
 public static function getLatestFile($arr = NULL, $src = NULL, $sendBackNum = 1)
 {
     if (is_null($arr)) {
         $orig = true;
     }
     if (is_null($arr)) {
         $arr = array();
     }
     if (is_null($src)) {
         $src = Import::$uber_src_path;
     }
     //------------------------------------------------------
     $dir = opendir($src);
     //------------------------------------------------------
     while (false !== ($file = readdir($dir))) {
         if ($file != '.' && $file != '..') {
             $filePath = $src . $file;
             if (is_dir($filePath)) {
                 $arr = FileFolder::getLatestFile($arr, $filePath . "/");
             } else {
                 $arr[$filePath] = filectime($filePath);
             }
         }
     }
     //------------------------------------------------------
     if ($orig) {
         //uasort($arr, "FileFolder::getLatestFile_sort");
         arsort($arr);
         if ($sendBackNum == "*") {
             return $arr;
         } else {
             return array_slice($arr, 0, $sendBackNum, true);
         }
     } else {
         return $arr;
     }
 }
Example #21
0
 public function htmlExist_CHK($dir)
 {
     $dir = explode("?", $dir);
     $dir = $dir[0];
     //---------------------------------------------------------
     $files = FileFolder::getLatestFile(NULL, $dir . "/", "*", false);
     //---------------------------------------------------------
     $bool = true;
     //---------------------------------------------------------
     foreach ($files as $key => $value) {
         if (is_integer(strpos($key, ".html")) || is_integer(strpos($key, "index.php"))) {
             $bool = false;
         }
     }
     //---------------------------------------------------------
     if ($bool) {
         $chk = array();
         $chk = $this->deleteFile($getFile['result'][0]['id'], true);
         $chk['bool'] = false;
         $chk['error'] = true;
         $chk['message'] = $this->notifications_CFG(["head" => "No html file exist inside of:", "message" => $dir]);
         $chk['contents'] = $files;
         die(json_encode($chk));
     }
     return $bool;
 }
Example #22
0
	//Global.loggedIN = 1;
	Trace.externalCall = false;
	TweenEngine.activate(TweenLite);
	obj = new Nav({
		initComplete:nav_complete
	});
}
//-------------------------------------------------------------------------------------
function nav_complete(e) {
	e.targetClass.start();
	//$("#content").css({top:e.targetClass.height + 20, "margin-left":-(e.targetClass.nav_1.width/2)});
	if (window['start'] != undefined) start();
}
</script>
<?php 
$folder = FileFolder::getFileName(basename($_SERVER["SCRIPT_FILENAME"]));
if ($folder == "index") {
    $folder = "home";
}
Import::current("global/js/{$folder}/{$folder}.php", ["notExistException" => false]);
?>
<!--===============================================================-->
<?php 
Import::css("index.scss", ["wUber" => false]);
Import::css("{$folder}.scss", ["wUber" => false, "notExistException" => false]);
?>
<!--===============================================================-->
<?php 
Import::js("client/Respond-master/respond.js");
if (file_exists("ProjectGlobalJS.php")) {
    include "ProjectGlobalJS.php";
Example #23
0
 public static function css($fileName, $concat = 'global/css/')
 {
     if (($ext = FileFolder::getFileExt($fileName)) == "css") {
         $file = strpos($fileName, "http://") !== false ? $fileName : self::uber_src_path(true, $concat . $fileName);
         if (self::chk($file, false)) {
             $result = self::compile_css(file_get_contents($file));
             if ($result['bool']) {
                 echo "<style>" . $result['content'] . "</style>";
             } else {
                 self::exCss($file);
             }
             //self::exCss($file);
         }
     } else {
         if ($ext == "php") {
             self::php($concat . $fileName);
         }
     }
 }
Example #24
0
$out = null;
if (isset($_REQUEST['path'])) {
    $path = htmlspecialchars($_REQUEST['path']);
} else {
    $path = null;
}
if (isset($_REQUEST['content'])) {
    $content = $_REQUEST['content'];
} else {
    $content = null;
}
if (isset($_REQUEST['act'])) {
    $action = htmlspecialchars($_REQUEST['act']);
} else {
    $action = null;
}
// Enregistrement
if ($action == 'save') {
} else {
    if (action == 'edit') {
        echo htmlspecialchars(FTP::getFileContent($path));
    } else {
        if ($action == 'down') {
            $pathinfo = pathinfo($path);
            FileFolder::sendDownloadHeaders($pathinfo['basename']);
            $tempFile = FTP::downloadFile($path, '../tmp/');
            readfile($tempFile);
            exit;
        }
    }
}
Example #25
0
 public static function getExtLink($file)
 {
     $txt = FileFolder::getFileExt($file) == "js" ? Html::getExJs($file) : Html::getExCss($file);
     return $txt;
 }
Example #26
0
 public static function getCompile_id()
 {
     $compile_id = FileFolder::getFileName($_SERVER["SCRIPT_FILENAME"]);
     //---------------------------------------------------------
     if (isset($_GET['pageID'])) {
         $compile_id = $_GET['pageID'];
     }
     //---------------------------------------------------------
     return $compile_id;
 }
Example #27
0
 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);
 }
Example #28
0
<?php

require_once "Import.php";
include Import::$uber_src_path . FileFolder::getFileName(__FILE__, false);
Example #29
0
 public function compile($output = NULL)
 {
     if (!is_null($output)) {
         $this->output_updated = $output;
     }
     $value = NULL;
     foreach ($this->tags as $key => $value) {
         $link = NULL;
         //-------------------------------------------------
         $value->compile();
         //-------------------------------------------------
         if ($this->compileType == "seperate") {
             if (!is_null($value->save_path)) {
                 $link = Html::getExtLink($value->save_path_relative);
             }
         } else {
             if ($this->compileType == "single") {
                 /*if (is_null($this->mergedCode)) $this->mergedCode = "";
                 		//krumo($value->save_path_relative);
                 		$this->mergedCode .= $value->content_updated.PHP_EOL;
                 		krumo($this->mergedCode);*/
             }
         }
         //-------------------------------------------------
         if (!is_null($value->link_compile_file) && is_null($value->link_compile_file->content)) {
             $link = Html::getExtLink($value->link_compile_file->filePath);
         }
         //-------------------------------------------------
         if (!is_null($link)) {
             $this->extLinks .= $link . PHP_EOL;
             //$this->output_updated = str_replace("</head>",$link.PHP_EOL.'</head>', $this->output_updated);
         }
         //krumo($this->output_updated);
     }
     //-------------------------------------------------
     if ($this->compileType == "single" && !is_null($value)) {
         //krumo($value);
         $this->import_save_path_relative = "import." . $value->saveas_ext;
         $this->import_save_path = $this->compilePath . $this->import_save_path_relative;
         FileFolder::file_put_contents($this->import_save_path, $this->mergedCode);
         $link = Compiler::insertExtLink($this->import_save_path_relative);
         //krumo($this->output_updated);
         $this->extLinks .= $link . PHP_EOL;
         //$this->output_updated = str_replace("</head>",$link.PHP_EOL.'</head>', $this->output_updated);
     } else {
         if ($this->compileType == "inject") {
             $this->output_updated = str_replace("<head>", "<head>" . PHP_EOL . $this->mergedCode . PHP_EOL, $this->output_updated);
         }
     }
 }
Example #30
0
 public function compile()
 {
     if ($this->exist && !is_null($this->content) && is_null($this->base64_content)) {
         $this->successfully_saved = FileFolder::file_put_contents($this->save_path, $this->content);
     }
 }