Вход Регистрация
Файл: Documentation/index.html
Строк: 594
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<head lang="en">
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <title>myCode Documentation</title>
    
    <script type="text/javascript" src="SyntaxHighlighter/scripts/shCore.js"></script>
    <script type="text/javascript" src="SyntaxHighlighter/scripts/shBrushJScript.js"></script>
    <script type="text/javascript" src="SyntaxHighlighter/scripts/shBrushCss.js"></script>
    <script type="text/javascript" src="SyntaxHighlighter/scripts/shBrushPhp.js"></script>
    <link type="text/css" rel="stylesheet" href="SyntaxHighlighter/styles/shCoreDefault.css"/>
    <script type="text/javascript">SyntaxHighlighter.all();</script>
    
    <!-- Framework CSS -->
    <link rel="stylesheet" href="assets/blueprint-css/screen.css" type="text/css" media="screen, projection">
    <link rel="stylesheet" href="assets/blueprint-css/print.css" type="text/css" media="print">
    <!--[if lt IE 8]><link rel="stylesheet" href="assets/blueprint-css/ie.css" type="text/css" media="screen, projection"><![endif]-->
    <link rel="stylesheet" href="assets/blueprint-css/plugins/fancy-type/screen.css" type="text/css" media="screen, projection">
    <style type="text/css" media="screen">
        p, table, hr, .box { margin-bottom:25px; }
        .box p { margin-bottom:10px; }
    </style>
    
    <script type="text/javascript" src="js/jquery.js"></script>

<script type="text/javascript"> 
$(document).ready(function(){

$("#slider").click(function(){
    $(this).toggleClass('active');
    $("#panel").slideToggle("slow");

    $("#panel2").slideUp("slow");
    $("#panel3").slideUp("slow");
    $("#panel4").slideUp("slow");
    $("#panel5").slideUp("slow");

  });

$("#slider2").click(function(){
    $(this).toggleClass('active');
    $("#panel2").slideToggle("slow");

    $("#panel").slideUp("slow");
    $("#panel3").slideUp("slow");
    $("#panel4").slideUp("slow");
    $("#panel5").slideUp("slow");

  });

$("#slider3").click(function(){
    $(this).toggleClass('active');
    $("#panel3").slideToggle("slow");

    $("#panel").slideUp("slow");
    $("#panel2").slideUp("slow");
    $("#panel4").slideUp("slow");
    $("#panel5").slideUp("slow");

  });

$("#slider4").click(function(){
    $(this).toggleClass('active');
    $("#panel4").slideToggle("slow");

    $("#panel").slideUp("slow");
    $("#panel2").slideUp("slow");
    $("#panel3").slideUp("slow");
    $("#panel5").slideUp("slow");

  });
 
$("#slider5").click(function(){
    $(this).toggleClass('active');
    $("#panel5").slideToggle("slow");

    $("#panel").slideUp("slow");
    $("#panel2").slideUp("slow");
    $("#panel3").slideUp("slow");
    $("#panel4").slideUp("slow");

  });
  
$(".scroll").click(function(event){        
        event.preventDefault();
        $('html,body').animate({scrollTop:$(this.hash).offset().top}, 500);
    });

});
</script>

</head>


<body>
    <div class="container">
    
        <h3 class="center alt">&ldquo;myCode&rdquo; Documentation by &ldquo;KVendrik&rdquo; v1.0</h3>
        
        <hr>
        
        <h1 class="center">&ldquo;myCode&rdquo;</h1>
        
        <div class="borderTop">
            <div class="span-6 colborder info prepend-1">
                <p class="prepend-top">
                    <strong>
                    Created: 05/30/2012<br>
                    By: KVendrik<br>
                    Email: <a href="http://www.kvendrik.com/Contact.php">Contact</a>
                    </strong>
                </p>
            </div><!-- end div .span-6 -->
    
    
            <div class="span-12 last">
                <p class="prepend-top append-0">Thank you for purchasing myCode. If you have any questions that are beyond the scope of this help file, please feel free to email via my user page contact form <a href="http://codecanyon.net/user/kvendrik">here</a>.</p>
            </div>
        </div><!-- end div .borderTop -->
        
        <hr>
        
        <h2 id="toc" class="alt">Contents</h2>
        <ol class="alpha">
            <li><a href="#Installation" class="scroll">Installation</a></li>
            <li><a href="#Javascript" class="scroll">Javascript</a></li>
            <li><a href="#CSS" class="scroll">CSS</a></li>
            <li><a href="#PHPViewPages" class="scroll">PHP View Pages</a> <em class="quiet small">(PHP View Pages Explaination)</em></li>
            <li><a href="#PHPCodePages" class="scroll">PHP Code Pages</a> <em class="quiet small">(PHP Code Pages Exaplaination)</em></li>
            <li><a href="#Troubleshooting" class="scroll">Troubleshooting</a></li>
        </ol>
        
        <hr>
        
        <h3 id="Installation"><strong>A) Installation</strong> - <a href="#toc" class="scroll">top</a></h3>
        <p>First you need to open myCode/Login.php and edit the username and password to something of your choice. After this the only thing you have to do is uploading the myCode folder to your server's root directory. Now go to yourwebsiteurl.com/myCode/ and you can start using myCode right away.</p>

        <hr>

        <h3 id="Javascript"><strong>B) Javascript</strong> - <a href="#toc" class="scroll">top</a></h3>

        <p>myCode contains JS, CSS and PHP files. Let's start by explaning the Javascript.
        
        The only JS code that myCode uses is to save or create files from the createfile/createcontent.php and the editfile.php pages. You can find the JS code in these files. The jQuery file that both of these files use can be found in the JS folder.
        </p>     

        <hr>
        
        <h3 id="CSS"><strong>C) CSS</strong> - <a href="#toc" class="scroll">top</a></h3>
        
        <p>The CSS file can be found in the CSS folder and is named style.css. You can use this file to modify the layout of myCode.
        While editing the menu buttons in the HTML file you will note that the buttons are in a order from right to left. while the extual buttons are from left to right. This is because the CSS code tells this class that it should float: right;. This is just one of the examples that you might run into. If you have any questions about the CSS modification of myCode then just contact me trough my Envato page. I'll be happy to help you out.</p>
        
        <h3>Shortcodes</h3>
        
        <h4>Button</h4>
        
                    <pre class="brush: php;">
                    <div class="button">I'm a Button</div>
                    </pre>
                    
        <h4>Attention Red</h4>
        
                    <pre class="brush: php;">
                    <div class="attention">AttentionRed</div>
                    </pre>    
                    
        <h4>Attention Green</h4>
        
                    <pre class="brush: php;">
                    <div class="attentiongreen">AttentionGreen</div>
                    </pre>    
        
        <hr>
        
        <h3 id="PHPViewPages"><strong>D) PHP View Pages</strong> - <a href="#toc" class="scroll">top</a></h3>
        
        <p>The PHP pages contain the code for the processing of commands such as file creation and file editing but they also contain the content of the pages. You can find the layout of the file lists in the index.php and open.php files. Below you can find the php code of these pages with an explaination.</p>
        
        <div class="sliderfirst" id="slider">index.php Explaination</div>

<div class="panel" id="panel">

<p><pre class="brush: php;">
                    
                    
                    echo "<table>
<tr>
<th>Files</th>
<table><a href='Logout.php' class='button'>Logout</a> <a href='uploadzip.php' class='button'>Upload ZIP</a> <a href='upload.php' class='button'>Upload File</a> <a href='createdir.php' class='button'>Create Folder</a> <a href='create.php' class='button'>Create File</a></table>

// Navigation Menu, this menu has a float: right element wich causes that it will be displayed from right to left

<table>
</tr>";

if ($handle = opendir('.')) {
    while (false !== ($entry = readdir($handle))) {
        if (is_dir($entry) && $entry != "." && $entry != "..") {

  echo "<tr>";
  echo "<td><a class='dir' href='open.php?dir=$entryn'>$entryn</a> <a class='opendir' href='open.php?dir=$entryn'>Open</a></td>";
  
// The code above will get al the files from the current directory. It will also filter the files and display only the directories using the is_dir function.
  
        }
  
  if (is_file($entry) && $entry != "." && $entry != "..") {

  echo "<tr>";
  
  $filetype = substr($entry, strrpos($entry, '.') + 1);

        if ($filetype=="html")
      echo "<td><a class='file filehtml' href='edit.php?file=$entryn'>$entryn</a> <a class='editfile' href='edit.php?file=$entryn'>Edit</a> <a             class='deletefile' href='delete.php?file=$entryn'>Delete</a></td>";
      
      elseif ($filetype=="php")
      echo "<td><a class='file filephp' href='edit.php?file=$entryn'>$entryn</a> <a class='editfile' href='edit.php?file=$entryn'>Edit</a> <a class='deletefile' href='delete.php?file=$entryn'>Delete</a></td>";
      
      elseif ($filetype=="css")
      echo "<td><a class='file filecss' href='edit.php?file=$entryn'>$entryn</a> <a class='editfile' href='edit.php?file=$entryn'>Edit</a> <a class='deletefile' href='delete.php?file=$entryn'>Delete</a></td>";
      
      elseif ($filetype=="js")
      echo "<td><a class='file filejs' href='edit.php?file=$entryn'>$entryn</a> <a class='editfile' href='edit.php?file=$entryn'>Edit</a> <a class='deletefile' href='delete.php?file=$entryn'>Delete</a></td>";
      
      elseif ($filetype=="xml")
      echo "<td><a class='file filexml' href='edit.php?file=$entryn'>$entryn</a> <a class='editfile' href='edit.php?file=$entryn'>Edit</a> <a class='deletefile' href='delete.php?file=$entryn'>Delete</a></td>";
      
      elseif ($filetype=="sql")
      echo "<td><a class='file filesql' href='edit.php?file=$entryn'>$entryn</a> <a class='editfile' href='edit.php?file=$entryn'>Edit</a> <a class='deletefile' href='delete.php?file=$entryn'>Delete</a></td>";
      
      elseif ($filetype=="txt")
      echo "<td><a class='file filetxt' href='edit.php?file=$entryn'>$entryn</a> <a class='editfile' href='edit.php?file=$entryn'>Edit</a> <a class='deletefile' href='delete.php?file=$entryn'>Delete</a></td>";
      
    else

      echo "<td><a class='file fileother'>$entryn</a> <a class='deletefile' href='delete.php?file=$entryn'>Delete</a></td>";
      
// The code above will check if the file is a directory or not.
// If it's a file then it will check the extension. 
// If it is a HTML, PHP, CSS, JS, XML, SQL or TXT file 
// it will display a menu to edit or delete the file with the right icon 
// If the file has another extension then it will display a 
// custom icon and only show a delete button and not a edit button. 
// You can easily add file extensions by copying the elseif statement of 
// a extension and past it below that extension and changing 
// it to your desired extension. 
// I added an example below this code explaination. 
  
  }
    }
    
// The code below closes the dir so it will not get 
// into a loop of reading the directory. 
// If this happens then the page will not stop loading.
    
    closedir($handle);
}

echo "</table>";


// The code below will trigger when you press 
// the Download Files as ZIP button.
// It will pack the current directory as a ZIP and 
// force the browser to download the file using the header element.

if (isset($_POST['Submit'])) {
    

// increase script timeout value
ini_set("max_execution_time", 300);
// create object
$zip = new ZipArchive();
// open archive
if ($zip->open("Backup.zip", ZIPARCHIVE::CREATE) !== TRUE) {
die ("Could not open archive");
}
// initialize an iterator
// pass it the directory to be processed
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator("."));
// iterate over the directory
// add each file found to the archive
foreach ($iterator as $key=>$value) {
$zip->addFile(realpath($key), $key) or die ("Could not add file: $key");
}
// close and save archive
$zip->close();

 header("Content-type: application/zip");
 header("Content-Disposition: attachment; filename=Backup.zip");
 header("Pragma: no-cache");
 header("Expires: 0");
 readfile("Backup.zip");
 unlink("Backup.zip");
 exit;
 
 
}

// Below you'll find the button that will trigger the ZIP file download script

echo "<form action='' method='post'>
<input type='Submit' class='download' name='Submit' value='Download files as ZIP' />
</form>";


                    </pre></p>

</div>


<div class="slider" id="slider2">Adding an Extension Example</div>

<div class="panel" id="panel2">

<p><pre class="brush: php;">
                    
elseif ($filetype=="txt")
      echo "<td><a class='file filetxt' href='edit.php?file=$entryn'>$entryn</a> <a class='editfile' href='edit.php?file=$entryn'>Edit</a> <a class='deletefile' href='delete.php?file=$entryn'>Delete</a></td>";
      
// TXT is the last extension in the list after this the else statement will trigger
// If you want to add an extension for example PNG then the code would be

elseif ($filetype=="png")
      echo "<td><a class='file fileother' href='edit.php?file=$entryn'>$entryn</a> <a class='editfile' href='edit.php?file=$entryn'>Edit</a> <a class='deletefile' href='delete.php?file=$entryn'>Delete</a></td>";
      
// Note that not only the extension is changed but also the 
// icon by changing the class to fileother instead of filetxt
// Also note that this code should be directly below the 
// last extension and not after the else statement
      
                    </pre></p>

</div>


<div class="slider" id="slider3">open.php Explaination</div>

<div class="panel" id="panel3">

<p>The PHP code in the open.php file is almost the same the only diffrence is that it also keeps track of the folder path to make sure that it won't try to open for example a file within a subdirectory from within the root directory. This is done by the $_GET['dir'] . "/" code. This code gets the previous directory given by the index.php file. It also adds a / to it so you get a working path to the file.</p>

</div>

        <br />    
        
        <hr>
        
        <h3 id="PHPCodePages"><strong>E) PHP Code Pages</strong> - <a href="#toc" class="scroll">top</a></h3>
        
        <p>The PHP pages that are being used for pure code are the createfile.php and the editfile.php page. Most of the other PHP codes can be found op the viewing pages. The only reason that the code to create and edit files are not in the same file as the viewing page is in is because jQuery requires an external file for the form action in order to work properly. Below you can find the code from the editfile.php and createfile.php pages.</p>
        
        <div class="slider" id="slider4">editfile.php Explaination</div>

        <div class="panel" id="panel4">

        <p><pre class="brush: php;">
           
           <?php

            $filename 
$_GET['file'];

            
$contentdata $_REQUEST['content'];

            
// Opens the file and gets the filename and path from the URL
            
            
$fw fopen($filename'w') or die('Could not open file!'); 
            
            
// Writes the content from the edit.php page to the file 
            
            
$fb fwrite($fw,stripslashes($contentdata)) or die('Could not write  
            to file'
); 
            
            
// Closes the file
            
            
fclose($fw);

            
?>

        </pre>
        </p>

        </div>
        
        <div class="slider" id="slider5">createfile.php Explaination</div>

        <div class="panel" id="panel5">

        <p><pre class="brush: php;">
        
        <?php

        $filename 
"../" $_GET['folder'] . "/" $_GET['filename'];
        
        
// Tells the browser the path to were the new file should be placed
        // and gets some information about the folder and the filename from the URL
        
        
$fh fopen($filename'w') or die("can't open file");
        
        
// Opens the file
        
        
$stringData $_REQUEST['content'];
        
        
// Requests the code the user just wrote on the createcontent.php page
        
        
fwrite($fh$stringData);
        
        
// Writes the content
        
        
fclose($fh);
        
        
// Closes the file

        
?>

        </pre>

        </p>

        </div>
        
        <hr>
        
        <h3 id="Troubleshooting"><strong>F) Troubleshooting</strong> - <a href="#toc" class="scroll">top</a></h3>
        
        <p><strong>Q: I can't use the upload function, when I upload a file it just doesn't appear in the file list.</strong><br /><br />
        <strong>A: If something like this happens then you should make sure the target directory has a 777 CHMOD value. If you can't get it fixed on your own then don't hasitate to contact me.</strong></p>
        
        <hr>
        
        <p>Once again, thank you so much for purchasing myCode. As I said at the beginning, I'd be glad to help you if you have any questions relating to this.</p>
        
        <p class="append-bottom alt large"><strong>KVendrik</strong></p>
        <p><a href="#toc" class="scroll">Go To Table of Contents</a></p>
        
        <hr class="space">
    </div><!-- end div .container -->
</body>
</html>
Онлайн: 2
Реклама