Esempio n. 1
0
function send_file($name)
{
    OB_END_CLEAN();
    $path = $name;
    //"../temp/".$name;
    if (!IS_FILE($path) or CONNECTION_STATUS() != 0) {
        return FALSE;
    }
    HEADER("Cache-Control: no-store, no-cache, must-revalidate");
    HEADER("Cache-Control: post-check=0, pre-check=0", FALSE);
    HEADER("Pragma: no-cache");
    HEADER("Expires: " . GMDATE("D, d M Y H:i:s", MKTIME(DATE("H") + 2, DATE("i"), DATE("s"), DATE("m"), DATE("d"), DATE("Y"))) . " GMT");
    HEADER("Last-Modified: " . GMDATE("D, d M Y H:i:s") . " GMT");
    HEADER("Content-Type: application/octet-stream");
    HEADER("Content-Length: " . (string) FILESIZE($path));
    HEADER("Content-Disposition: inline; filename={$name}");
    HEADER("Content-Transfer-Encoding: binary\n");
    if ($file = FOPEN($path, 'rb')) {
        while (!FEOF($file) and CONNECTION_STATUS() == 0) {
            print FREAD($file, 1024 * 8);
            FLUSH();
        }
        FCLOSE($file);
    }
    return CONNECTION_STATUS() == 0 and !CONNECTION_ABORTED();
}
Esempio n. 2
0
 private static function AutoLoad($class)
 {
     foreach (self::$conf['Path'] as $name => $path) {
         //Load Hook Class
         if (strpos($class, "{$name}") !== FALSE) {
             $path = $path . $class . ".php";
             if (IS_FILE($path)) {
                 include_once $path;
                 return TRUE;
             }
             return FALSE;
         }
     }
 }
Esempio n. 3
0
 function emptyDir($path)
 {
     if ($handle = OPENDIR($path)) {
         while (FALSE !== ($file = READDIR($handle))) {
             if ($file != "." && $file != "..") {
                 if (IS_FILE($path . "/" . $file)) {
                     if (UNLINK($path . "/" . $file)) {
                         $debugStr = true;
                     }
                 }
             }
         }
     }
     return $debugStr;
 }
Esempio n. 4
0
    private function emptyDir($path)
    {

        // init the debug string
        $debugStr = '';
        $debugStr .= "Deleting Contents Of: $path<br /><br />";

        // parse the folder
        IF ($handle = OPENDIR($path)) {

            WHILE (FALSE !== ($file = READDIR($handle))) {

                IF ($file != "." && $file != "..") {

                    // If it's a file, delete it
                    IF (IS_FILE($path . "/" . $file)) {

                        IF (UNLINK($path . "/" . $file)) {
                            $debugStr .= "Deleted File: " . $file . "<br />";
                        }

                    } ELSE {

                        // It's a directory...
                        // crawl through the directory and delete the contents
                        IF ($handle2 = OPENDIR($path . "/" . $file)) {

                            WHILE (FALSE !== ($file2 = READDIR($handle2))) {

                                IF ($file2 != "." && $file2 != "..") {
                                    IF (UNLINK($path . "/" . $file . "/" . $file2)) {
                                        $debugStr .= "Deleted File: $file/$file2<br />";
                                    }
                                }

                            }

                        }

                        IF (RMDIR($path . "/" . $file)) {
                            $debugStr .= "Directory: " . $file . "<br />";
                        }

                    }

                }

            }

        }
        return $debugStr;
    }
Esempio n. 5
0
function EMAILFILE1($NODE)
{
    /*
    This function is the second phase of the EMAIL File process, this is the
    checking phase and mail process, previously to use this function the SMTP
    variable in PHP.INI must be set acordingly to your ISPs smtp mail server, an
    smtp server something like "smtp.your_ip_server.com"
    (you_ip_server could be anything).
    */
    $CURRENT_FILE = BUILD_PATH($NODE);
    $REAL_FILE = str_replace(DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, DIRNAME($_SESSION['Server_Path'])) . DIRECTORY_SEPARATOR . $CURRENT_FILE;
    // the real full filename of the directory
    PAGEMAIL_HEADER("FILE MANAGER - DIRTREEVIEW", "EMAIL FUNCTION", "BLUE", "WHITE");
    ?>
   <Table WIDTH=100% BORDER=0 CELLPADDING=8 CELLSPACING=0 class=td>
        <Tr>
            <Td VALIGN=top ALIGN=left>
                <Center>
                <Font FACE=tahoma>
                <H3>FileName:
    <?php 
    echo $CURRENT_FILE . "</h3>";
    ?>
            </Td>
        </Tr>
        <Tr>
            <Td>
            <Form NAME="emailfile1" METHOD="post" ENCTYPE="multipart/form-data" ACTION="<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
">
               <Table ALIGN=center BORDER=0 class=td>
                    <Tr>
    <?php 
    $ERROR_FUNCTION = false;
    if (empty($_POST['attached'])) {
        echo "<td><CENTER><h3>No file to send</h3></td>";
        $ERROR_FUNCTION = true;
    } else {
        CLEARSTATCACHE();
        if (!IS_FILE($_POST['attached'])) {
            echo "<td><CENTER><h3>The File has been erased or moved</h3></td>";
            $ERROR_FUNCTION = true;
        } else {
            if (!IS_VALID_EMAIL($_POST['target_email'])) {
                echo "<td><CENTER><h3>The data fields has errors</h3></td>";
                $ERROR_FUNCTION = true;
            } else {
                $prioridad = "3";
                $headers = "From: ";
                $headers .= $_POST['your_name'];
                $headers .= " <";
                $headers .= $_POST['your_email'];
                $headers .= ">\n";
                $headers .= "Reply-To: ";
                $headers .= $_POST['your_name'];
                $headers .= " <";
                $headers .= $_POST['your_email'];
                $headers .= ">\n";
                $headers .= "MIME-Version: 1.0\n";
                $headers .= "Content-Type: multipart/mixed; boundary=\"MIME_BOUNDRY\"\n";
                $headers .= "X-Sender: DIRTREEVIEW 1.0 <";
                $headers .= $_POST['your_email'];
                $headers .= ">\n";
                $headers .= "X-Mailer: DIRTREEVIEW 1.0\n";
                $headers .= "X-Priority: ";
                $headers .= $prioridad;
                $headers .= "\n";
                $headers .= "Return-Path: <";
                $headers .= $_POST['target_email'];
                $headers .= ">\n";
                $headers .= "This is a multi-part message in MIME format.\n";
                $FILE_TO_EMAIL = $_POST['attached'];
                if ($_POST['ACTIONEMAIL'] == "compress") {
                    CLEARSTATCACHE();
                    if (IS_FILE($REAL_FILE)) {
                        $ZIP_FILE = DIRNAME($REAL_FILE) . DIRECTORY_SEPARATOR . SUBSTR(BASENAME($REAL_FILE), 0, STRRPOS(BASENAME($REAL_FILE), ".")) . ".zip";
                        if ($ZIP_FILE != $REAL_FILE) {
                            if (IS_FILE($ZIP_FILE)) {
                                UNLINK($ZIP_FILE);
                            }
                            $FILE_TO_ZIP[1] = $REAL_FILE;
                            //include_once("dirtreezip1.inc.php");
                            $ziper = new zipfile();
                            $ziper->addFiles($FILE_TO_ZIP);
                            $ziper->output($ZIP_FILE);
                            if (IS_FILE($ZIP_FILE)) {
                                $FILE_TO_EMAIL = $ZIP_FILE;
                            }
                        }
                    }
                }
                $fp = fopen($FILE_TO_EMAIL, "r");
                $str = fread($fp, filesize($FILE_TO_EMAIL));
                $str = chunk_split(base64_encode($str));
                $fp = fclose($fp);
                $blankline = " \r\n";
                $tmp_message = "Hi " . $_POST['target_name'];
                $tmp_message .= $blankline;
                $tmp_message .= $blankline;
                $tmp_message .= "I'am " . $_POST['your_name'] . " and I send you this message and the attached file";
                $tmp_message .= $blankline;
                $tmp_message .= $blankline;
                $tmp_message .= "Message";
                $tmp_message .= $blankline;
                $tmp_message .= $blankline;
                $tmp_message .= "=======";
                $tmp_message .= $blankline;
                $tmp_message .= $blankline;
                $tmp_message .= $_POST['email_message'];
                $message = "--MIME_BOUNDRY\n";
                $message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
                $message .= "Content-Transfer-Encoding: quoted-printable\n";
                $message .= "\n";
                $message .= $tmp_message;
                $message .= "\n";
                $message .= "--MIME_BOUNDRY\n";
                $message .= "Content-Type: application/octet-stream; name=";
                $message .= basename($FILE_TO_EMAIL);
                $message .= "\n";
                $message .= "Content-disposition: attachment\n";
                $message .= "Content-Transfer-Encoding: base64\n";
                $message .= "\n";
                $message .= $str;
                $message .= "\n";
                $message .= "\n";
                $message .= "--MIME_BOUNDRY--\n";
                if (!mail($_POST['target_email'], $_POST['matter'], $message, $headers)) {
                    echo "<td><CENTER><h3>ERROR : email has not been sent, please try it again</h3></td>";
                    $ERROR_FUNCTION = true;
                } else {
                    echo "<td><CENTER><h3>The file " . $FILE_TO_EMAIL . " has been sent succesfully</h3></td>";
                }
                if ($_POST['ACTIONEMAIL'] == "compress") {
                    if ($ZIP_FILE != $REAL_FILE) {
                        if (IS_FILE($ZIP_FILE)) {
                            UNLINK($ZIP_FILE);
                        }
                    }
                    unset($_POST['ACTIONEMAIL']);
                }
            }
        }
    }
    ?>
                    </Tr>
                    <Input TYPE="hidden" NAME="FILE_EXTENSION" VALUE="<?php 
    echo $_SESSION['File_Extension'];
    ?>
">
                    <Input TYPE="hidden" NAME="NODE" VALUE="<?php 
    echo $NODE;
    ?>
">
    <?php 
    if ($ERROR_FUNCTION) {
        ?>
                    <Input TYPE="hidden" NAME="ACTION" VALUE="">
                    <Tr>
                        <Td><Center><Input TYPE="Submit" NAME="emailfileform3a" VALUE="    Cancel   "></Td>
    <?php 
    } else {
        ?>
                    <Input TYPE="hidden" NAME="ACTION" VALUE="">
                    <Tr>
                        <Td><Center><Input TYPE="Submit" NAME="emailfileform3b" VALUE="    Accept   "></Td>
    <?php 
    }
    ?>
                    </Tr>
                </Table>
            </Form>
            </Td>
        </Tr>
   </Table>
   <?php 
    PAGE_FOOTER("BLUE", "WHITE");
    exit;
}