Codex NG's Web Editor - Source

Discussion in 'Web-development' started by Omni Cloud, Jun 15, 2016.

  1. Omni Cloud

    Omni Cloud Banned User

    Joined:
    May 31, 2016
    Messages:
    312
    Likes Received:
    151
    Best Answers:
    0
    I am releasing this for him because as some of you may or may not know he has been a bad boy :p otherwise he would do it himself.

    Codex isn't perfect but he is human and he makes mistakes.

    If you are unsure what this is, here is a video demonstration of what it does.

    Maybe this code or parts of it will be useful to someone. :)
    form.php
    PHP:
    1.  
    2. <?php require_once('get.php'); ?>
    3. <?php
    4. $width = 600;
    5. ?>
    6. <!DOCTYPE html>
    7. <html lang="en">
    8. <head>
    9. <link rel="stylesheet" type="text/css" href="form.css">
    10. <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
    11. <script>
    12. $(document).ready(function() {
    13.     $("#hide").change(function(){
    14.         $('#bottom').toggleClass('off');
    15.         $('#bottom-controls').toggleClass('off');
    16.         loadSite();
    17.    
    18.     });
    19.     $("#hidejs").change(function(){
    20.         $('#js').toggleClass('off');
    21.     });
    22.     $('#desktop').click(function(){
    23.         $('#bottom iframe').animate({width: iframew + 'px', height: iframeh +'px'}, 500);
    24.     });
    25.  
    26.     $('#mobile').click(function(){
    27.         $('#bottom iframe').animate({width:'320px', height: '300px'}, 500);
    28.     });
    29.     $('#reset').click(function(){
    30.         $('#bottom iframe').animate({width:'0px', height: '0px'}, 500);
    31.     });
    32.  
    33.     $("#save").click(function(){
    34.         //clr(' ');
    35.         loadSite();
    36.         $.post("get.php",
    37.         {
    38.             name: filename,
    39.             text:  document.getElementById("description").value,
    40.         },
    41.     function(data, status){
    42.         //alert("Data: " + data + "\nStatus: " + status);
    43.    
    44.     });
    45. });
    46.     loadSite();
    47. });
    48. var path = '';
    49. var filename;
    50. var txt;
    51. var iframeh = screen.availHeight;
    52. var iframew = screen.availWidth - 100;
    53. </script>
    54. <style type="text/css">
    55. /*.button
    56. {
    57.     width: 150px;
    58.     padding: 10px;
    59.     background-color: #FF8C00;
    60.     box-shadow: -8px 8px 10px 3px rgba(0,0,0,0.2);
    61.     font-weight:bold;
    62.     text-decoration:none;
    63. }
    64. #cover{
    65.     position:fixed;
    66.     top:0;
    67.     left:0;
    68.     background:rgba(0,0,0,0.6);
    69.     z-index:5;
    70.     width:100%;
    71.     height:100%;
    72.     display:none;
    73. }
    74. #bottom
    75. {
    76.     height:300px;
    77.     width:900px;
    78.     margin:0 auto;
    79.     position:relative;
    80.     z-index:10;
    81.     display:none; */
    82.     /*background: url(login.png) no-repeat;*/
    83.     /*border:5px solid #cccccc;
    84.     border-radius:10px;
    85. }
    86. #bottom:target, #bottom:target + #cover{
    87.     display:block;
    88.     opacity:2;
    89. }
    90. .cancel
    91. {
    92.     display:block;
    93.     position:absolute;
    94.     top:490px;
    95.     right:2px;
    96.     background:rgb(245,245,245);
    97.     color:black;
    98.     height:30px;
    99.     width:300px;
    100.     font-size:30px;
    101.     text-decoration:none;
    102.     text-align:center;
    103.     font-weight:bold;
    104. }*/
    105. </style>
    106. <head>
    107. <body>
    108.  
    109. <table width="328" border="2">
    110.   <tbody>
    111.     <tr>
    112.       <td width="316" height="268"><table width="261" border="0" align="left">
    113.         <caption>
    114.           Work Space
    115.           </caption>
    116.         <tbody>
    117.           <tr>
    118.             <td width="208">
    119.                 <div id="select"></div>
    120.             </td>
    121.             <td width="43">
    122.             <input type="button" onClick="clr(' ')" value="Reload Page">
    123.               <input type="button" id="save" value="Save">
    124.               </td>
    125.           </tr>
    126.           <tr>
    127.             <td height="430"><table width="176" height="417" border="0">
    128.               <tbody>
    129.                 <tr>
    130.                   <td width="282" height="302">
    131.                   <textarea name="description" id="description" style="margin-left:0px; margin-right:0px; width:<?php echo $width; ?>px; height:300px;">
    132.                   </textarea></td>
    133.                 </tr>
    134.                 <tr>
    135.                   <td height="1"></td>
    136.                 </tr>
    137.               </tbody>
    138.             </table></td>
    139.             <td>
    140.             <div id="side" style="height:400px;overflow:auto;">
    141.             <?php
    142.                 $d = removeDuplicates(getDirectories($base, $base));
    143.             ?>
    144.  
    145.             Directories
    146.             <select id="files" size="10" onclick="loadDir()">
    147.                         <?php
    148.                             for($i = 0; $i < sizeof($d); $i++){
    149.                                 $name = ($d[$i] == "/") ? substr($d[$i], 1).'root' : substr($d[$i], 1);                        
    150.                                 echo '"<option value="'.$d[$i].'" id="'.$name.'">'.$name.'</option>'."\n";
    151.                             }
    152.                         ?>
    153.              </select>
    154.  
    155.              <div id="menu">
    156.                 <div id="bottom-controls">
    157.                     <input type="button" id="mobile" value="Mobile">
    158.                     <input type="button" id="desktop" value="Desktop">
    159.                     <input type="button" id="reset" value="Reset">
    160.                 </div>
    161.             </div>
    162.              </div>
    163.             </td>
    164.           </tr>
    165.         </tbody>
    166.       </table></td>
    167.     </tr>
    168.     <tr>
    169.       <td>
    170.         </div>
    171.       <div id="bottom"></div>
    172.       </td>
    173.     </tr>
    174.   </tbody>
    175. </table>
    176. </div>
    177. <script>
    178.     var b;
    179.     function clr(t) {
    180.         var x = document.getElementById('description');
    181.         var r = new RegExp(t, 'gi');
    182.         if (x.innerHTML.match(r)) {
    183.             x.innerHTML = "";
    184.         }else {
    185.             x.innerHTML += t;
    186.         }
    187.         location.reload(true);
    188.     }
    189.  
    190.     function o(s, w, h){
    191.         if(typeof(s) != 'undefined'){
    192.             return "<iframe src=\"" + s + "\" width=\""+ w +"\" height=\"" + h + "\"></iframe>";
    193.         }
    194.         return '';
    195.     }
    196.  
    197.     function loadSite(){
    198.         document.getElementById("bottom").innerHTML = o(path +'/index.php', 0, 0);
    199.     }
    200.  
    201.     function saveName(f){
    202.         fileName = f
    203.     }
    204.    
    205.     function loadDir()
    206.     {
    207.         var c = document.getElementById("files");
    208.         var path = c.options[c.selectedIndex].value
    209.         saveName(c.options[c.selectedIndex].value)
    210.         var x;
    211.         if (window.XMLHttpRequest)
    212.         {// code for IE7+, Firefox, Chrome, Opera, Safari
    213.             x = new XMLHttpRequest();
    214.         }
    215.         else
    216.         {// code for IE6, IE5
    217.             x = new ActiveXObject("Microsoft.XMLHTTP");
    218.         }
    219.         x.onreadystatechange=function()
    220.         {
    221.             if (x.readyState==4 && x.status==200)
    222.             {
    223.                 document.getElementById("select").innerHTML = x.responseText;
    224.             }
    225.         }
    226.         x.open("GET", "get.php?dir="+path, true);
    227.         x.send();
    228.     }
    229.  
    230.     function g(v){
    231.         if(!isset(b)){
    232.             if(v == 'reset'){
    233.                 b = '';
    234.             }else{
    235.                 b = v;
    236.             }
    237.         }else{
    238.             return b;
    239.         }
    240.     }
    241.  
    242.     function isset(v){
    243.         if(typeof(v) != 'undefined'){
    244.             return true;
    245.         }return false;
    246.     }
    247.  
    248.     function loadDescription(e, f)
    249.     {
    250.  
    251.         content = path + '/' + f + '/' + document.getElementById(e).value;
    252.         filename = content;
    253.         var xmlhttp;
    254.         if (window.XMLHttpRequest)
    255.         {// code for IE7+, Firefox, Chrome, Opera, Safari
    256.             xmlhttp=new XMLHttpRequest();
    257.         }
    258.         else
    259.         {// code for IE6, IE5
    260.             xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    261.         }
    262.         xmlhttp.onreadystatechange=function()
    263.         {
    264.             if (xmlhttp.readyState==4 && xmlhttp.status==200)
    265.             {
    266.                 document.getElementById("description").innerHTML = xmlhttp.responseText;
    267.            
    268.             }
    269.         }
    270.         xmlhttp.open("GET", "get.php?source="+content, true);
    271.         xmlhttp.send();
    272.     }
    273.  
    274. </script>
    275. </body>
    276.  
     
    Janbanan, Raggaer, tetra20 and 2 others like this.
  2. Omni Cloud

    Omni Cloud Banned User

    Joined:
    May 31, 2016
    Messages:
    312
    Likes Received:
    151
    Best Answers:
    0
    get.php
    PHP:
    1.  
    2. <?php
    3.     $base = getcwd();
    4.     $arr = array('ttf', 'db', 'jpg', 'png', 'psd', 'gif', 'zip');
    5.    
    6.     if(isset($_POST['name']) ){
    7.         $name = cleanup($_POST['name']);
    8.         $name = $base.'/'.$name;
    9.         $text = removeslashes($_POST['text']);
    10.         $ff = fopen($name, "r") or die("Unable to open file!");
    11.         $ee = fread($ff, filesize($name));
    12.         echo $ee;
    13.         fclose($ff);
    14.         $t = fopen($name, "w+");
    15.         fwrite($t, $text);
    16.         fclose($t);
    17.     }
    18.    
    19.     function cleanup($str){
    20.         $ss = array('///', '//');
    21.         foreach($ss as $sss){
    22.             $str = str_replace($sss, '', $str);
    23.         }
    24.         return $str;
    25.     }
    26.    
    27.     function removeslashes($string)
    28.     {
    29.         $string=implode("",explode("\\",$string));
    30.         return stripslashes(trim($string));
    31.     }
    32.    
    33.     if(isset($_GET['dir'])){
    34.         $dir = parse_url($_GET['dir']);
    35.         $dir = $dir['path'];
    36.         $files = array();
    37.         $full = $base.$dir;
    38.         $fx = scandir($full);
    39.         $i = 0;
    40.         echo "Files located in : ".$full.'<br />';
    41.         foreach($fx as $fxs){
    42.            
    43.             if(is_file($full.'/'.$fxs)){
    44.                
    45.                 $files = $fxs;
    46.                 $i++;
    47.                 if($files != '' && isNotInArray($files, $arr)){
    48.                     echo "<input type=\"button\" onclick=\"loadDescription(this.id, this.name)\" name=\"".$dir."\" id=\"b$i\" value=\"$files\" >\n";
    49.                 }
    50.             }elseif(is_dir($full.'/'.$fxs)){
    51.             }
    52.         }
    53.     }
    54.    
    55.     if(isset($_GET['source'])){
    56.         $source = $base.substr($_GET['source'], 1);
    57.         $f = fopen($source, "r") or die("Unable to open file!");
    58.         $e = fread($f, filesize($source));
    59.         fclose($f);
    60.         echo $e;
    61.     }
    62.    
    63.     function getDirContents($dir, $s)
    64.     {
    65.       $handle = opendir($dir);
    66.       if ( !$handle ) return array();
    67.       $contents = array();
    68.       while ( $entry = readdir($handle) )
    69.       {
    70.         if ( $entry=='.' || $entry=='..' ) continue;
    71.    
    72.         $e = $dir.DIRECTORY_SEPARATOR.$entry;
    73.         if ( is_file($e) )
    74.         {
    75.             $arr = array('css', 'ttf', 'js', 'db');
    76.             if(!getimagesize($e)){
    77.                 if (isNotInArray($e, $arr)){
    78.                     $path = $e;
    79.                     $path = substr($path, strlen($s));
    80.                     $contents[] = array($entry, $path);
    81.                 }
    82.             }
    83.         }
    84.         else if ( is_dir($e) )
    85.         {
    86.           $contents = array_merge($contents, getDirContents($e, $s));
    87.         }
    88.       }
    89.       closedir($handle);
    90.       return $contents;
    91.     }
    92.    
    93.    
    94.     function getDirectories($baseDir, $s)
    95.     {
    96.       $handle = opendir($baseDir);
    97.       if ( !$handle ) return array();
    98.       $contents = array();
    99.       while ( $dir = readdir($handle) )
    100.       {
    101.         if ( $dir =='.' || $dir =='..' ){
    102.             if(@!in_array("/", $directory)){
    103.                 $directory[] = "/";
    104.             }
    105.             continue;
    106.         }
    107.            
    108.        
    109.         $d = $baseDir.'/'.$dir;
    110.         if ( is_dir($d) )
    111.         {
    112.             $path = $d;
    113.             $path = substr($path, strlen($s));
    114.             $directory[] = $path;
    115.             $directory = @array_merge($directory, getDirectories($d, $s));
    116.         }
    117.       }
    118.       closedir($handle);
    119.      
    120.       return $directory;
    121.     }
    122.    
    123.     function isNotInArray($str, $arr){
    124.         foreach($arr as $find){
    125.             if(strripos($str, $find)){
    126.                 return false;
    127.             }
    128.         }
    129.         return true;
    130.     }
    131.    
    132.     function removeDuplicates($arr){
    133.         $a = array();
    134.         foreach($arr as $key => $value){
    135.             $a[$value] = $value;
    136.         }
    137.         return array_values($a);
    138.     }
    139. ?>
     
    tetra20 likes this.
  3. Fantasy Mage

    Fantasy Mage Banned User

    Joined:
    Jun 7, 2016
    Messages:
    133
    Likes Received:
    35
    Best Answers:
    0
    you mean you release ur own work***********
     
  4. Omni Cloud

    Omni Cloud Banned User

    Joined:
    May 31, 2016
    Messages:
    312
    Likes Received:
    151
    Best Answers:
    0
    form.css
    HTML:
    1.    
    2.     /*#bottom.off {
    3.         display: none;
    4.     }
    5.     #bottom-controls.off {
    6.         display: none;
    7.     }*/
    8.    
    9.  
    10.    
    11.     #js.off {
    12.         display: none;
    13.     }
    14.    
    15.     #bottom  {
    16.         font-size: 20px;
    17.         font-family: "Times New Roman", Times, serif;
    18.         display: initial;
    19.        
    20.         -webkit-animation: fadein 2s; /* Safari, Chrome and Opera > 12.1 */
    21.         -moz-animation: fadein 2s; /* Firefox < 16 */
    22.        -ms-animation: fadein 2s; /* Internet Explorer */
    23.        -o-animation: fadein 2s; /* Opera < 12.1 */
    24.        animation: fadein 2s;
    25.    }
    26.  
    27.    @keyframes fadein {
    28.        from { opacity: 0; }
    29.        to   { opacity: 1; }
    30.    }
    31.  
    32.    /* Firefox < 16 */
    33.    @-moz-keyframes fadein {
    34.        from { opacity: 0; }
    35.        to   { opacity: 1; }
    36.    }
    37.  
    38.    /* Safari, Chrome and Opera > 12.1 */
    39.     @-webkit-keyframes fadein {
    40.         from { opacity: 0; }
    41.         to   { opacity: 1; }
    42.     }
    43.  
    44.     /* Internet Explorer */
    45.     @-ms-keyframes fadein {
    46.         from { opacity: 0; }
    47.         to   { opacity: 1; }
    48.     }
    49.  
    50.     /* Opera < 12.1 */
    51.    @-o-keyframes fadein {
    52.        from { opacity: 0; }
    53.        to   { opacity: 1; }
    54.    }
    55.  
    56.    @media print{
    57.        #page, button, #menu {display: none;}
    58.    }
    59.  
    60.    aside {
    61.    position:  absolute;
    62.    left: 0;
    63.    top: 0; /* set these so Chrome doesn't return 'auto' from getComputedStyle */
    64.    width: 200px;
    65.    background: rgba(255,255,255,0.66);
    66.    border: 2px  solid rgba(0,0,0,0.5);
    67.    border-radius: 4px; padding: 8px;
    68. }
     
    tetra20 likes this.
  5. Omni Cloud

    Omni Cloud Banned User

    Joined:
    May 31, 2016
    Messages:
    312
    Likes Received:
    151
    Best Answers:
    0
    I can tell by reading some of your previous post that you are naturally mean to everyone. :(
     
    StreamSide likes this.
  6. Fantasy Mage

    Fantasy Mage Banned User

    Joined:
    Jun 7, 2016
    Messages:
    133
    Likes Received:
    35
    Best Answers:
    0
  7. DestinationSer

    DestinationSer @echo off

    Joined:
    Mar 7, 2009
    Messages:
    2,776
    Likes Received:
    641
    Best Answers:
    0
    Shh, he doesn't want anyone to know that hes codex
     
  8. LordVissie

    LordVissie ( ͡°( ͡° ͜ʖ( ͡° ͜ʖ ͡°) ͜ʖ ͡°) ͡°)

    Joined:
    Aug 4, 2015
    Messages:
    1,567
    Likes Received:
    580
    Best Answers:
    0
    Not hard to see. :p
     
  9. Fantasy Mage

    Fantasy Mage Banned User

    Joined:
    Jun 7, 2016
    Messages:
    133
    Likes Received:
    35
    Best Answers:
    0
  10. Omni Cloud

    Omni Cloud Banned User

    Joined:
    May 31, 2016
    Messages:
    312
    Likes Received:
    151
    Best Answers:
    0
    Now I see why he got upset by some people here in this community. :(
    You people really are ignorant.
     
  11. LordVissie

    LordVissie ( ͡°( ͡° ͜ʖ( ͡° ͜ʖ ͡°) ͜ʖ ͡°) ͡°)

    Joined:
    Aug 4, 2015
    Messages:
    1,567
    Likes Received:
    580
    Best Answers:
    0
    I was his bff. jk xd but I had nothing against him ;)
     
    Last edited: Jun 15, 2016
  12. Tarek1337

    Tarek1337 Premium User Premium User

    Joined:
    Jun 9, 2012
    Messages:
    3,525
    Likes Received:
    1,086
    Best Answers:
    3
    Awesome! Tell Codex I said hi. :p
     
    DestinationSer likes this.
  13. Deepling

    Deepling Just a spammer

    Joined:
    Jun 29, 2015
    Messages:
    1,837
    Likes Received:
    551
    Best Answers:
    1
    Hmm, isn't Codex deleted? o_O
    I think @Omni Cloud is him, cause of same age and this...
     
  14. LordVissie

    LordVissie ( ͡°( ͡° ͜ʖ( ͡° ͜ʖ ͡°) ͜ʖ ͡°) ͡°)

    Joined:
    Aug 4, 2015
    Messages:
    1,567
    Likes Received:
    580
    Best Answers:
    0
    [​IMG]
     
    Static_ likes this.
  15. Omni Cloud

    Omni Cloud Banned User

    Joined:
    May 31, 2016
    Messages:
    312
    Likes Received:
    151
    Best Answers:
    0
    Codex is 39, I am 35.
     
  16. president vankk

    president vankk aura developer

    Joined:
    Jul 10, 2009
    Messages:
    5,659
    Likes Received:
    264
    Best Answers:
    2
    Holy moly
     

Share This Page

Loading...