Beispiel #1
0
            $_final_data .= $dump->filestream . "\n\n";
        }
    }
    if ($_POST['output'] == '0') {
        // write the sql file
        $file_name = 'data/' . $_GET['db'] . '-' . date("D-m-y_h-i-s") . ".sql";
        $fp = fopen($file_name, "w");
        fwrite_stream($fp, $_final_data);
        fclose($fp);
    }
    if ($_POST['output'] == '1') {
        $_SESSION['file_sql'] = 'data/' . $_GET['db'] . '-' . date("D-m-y_h-i-s") . ".sql";
        $fp = fopen($_SESSION['file_sql'], "w");
        fwrite_stream($fp, $_final_data);
        $ziper = new zipfile();
        $ziper->addFiles($_SESSION['file_sql']);
        $ziper->output($_SESSION['file_sql'] . '.zip');
        unlink($_SESSION['file_sql']);
        fclose($fp);
    }
} else {
    if (isset($_GET['db'])) {
        if ($db_name) {
            $lt = $db->query("SHOW TABLE STATUS;");
            while ($lst = $lt->fetch_array()) {
                $list[] = $lst[0];
            }
        }
    } else {
        $lt = $db->query("SHOW DATABASES;");
        while ($lst = $lt->fetch_array()) {
Beispiel #2
0
<?php

include "zip.php";
$ziper = new zipfile();
$ziper->addFiles(array("sathish", "251220081742.jpg", "261220081767.jpg"));
//array of files
$ziper->output("zipFile.zip");
Beispiel #3
0
function saveOds($obj, $file)
{
    $charset = ini_get('default_charset');
    ini_set('default_charset', 'UTF-8');
    $tmp = get_tmp_dir();
    $uid = uniqid();
    mkdir($tmp . '/' . $uid);
    file_put_contents($tmp . '/' . $uid . '/content.xml', $obj->array2ods());
    file_put_contents($tmp . '/' . $uid . '/mimetype', 'application/vnd.oasis.opendocument.spreadsheet');
    file_put_contents($tmp . '/' . $uid . '/meta.xml', $obj->getMeta('pt-BR'));
    file_put_contents($tmp . '/' . $uid . '/styles.xml', $obj->getStyle());
    file_put_contents($tmp . '/' . $uid . '/settings.xml', $obj->getSettings());
    mkdir($tmp . '/' . $uid . '/META-INF/');
    mkdir($tmp . '/' . $uid . '/Configurations2/');
    mkdir($tmp . '/' . $uid . '/Configurations2/acceleator/');
    mkdir($tmp . '/' . $uid . '/Configurations2/images/');
    mkdir($tmp . '/' . $uid . '/Configurations2/popupmenu/');
    mkdir($tmp . '/' . $uid . '/Configurations2/statusbar/');
    mkdir($tmp . '/' . $uid . '/Configurations2/floater/');
    mkdir($tmp . '/' . $uid . '/Configurations2/menubar/');
    mkdir($tmp . '/' . $uid . '/Configurations2/progressbar/');
    mkdir($tmp . '/' . $uid . '/Configurations2/toolbar/');
    file_put_contents($tmp . '/' . $uid . '/META-INF/manifest.xml', $obj->getManifest());
    $ziper = new zipfile();
    $ziper->addFiles($tmp . '/' . $uid, array('META-INF', 'Configurations2', 'content.xml', 'meta.xml', 'mimetype', 'settings.xml', 'styles.xml'));
    $ziper->output($file);
    remove_directory($tmp . '/' . $uid);
    ini_set('default_charset', $charset);
}
Beispiel #4
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;
}