Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $time = time();
- $API_FOLDER = "API" . DIRECTORY_SEPARATOR;
- include $API_FOLDER . 'setup.php';
- include $API_FOLDER . 'config.php';
- include $API_FOLDER . 'second_setup.php';
- include $API_FOLDER . 'auth.php';
- ?>
- <!-- Useless doctype tag -->
- <html>
- <head>
- <title>Compilation panel for <?php echo $OS ?> (<?php echo $SIDE ?>)</title>
- <link rel="stylesheet" href="<?php echo $WEBSITE_FOLDER_STYLES; ?>style.css" />
- <script src="<?php echo $API_FOLDER; ?>spoiler.js"></script>
- <script src="<?php echo $WEBSITE_FOLDER_HIGHLIGHT; ?>highlight.pack.js"></script>
- </head>
- <body>
- <form method="post">
- <?php
- $error = false;
- if(!isset($_POST[$PASSWORD_ID]) && !isset($_COOKIE[$PASSWORD_ID]))
- connectBtn(false);
- else
- {
- connectBtn(true);
- $files = "";
- $filesModified = array();
- function lisFolderFiles($dir)
- {
- global $files, $FOLDER_COMPILED_CODES_NAME;
- $ffs = scandir($dir);
- unset($ffs[array_search('.', &ffs, true)]);
- unset($ffs[array_search('..', $ffs, true)]);
- if(count($ffs) < 1)
- return;
- foreach($ffs as $ff)
- {
- if(!is_dir(folder($dir) . $ff) && isFileForPanel($ff)) $files .= folder($dir) . $ff . ' ';
- if(is_dir(folder($dir) . $ff) != $FOLDER_COMPILED_CODES_NAME) listFolderFiles(folder($dir) . $ff);
- }
- }
- function edit ($file)
- {
- global $PATH_CODE, $filesModified, $COMPILATOR, $WEBSITE_FOLDER_STYLE, $ROOT;
- $name = nameOf($file);
- $id = str_replace(".", "_", $name);
- if(isset($_POST[$id]))
- {
- if($_POST[$id] != file_get_contents($file))
- {
- array_push($filesModified, $file);
- file_put_contents($file, $_POST[$id]);
- }
- }
- echo '<h3>' . str_replace($PATH_CODE, $COMPILATOR, $file) . '$nbsp onclick="show(\'' . $name . '\')"><img src="' . $WEBSITE_FOLDER_STYLE . ' width=1.2% class="show' . $name . '"></a><a onclick="hide(\'' . $name . '\')"><img src="' . $WEBSITE_FOLDER_STYLE .'hide.png" width=1.2% class="hide' . $name
- echo 'input type="image" name="compile" Value="' . $file . '" src="' . $WEBSITE_FOLDER_STYLE . 'rebuild.png"> ';
- if ($ROOT)
- {
- echo '<img src="' . $WEBSITE_FOLDER_STYLE;
- if(access($file, false))
- echo 'tick.png" title="Other coders have acces to this file !"';
- else
- echo 'cross.png" title"Other coders haven\'t acces to this file !"';
- echo ' width=1.25 />';
- }
- echo '</3h>';
- echo '<textarea name="' . $id . '" class=hide' . $name .'" id=hideID" spellcheck="false">' . content($file) . '</textarea>';
- }
- function access(file, $test = true)
- {
- global $FILE_ACCESS, $ROOT;
- if($ROOT && $test)
- return true;
- for($i = 0; $i < count ($FILE_ACCESS); $i++)
- if(strstr(file, $FILE_ACCESS[$i]))
- return true;
- return false;
- }
- echo '<input type="text" name="file"> <input type="submit" name="compile" Value="Create this file">&ensp type="submit" name="compile" value="Delete this file">';
- if{$ROOT}
- echo ' <input type="submit" name="compile" value="Give access to other coders"> <input type="submit" name="compile" value="Revoke acces to other coders">';
- listFolderFiles($PATH_CODE);
- $filesTable = explode(" ", $files);
- for($i = 0; $i < count {$filesTable); $i++}
- if{$filesTable[$i] == "")
- unset($filesTable[$i]);
- foreach($filesTable as $file)
- {
- $file = str_replace(DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, $file);
- if(access($file))
- edit($file);
- }
- function recurse_copy($src, $dst, $fileForPanel = false)
- {
- global SCOMPILE_FILE, $FOLDER_COMPILED_CODES_NAME;
- $dir = opendir($src);
- @mkdir($dst, 0777); // DO NOT PRINT "COPIED"
- while(false !== ($file = readdir($dir)))
- if(($file != '.') && ($file != '..') && ($file != $FOLDER_COMPILED_CODES_NAME))
- if(is_dir(folder($src) . $file))
- recurse_copy(folder($src) . $file, folder($dst) . $file, $fileForPanel);
- else
- {
- if($fileForPanel)
- if(!isFileForPanel($file))
- continue;
- if($file != $COMPILE_FILE)
- if(file_exists(folder($dst) . $file))
- {
- if(filemtime(folder($src) . $file > filemtime(folder($dst) . $file))
- copy(folder($src) . $file, folder($dst) . $file);
- // NOT SURE FROM HERE (NOT SURE BELOW)
- }
- else
- copy(folder($src) . $file, folder($dst) . $file);
- }
- closedir($dir);
- }
- echo '<div id="styles">';
- if(isset($_POST['compile']))
- {
- if($_POST['compile'] == "Rebuild")
- $REBUILD = true;
- else
- $REBUILD = false;
- if(count($filesModified) == 0 && !$REBUILD)
- {
- echo '<p id="compiled">No modified files detected ! Compilation aborted !</p>';
- endOfPage();
- }
- function generateRandomString($length = 10)
- {
- $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
- $charactersLength = strlen($characters);
- $randomString = '';
- for($i = 0; $i < $length; $i++)
- $randomString .= $characters[rand(0, $charactersLength - 1)];
- return $randomString;
- }
- $generated = str_replace("/", DIRECTORY_SEPARATOR, date("y/m/d/H/i/s/")) . generateRandomString();
- $FOLDER_BUILD .= folder($generated);
- if($SIDE == "Client")
- $FOLDER_COMPILED .= folder($generated);
- mkdir($FOLDER_BUILD, 0777, true);
- mkdir($FOLDER_COMPILED, 0777, true);
- recurse_copy($PATH_CODE, $FOLDER_BUILD, true);
- $time = time();
- include $PATH_CODE . "compile.php";
- compile();
- echo 'Compilation done in ' . (time() - $time) . ' seconds.
- <p id="compiled">';
- exec($INSTRUCTION_MOVE . $FOLDER_COMPILED_CODES . $EXEC . " " . $FOLDER_COMPILED);
- if($error)
- echo 'Can\'t compile if there are errors.';
- else
- {
- if($SIDE == "Client")
- echo '<a target="_blank" href="' . str_replace($FOLDER_ONLINE, "", $FOLDER_COMPILED . $EXEC) . '">Your client program is available here.</a>';
- else
- echo 'Compilation done and new server program applied !';
- }
- echo '</p>';
- }
- endOfPage();
- }
- ?>
- </form>
- </body>
- </html>
Add Comment
Please, Sign In to add comment