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


PHP zipfile::add_file方法代码示例

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


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

示例1: zipFiles

 function zipFiles($zipname, $files)
 {
     $zipfile = new zipfile();
     //	        $zipfile->add_dir("files/");
     for ($f = 0; $f < count($files); $f++) {
         $filename = $files[$f][0];
         $filedata = $files[$f][1];
         $zipfile->add_file($filedata, $filename);
     }
     File::throwFile($zipname, $zipfile->file());
 }
开发者ID:NerdZombies,项目名称:MateCode,代码行数:11,代码来源:FileHelper.php

示例2: dirname

        $file_extension = $regs[2];
        $file['file_name'] = $file_name . ($size ? "_" . $size : "") . "." . $file_extension;
        $file['file_path'] = is_local_file($image_row['image_media_file']) ? dirname($image_row['image_media_file']) . "/" . $file['file_name'] : MEDIA_PATH . "/" . $image_row['cat_id'] . "/" . $file['file_name'];
    }
    if ($user_info['user_level'] != ADMIN) {
        $sql = "UPDATE " . IMAGES_TABLE . "\n            SET image_downloads = image_downloads + 1\n            WHERE image_id = {$image_id}";
        $site_db->query($sql);
    }
    if (!empty($file['file_path'])) {
        @set_time_limit(120);
        if ($remote_url) {
            redirect($file['file_path']);
        }
        if ($action == "zip" && !preg_match("/\\.zip\$/i", $file['file_name']) && function_exists("gzcompress") && function_exists("crc32")) {
            include ROOT_PATH . "includes/zip.php";
            $zipfile = new zipfile();
            $zipfile->add_file(file_get_contents($file['file_path']), $file['file_name']);
            $zipfile->send(get_file_name($file['file_name']) . ".zip");
        } else {
            send_file($file['file_name'], $file['file_path']);
        }
        exit;
    } else {
        echo $lang['download_error'] . "\n<!-- EMPTY FILE PATH //-->";
        exit;
    }
} else {
    echo $lang['download_error'] . "\n<!-- NO ACTION SPECIFIED //-->";
    exit;
}
exit;
开发者ID:4images,项目名称:4images,代码行数:31,代码来源:download.php

示例3: create

 function create($description)
 {
     global $addslashes, $moduleFactory;
     if ($this->getNumAvailable() >= AT_COURSE_BACKUPS) {
         return FALSE;
     }
     $timestamp = time();
     $zipfile = new zipfile();
     $package_identifier = VERSION . "\n\n\n" . 'Do not change the first line of this file it contains the ATutor version this backup was created with.';
     $zipfile->add_file($package_identifier, 'atutor_backup_version', $timestamp);
     // backup course properties. ONLY BANNER FOR NOW.
     require_once AT_INCLUDE_PATH . 'classes/CSVExport.class.php';
     $CSVExport = new CSVExport();
     $now = time();
     $sql = 'SELECT banner 
           FROM ' . TABLE_PREFIX . 'courses 
          WHERE course_id=' . $this->course_id;
     $properties = $CSVExport->export($sql, $course_id);
     $zipfile->add_file($properties, 'properties.csv', $now);
     // backup modules
     $modules = $moduleFactory->getModules(AT_MODULE_STATUS_ENABLED | AT_MODULE_STATUS_DISABLED);
     $keys = array_keys($modules);
     foreach ($keys as $module_name) {
         $module =& $modules[$module_name];
         $module->backup($this->course_id, $zipfile);
     }
     $zipfile->close();
     $system_file_name = md5($timestamp);
     if (!is_dir(AT_BACKUP_DIR)) {
         @mkdir(AT_BACKUP_DIR);
     }
     if (!is_dir(AT_BACKUP_DIR . $this->course_id)) {
         @mkdir(AT_BACKUP_DIR . $this->course_id);
     }
     $zipfile->write_file(AT_BACKUP_DIR . $this->course_id . DIRECTORY_SEPARATOR . $system_file_name . '.zip');
     $row['description'] = $addslashes($description);
     $row['contents'] = addslashes(serialize($table_counters));
     $row['system_file_name'] = $system_file_name;
     $row['file_size'] = $zipfile->get_size();
     $row['file_name'] = $this->generateFileName();
     $this->add($row);
     return TRUE;
 }
开发者ID:vicentborja,项目名称:ATutor,代码行数:43,代码来源:Backup.class.php

示例4: process

 function process($file)
 {
     @xtc_set_time_limit(0);
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     $schema = 'artikelid;hersteller;herstellernummer;bezeichnung;kategorie;beschreibung_kurz;beschreibung_lang;bild_klein;deeplink;preis_val;product_ean;' . 'lagerstand;lieferzeit;vkat;vkat_ausland1a;vkde;vkde_ausland1;freeamount' . "\n";
     # added new fields by geizhals
     $export_query = xtc_db_query("SELECT\n                                           p.products_id,\n                                           pd.products_name,\n                                           pd.products_description,pd.products_short_description,\n                                           p.products_model,p.products_ean,\n                                           p.products_image,\n                                           p.products_price,\n                                           p.products_status,\n                                           p.products_date_available,\n                                           p.products_shippingtime,\n                                           p.products_discount_allowed,\n                                           pd.products_meta_keywords,\n                                           p.products_tax_class_id,\n                                           p.products_date_added,\n                                           m.manufacturers_name,\n                                           p.products_quantity,\n                                           p.products_weight\n                                    FROM\n                                           " . TABLE_PRODUCTS . " p LEFT JOIN\n                                           " . TABLE_MANUFACTURERS . " m\n                                        ON p.manufacturers_id = m.manufacturers_id LEFT JOIN\n                                           " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                                        ON p.products_id = pd.products_id AND\n                                           pd.language_id = '" . $_SESSION['languages_id'] . "' LEFT JOIN\n                                           " . TABLE_SPECIALS . " s\n                                        ON p.products_id = s.products_id\n                                     WHERE p.products_status = 1\n                                     ORDER BY\n                                           p.products_date_added DESC,\n                                           pd.products_name");
     # added p.products_quantity, p.products_weight to select by geizhals
     while ($products = xtc_db_fetch_array($export_query)) {
         $products_price = $xtPrice->xtcGetPrice($products['products_id'], $format = false, 1, $products['products_tax_class_id'], '');
         // get product categorie
         $categorie_query = xtc_db_query("SELECT\n                                              categories_id\n                                         FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\n                                        WHERE products_id='" . $products['products_id'] . "'");
         while ($categorie_data = xtc_db_fetch_array($categorie_query)) {
             $categories = $categorie_data['categories_id'];
         }
         ################## added by geizhals
         $shipping_query = xtc_db_query("SELECT\n                                             shipping_status_name\n                                        FROM " . TABLE_SHIPPING_STATUS . "\n                                       WHERE shipping_status_id=" . $products['products_shippingtime'] . " AND language_id=" . $_SESSION['languages_id']);
         $shipping_data = xtc_db_fetch_array($shipping_query);
         $shipping[] = $shipping_data['shipping_status_name'];
         $vkat_query = xtc_db_query("select configuration_value as vkat from configuration where configuration_key='MODULE_SHIPPING_AP_COST_8'");
         $vkat_data = xtc_db_fetch_array($vkat_query);
         $vkat[] = $vkat_data['vkat'];
         $vkat_ausland_query = xtc_db_query("select configuration_value as vkat from configuration where configuration_key='MODULE_SHIPPING_AP_COST_1'");
         $vkat_ausland_data = xtc_db_fetch_array($vkat_ausland_query);
         $vkat_ausland[] = $vkat_ausland_data['vkat'];
         $vkde_query = xtc_db_query("select configuration_value as vkde from configuration where configuration_key='MODULE_SHIPPING_DP_COST_6'");
         $vkde_data = xtc_db_fetch_array($vkde_query);
         $vkde[] = $vkde_data['vkde'];
         $vkde_ausland_query = xtc_db_query("select configuration_value as vkde from configuration where configuration_key='MODULE_SHIPPING_DP_COST_1'");
         $vkde_ausland_data = xtc_db_fetch_array($vkde_ausland_query);
         $vkde_ausland[] = $vkde_ausland_data['vkde'];
         $free_query = xtc_db_query("select configuration_value as freeamount from configuration where configuration_key='MODULE_SHIPPING_FREEAMOUNT_AMOUNT'");
         $free_data = xtc_db_fetch_array($free_query);
         $free[] = $free_data['freeamount'];
         ################## end added by geizhals
         // remove trash
         $products_description = strip_tags($products['products_description']);
         $products_description = str_replace("<br>", " ", $products_description);
         $products_description = str_replace("<br />", " ", $products_description);
         $products_description = str_replace(";", ", ", $products_description);
         $products_description = str_replace("'", ", ", $products_description);
         $products_description = str_replace("\n", " ", $products_description);
         $products_description = str_replace("\r", " ", $products_description);
         $products_description = str_replace("\t", " ", $products_description);
         $products_description = str_replace("\v", " ", $products_description);
         $products_description = str_replace("&quot,", " \"", $products_description);
         $products_description = str_replace("&qout,", " \"", $products_description);
         $products_description = str_replace(chr(13), " ", $products_description);
         $products_short_description = strip_tags($products['products_short_description']);
         $products_short_description = str_replace("<br>", " ", $products_short_description);
         $products_short_description = str_replace("<br />", " ", $products_short_description);
         $products_short_description = str_replace(";", ", ", $products_short_description);
         $products_short_description = str_replace("'", ", ", $products_short_description);
         $products_short_description = str_replace("\n", " ", $products_short_description);
         $products_short_description = str_replace("\r", " ", $products_short_description);
         $products_short_description = str_replace("\t", " ", $products_short_description);
         $products_short_description = str_replace("\v", " ", $products_short_description);
         $products_short_description = str_replace("&quot,", " \"", $products_short_description);
         $products_short_description = str_replace("&qout,", " \"", $products_short_description);
         $products_short_description = str_replace(chr(13), " ", $products_short_description);
         $products_short_description = substr($products_short_description, 0, 255);
         $products_description = substr($products_description, 0, 65536);
         $cat = $this->buildCAT($categories);
         if ($products['products_image'] != '') {
             $image = HTTP_CATALOG_SERVER . DIR_WS_CATALOG_THUMBNAIL_IMAGES . $products['products_image'];
         } else {
             $image = '';
         }
         //create content
         $schema .= $products['products_id'] . ";" . $products['manufacturers_name'] . ";" . $products['products_model'] . ";" . $products['products_name'] . ";" . substr($cat, 0, strlen($cat) - 2) . ";" . $products_short_description . ";" . $products_description . ";" . $image . ";" . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'product_info.php?' . $_POST['campaign'] . xtc_product_link($products['products_id'], $products['products_name']) . ";" . number_format($products_price, 2, '.', '') . ";" . $products['products_ean'] . ";" . $products['products_quantity'] . ";" . xtc_get_shipping_status_name($products['products_shippingtime']) . ";" . $this->getShipCost($vkat[0], $products['products_weight']) . ";" . $this->getShipCost($vkat_ausland[0], $products['products_weight']) . ";" . $this->getShipCost($vkde[0], $products['products_weight']) . ";" . $this->getShipCost($vkde_ausland[0], $products['products_weight']) . ";" . $free[0] . "\n";
     }
     // create File
     $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "w+");
     fputs($fp, $schema);
     fclose($fp);
     ################## added by geizhals
     // zip file
     $zipfile = new zipfile();
     $filedata = implode("", file(DIR_FS_DOCUMENT_ROOT . 'export/' . $file));
     $zipfile->add_file($filedata, $file);
     header("Content-type: application/octet-stream");
     header("Content-disposition: attachment; filename=zipfile.zip");
     $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file . '.zip', "w+");
     fputs($fp, $zipfile->file());
     fclose($fp);
     ################## end added by geizhals
     switch ($_POST['export']) {
         case 'yes':
             // send File to Browser
             $extension = substr($file, -3);
             $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "rb");
             $buffer = fread($fp, filesize(DIR_FS_DOCUMENT_ROOT . 'export/' . $file));
             fclose($fp);
             header('Content-type: application/x-octet-stream');
             header('Content-disposition: attachment; filename=' . $file);
             echo $buffer;
             exit;
             break;
     }
//.........这里部分代码省略.........
开发者ID:shophelfer,项目名称:shophelfer.com-shop,代码行数:101,代码来源:geizhals.php

示例5: array

         $str_applilcation = str_replace("[script_refund_policy]", $script_refund_policy, $str_applilcation);
         $str_applilcation = str_replace("[package_description]", $package_description, $str_applilcation);
     }
     $str_applilcation = str_replace("[company_bank]", $company_bank, $str_applilcation);
     $str_applilcation = str_replace("[beneficiary_name]", $beneficiary_name, $str_applilcation);
     $str_applilcation = str_replace("[name_on_account]", $name_on_account, $str_applilcation);
     $str_applilcation = str_replace("[bank_address]", $bank_address, $str_applilcation);
     $str_applilcation = str_replace("[bank_country]", $bank_country, $str_applilcation);
     $str_applilcation = str_replace("[bank_phone]", $bank_phone, $str_applilcation);
     $str_applilcation = str_replace("[bank_sort_code]", $bank_sort_code, $str_applilcation);
     $str_applilcation = str_replace("[bank_account_number]", $bank_account_number, $str_applilcation);
     $str_applilcation = str_replace("[bank_swift_code]", $bank_swift_code, $str_applilcation);
     $zipfile->add_dir($dir_company_name . "/");
     //$zipfile -> add_dir($dir_company_name."/Application/");
     $filedata = $str_applilcation;
     $zipfile->add_file($filedata, $dir_company_name . "/" . $str_company_name . ".html");
 }
 //print("comp. file size= ".$zipfile -> get_file_size()."<br>");
 //	print($str_company_name."<br>");
 if ($is_doc != "") {
     $myLicenceFileArray = array();
     $myArticlesFileArray = array();
     $myHistoryFileArray = array();
     $myProfessionalReferenceFileArray = array();
     //$str_qry = "select file_type, file_name from cs_uploaded_documents where user_id = $company_id and status = 'A'";
     $str_qry = "select file_type, file_name from cs_uploaded_documents where status='A' AND user_id = {$company_id}";
     if (!($show_sql = mysql_query($str_qry, $cnn_cs))) {
         print mysql_errno() . ": " . mysql_error() . "<BR>";
         print "Cannot execute query";
         print $str_qry;
         exit;
开发者ID:juliogallardo1326,项目名称:proc,代码行数:31,代码来源:downloadDocumentsNext.php

示例6: array

$imsmanifest_xml .= str_replace(array('{ORGANIZATIONS}', '{GLOSSARY}', '{RESOURCES}', '{TEST_ITEMS}', '{COURSE_TITLE}'), array($organizations_str, $glossary_manifest_xml, $resources, $test_xml_items, $ims_course_title), $ims_template_xml['final']);
/* generate the vcard for the instructor/author */
$sql = "SELECT first_name, last_name, email, website, login, phone FROM %smembers WHERE member_id=%d";
$row_member = queryDB($sql, array(TABLE_PREFIX, $instructor_id), TRUE);
$vcard = new vCard();
if (count($row_member) > 0) {
    $vcard->setName($row_member['last_name'], $row_member['first_name'], $row_member['login']);
    $vcard->setEmail($row['email']);
    $vcard->setNote('Originated from an ATutor at ' . AT_BASE_HREF . '. See ATutor.ca for additional information.');
    $vcard->setURL($row['website']);
    $imsmanifest_xml = str_replace('{VCARD}', $vcard->getVCard(), $imsmanifest_xml);
} else {
    $imsmanifest_xml = str_replace('{VCARD}', '', $imsmanifest_xml);
}
/* save the imsmanifest.xml file */
$zipfile->add_file($imsmanifest_xml, 'imsmanifest.xml');
if ($glossary_xml) {
    $zipfile->create_dir('resources/GlossaryItem/');
    $zipfile->add_file($glossary_xml, 'resources/GlossaryItem/glossary.xml');
}
$zipfile->close();
// this is optional, since send_file() closes it anyway
$ims_course_title = str_replace(array(' ', ':'), '_', $ims_course_title);
/**
 * A problem here with the preg_replace below.
 * Originally was designed to remove all werid symbols to avoid file corruptions.
 * In UTF-8, all non-english chars are considered to be 'werid symbols'
 * We can still replace it as is, or add fileid to the filename to avoid these problems
 * Well then again people won't be able to tell what this file is about
 * If we are going to take out the preg_replace, some OS might not be able to understand
 * these characters and will have problems importing.
开发者ID:genaromendezl,项目名称:ATutor,代码行数:31,代码来源:ims_export.php

示例7: array

$imsmanifest_xml .= str_replace(array('{ORGANIZATIONS}', '{RESOURCES}', '{COURSE_TITLE}'), array($organizations_str, $resources, $ims_course_title), $ims_template_xml['final']);
/* generate the vcard for the instructor/author */
$sql = "SELECT first_name, last_name, email, website, login, phone FROM %smembers WHERE member_id=%d";
$row_members = queryDB($sql, array(TABLE_PREFIX, $instructor_id), TRUE);
$vcard = new vCard();
if (count($row_members) > 0) {
    $vcard->setName($row_members['last_name'], $row_members['first_name'], $row_members['login']);
    $vcard->setEmail($row_members['email']);
    $vcard->setNote('Originated from an ATutor at ' . AT_BASE_HREF . '. See ATutor.ca for additional information.');
    $vcard->setURL($row_members['website']);
    $imsmanifest_xml = str_replace('{VCARD}', $vcard->getVCard(), $imsmanifest_xml);
} else {
    $imsmanifest_xml = str_replace('{VCARD}', '', $imsmanifest_xml);
}
/* save the imsmanifest.xml file */
$zipfile->add_file($frame, 'index.html');
$zipfile->add_file($toc_html, 'toc.html');
$zipfile->add_file($imsmanifest_xml, 'imsmanifest.xml');
$zipfile->add_file($html_mainheader, 'header.html');
$zipfile->add_file($footer, 'footer.html');
if ($glossary_xml) {
    $zipfile->add_file($glossary_xml, 'glossary.xml');
    $zipfile->add_file($glossary_html, 'glossary.html');
}
$zipfile->add_file(file_get_contents(AT_INCLUDE_PATH . '../mods/_core/imscp/include/adlcp_rootv1p2.xsd'), 'adlcp_rootv1p2.xsd');
$zipfile->add_file(file_get_contents(AT_INCLUDE_PATH . '../mods/_core/imscp/include/ims_xml.xsd'), 'ims_xml.xsd');
$zipfile->add_file(file_get_contents(AT_INCLUDE_PATH . '../mods/_core/imscp/include/imscp_rootv1p1p2.xsd'), 'imscp_rootv1p1p2.xsd');
$zipfile->add_file(file_get_contents(AT_INCLUDE_PATH . '../mods/_core/imscp/include/imsmd_rootv1p2p1.xsd'), 'imsmd_rootv1p2p1.xsd');
$zipfile->add_file(file_get_contents(AT_INCLUDE_PATH . '../mods/_core/imscp/include/ims.css'), 'ims.css');
$zipfile->add_file(file_get_contents('../../../images/logo.gif'), 'logo.gif');
$zipfile->close();
开发者ID:codedust,项目名称:ATutor,代码行数:31,代码来源:ims_export.php

示例8: time

 function process_backup($user)
 {
     include_once "class_zip.php";
     if ($_REQUEST['choice'] == 'yes') {
         //CREATE A UNIX TIMESTAMP
         $stamp = time();
         $date1 = gmdate("m-d-y", $stamp);
         $date = gmdate("Y-m-d H:i:s", $stamp);
         $title = "bu_" . $date . "_" . $user->user_name . ".zip";
         //CREATE THE BACKUP OF OUR DATABASE
         $filename = "../" . $this->config->file_dir . "/tmp_{$date1}.sql";
         passthru("mysqldump --opt -h" . $this->config->db_host . " -u" . $this->config->db_user . " -p" . $this->config->db_pass . " " . $this->config->db_name . " >{$filename}");
         //
         $zipfile = new zipfile();
         //READ THE CURRENT DIRECTORY WE ARE IN
         $dir_list = $this->read_dir("../");
         for ($i = 0; $i < count($dir_list); $i++) {
             if ($dir_list[$i]['type'] == "dir") {
                 //echo $dir_list[$i]['name']."<br/>";
                 $zipfile->add_dir($dir_list[$i]['name']);
             } else {
                 if ($dir_list[$i]['type'] == "file") {
                     //echo $dir_list[$i]['name']."<br/>";
                     $zipfile->add_file(file_get_contents($dir_list[$i]['loc'], false), $dir_list[$i]['name']);
                 }
             }
         }
         //REMOVE OUR TEMP SQL FILE
         unlink($filename);
         //CREATE THE SYSTEM NAME
         $sql = "SELECT id FROM " . $this->config->db_prefix . "_files ORDER BY id DESC";
         $results = $this->db->DB_Q_C($sql);
         $total_files = mysql_fetch_array($results);
         $total_files[0]++;
         $sys_name = "file_" . $total_files[0] . ".zip";
         //CREATE THE ZIP FILE
         $fileName = "../" . $this->config->file_dir . "/backup/{$sys_name}";
         $fd = fopen($fileName, "w");
         $out = fwrite($fd, $zipfile->file());
         fclose($fd);
         //
         $sql = "INSERT INTO `" . $this->config->db_prefix . "_files` VALUES ('', '{$title}', '{$sys_name}', '../" . $this->config->file_dir . "/backup/', 'zip', 'A backup of your site.')";
         $results = $this->db->DB_Q_C($sql);
         $lastid = mysql_insert_id();
         //LOG THE ACTION
         $sql = "INSERT INTO " . $this->config->db_prefix . "_object(create_date, create_who) \r\r\n          \t\t\t   VALUES('{$date}', '{$user->user_id}')";
         $results = $this->db->DB_Q_C($sql);
         $lastobjectid = mysql_insert_id();
         $sql = "INSERT INTO " . $this->config->db_prefix . "_logs(object_id, user_id, module_id, sub_module_id, record_id, action)\r\r\n                  VALUES({$lastobjectid}, '" . $user->user_id . "', '" . $this->id . "', 1, {$lastid}, 1)";
         $results = $this->db->DB_Q_C($sql);
         //
         $ret_code = array(1, $lastid);
     } else {
         $ret_code = array(-1, 0);
     }
     return $ret_code;
 }
开发者ID:jackmolnar,项目名称:glit_website_new,代码行数:57,代码来源:class_home.php

示例9: export

 function export($filename = '')
 {
     $search = array('"', "'", "", "\n", "\r", "");
     //\x08\\x09, not required
     $replace = array('\\"', "\\'", '\\0', '\\n', '\\r', '\\Z');
     // use a function to generate the ini file
     // use a diff fn to generate the sql dump
     // use the zipfile class to package the ini file and the sql dump
     $sql_dump = "INSERT INTO `languages` VALUES ('{$this->code}', '{$this->characterSet}', '{$this->direction}', '{$this->regularExpression}', '{$this->nativeName}', '{$this->englishName}', {$this->status});\r\n\r\n";
     $sql_dump .= "INSERT INTO `language_text` VALUES ";
     $sql = "SELECT * FROM %slanguage_text WHERE language_code='%s' ORDER BY variable, term";
     $rows_text = queryDB($sql, array(TABLE_PREFIX, $this->code));
     if (count($rows_text) > 0) {
         foreach ($rows_text as $row) {
             $row['text'] = str_replace($search, $replace, $row['text']);
             $row['context'] = str_replace($search, $replace, $row['context']);
             $sql_dump .= "('{$this->code}', '{$row['variable']}', '{$row['term']}', '{$row['text']}', '{$row['revised_date']}', '{$row['context']}'),\r\n";
         }
     } else {
         $this->msg->addError('LANG_EMPTY');
     }
     $sql_dump = substr($sql_dump, 0, -3) . ";";
     $readme = 'This is an ATutor language pack. Use the administrator Language section to import this language pack or manually import the contents of the SQL file into your [table_prefix]language_text table, where `table_prefix` should be replaced with your correct ATutor table prefix as defined in ./include/config.inc.php . Additional Language Packs can be found on http://atutor.ca .';
     require AT_INCLUDE_PATH . 'classes/zipfile.class.php';
     $zipfile = new zipfile();
     $zipfile->add_file($sql_dump, 'language_text.sql');
     $zipfile->add_file($readme, 'readme.txt');
     $zipfile->add_file($this->getXML(), 'language.xml');
     if ($filename) {
         $fp = fopen($filename, 'wb+');
         fwrite($fp, $zipfile->get_file(), $zipfile->get_size());
     } else {
         $version = str_replace('.', '_', VERSION);
         $zipfile->send_file('atutor_' . $version . '_' . $this->code);
     }
 }
开发者ID:genaromendezl,项目名称:ATutor,代码行数:36,代码来源:LanguageEditor.class.php

示例10: pack

        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
    }
}
?>
 

Example Usage of the Class

<?php 
$zipfile = new zipfile();
// add the subdirectory ... important!
$zipfile->add_dir("test/");
// add the binary data stored in the string 'filedata'
//$filename = "c:\\apache\\apache\\htdocs\\projects\\companysetup\\admin\\5_SREEnew.doc";
$filename = "c:\\apache\\apache\\htdocs\\projects\\companysetup\\admin\\passports.jpg";
$handle = fopen($filename, "rb");
$contents = fread($handle, filesize($filename));
fclose($handle);
$filedata = $contents;
$zipfile->add_file($filedata, "test/passports.jpg");
// the next three lines force an immediate download of the zip file:
//header("Content-type: application/octet-stream");
//header("Content-disposition: attachment; filename=test.zip");
//echo $zipfile -> file();
// OR instead of doing that, you can write out the file to the loca disk like this:
$filename = "output.zip";
$fd = fopen($filename, "wb");
$out = fwrite($fd, $zipfile->file());
fclose($fd);
// then offer it to the user to download:
开发者ID:juliogallardo1326,项目名称:proc,代码行数:31,代码来源:zip_test.php

示例11: zipfile

<?php

define('AT_INCLUDE_PATH', '../../../include/');
require AT_INCLUDE_PATH . 'vitals.inc.php';
//require (AT_INCLUDE_PATH.'header.inc.php');
$forum_id = $_GET['fid'];
$forum_title = $_GET['title'];
require 'forum_post.php';
require AT_INCLUDE_PATH . 'classes/zipfile.class.php';
$zipfile = new zipfile();
$zipfile->add_file(file_get_contents(AT_CONTENT_DIR . '/exported_forum.html'), 'exported_forum.html');
foreach ($filearr as $val) {
    $zipfile->add_file(file_get_contents(AT_CONTENT_DIR . '/' . $val), $val);
    unlink(AT_CONTENT_DIR . '/' . $val);
}
$zipfile->add_file(file_get_contents(AT_CONTENT_DIR . '/styles.css'), 'styles.css');
unlink(AT_CONTENT_DIR . '/styles.css');
// replaces spaces with underscores
if (strpos($forum_title, chr(32)) != false) {
    $forum_title = str_replace(chr(32), chr(95), $forum_title);
}
$zipfile->send_file($forum_title);
exit;
?>

<?php 
//require (AT_INCLUDE_PATH.'footer.inc.php');
开发者ID:genaromendezl,项目名称:ATutor,代码行数:27,代码来源:send_zip_archive.php

示例12: UsersDAO

//$sql = "SELECT first_name, last_name, email, website, login, phone FROM ".TABLE_PREFIX."members WHERE member_id=$instructor_id";
//$result = mysql_query($sql, $db);
$usersDAO = new UsersDAO();
$row = $usersDAO->getUserByID($instructor_id);
$vcard = new vCard();
if (isset($row)) {
    $vcard->setName($row['last_name'], $row['first_name'], $row['login']);
    $vcard->setEmail($row['email']);
    $vcard->setNote('Originated from an AContent at ' . TR_BASE_HREF . '. See ATutor.ca for additional information.');
    $vcard->setURL($row['website']);
    $imsmanifest_xml = str_replace('{VCARD}', $vcard->getVCard(), $imsmanifest_xml);
} else {
    $imsmanifest_xml = str_replace('{VCARD}', '', $imsmanifest_xml);
}
/* save the imsmanifest.xml file */
$zipfile->add_file($frame, 'index.html');
$zipfile->add_file($toc_html, 'toc.html');
$zipfile->add_file($imsmanifest_xml, 'imsmanifest.xml');
$zipfile->add_file($html_mainheader, 'header.html');
// Modified by Cindy Qi Li on Jun 3, 2010
// AContent does not support glossary
/*
if ($glossary_xml) {
	$zipfile->add_file($glossary_xml,  'glossary.xml');
	$zipfile->add_file($glossary_html, 'glossary.html');
}
*/
// END OF Modified by Cindy Qi Li on Jun 3, 2010
$zipfile->add_file(file_get_contents(TR_INCLUDE_PATH . '../home/ims/include/adlcp_rootv1p2.xsd'), 'adlcp_rootv1p2.xsd');
$zipfile->add_file(file_get_contents(TR_INCLUDE_PATH . '../home/ims/include/ims_xml.xsd'), 'ims_xml.xsd');
$zipfile->add_file(file_get_contents(TR_INCLUDE_PATH . '../home/ims/include/imscp_rootv1p1p2.xsd'), 'imscp_rootv1p1p2.xsd');
开发者ID:harriswong,项目名称:AContent,代码行数:31,代码来源:ims_export.php

示例13: getDirList

            //print("comp. file size= ".$zipfile -> get_file_size()."<br>");
        }
        if (count($myProfessionalReferenceFileArray) > 0) {
            for ($i_loop = 0; $i_loop < count($myProfessionalReferenceFileArray); $i_loop++) {
                $filedata = func_read_file("../gateway/" . $_SESSION['gw_folder'] . "UserDocuments/Professional_Reference/" . $myProfessionalReferenceFileArray[$i_loop]);
                $compressed_file_size = func_get_compressed_file_size($filedata);
                if ($zipfile->get_file_size() + $compressed_file_size >= $i_max_file_size_MB) {
                    $arr_result = func_send_documents($zipfile, $str_company_name, $other_email, $str_failure_companies, $i_max_file_size_MB, $error_msg);
                    $zipfile = new zipfile();
                    $zipfile->add_dir($dir_company_name . "/Professional_Reference/");
                } else {
                    if ($i_loop == 0) {
                        $zipfile->add_dir($dir_company_name . "/Professional_Reference/");
                    }
                }
                $zipfile->add_file($filedata, $dir_company_name . "/Professional_Reference/" . $myProfessionalReferenceFileArray[$i_loop]);
            }
            //print("comp. file size= ".$zipfile -> get_file_size()."<br>");
        }
    }
    if ($zipfile->get_file_size() > 0) {
        $arr_result = func_send_documents($zipfile, $str_company_name, $other_email, $str_failure_companies, $i_max_file_size_MB, $error_msg);
    }
}
function getDirList($dirName, $i_company)
{
    $d = dir($dirName);
    $filename = "";
    while ($entry = $d->read()) {
        //echo strpos($entry,$i_company);
        if ($entry != "." && $entry != "..") {
开发者ID:juliogallardo1326,项目名称:proc,代码行数:31,代码来源:send_applicationfb.php

示例14: export

 function export($filename = '')
 {
     //		$search  = array('"', "'", "\x00", "\x0a", "\x0d", "\x1a"); //\x08\\x09, not required
     //		$replace = array('\"', "\'", '\0', '\n', '\r', '\Z');
     // use a function to generate the ini file
     // use a diff fn to generate the sql dump
     // use the zipfile class to package the ini file and the sql dump
     global $addslashes;
     $sql_dump = "INSERT INTO `languages` VALUES ('{$this->code}', '{$this->characterSet}', '{$this->regularExpression}', '{$this->nativeName}', '{$this->englishName}', {$this->status});\r\n\r\n";
     $sql_dump .= "INSERT INTO `language_text` VALUES ";
     $languageTextDAO = new LanguageTextDAO();
     $rows = $languageTextDAO->getAllByLang($this->code);
     if (is_array($rows)) {
         foreach ($rows as $row) {
             //				$row['text']    = str_replace($search, $replace, $row['text']);
             //				$row['context'] = str_replace($search, $replace, $row['context']);
             $row['text'] = $addslashes($row['text']);
             $row['context'] = $addslashes($row['context']);
             $sql_dump .= "('{$this->code}', '{$row['variable']}', '{$row['term']}', '{$row['text']}', '{$row['revised_date']}', '{$row['context']}'),\r\n";
         }
     } else {
         $this->msg->addError('LANG_EMPTY');
         return;
     }
     $sql_dump = substr($sql_dump, 0, -3) . ";";
     $readme = 'This is an AChecker language pack. Use the administrator Language section to import this language pack or manually import the contents of the SQL file into your [table_prefix]language_text table, where `table_prefix` should be replaced with your correct AChecker table prefix as defined in ./include/config.inc.php .';
     require AC_INCLUDE_PATH . 'classes/zipfile.class.php';
     $zipfile = new zipfile();
     $zipfile->add_file($sql_dump, 'language_text.sql');
     $zipfile->add_file($readme, 'readme.txt');
     $zipfile->add_file($this->getXML(), 'language.xml');
     if ($filename) {
         $fp = fopen($filename, 'wb+');
         fwrite($fp, $zipfile->get_file(), $zipfile->get_size());
     } else {
         $version = str_replace('.', '_', VERSION);
         $zipfile->send_file('achecker_' . $version . '_' . $this->code);
     }
 }
开发者ID:giuliaforsythe,项目名称:AChecker,代码行数:39,代码来源:LanguageEditor.class.php

示例15: date

        $pdfcontent = $exportobj->MakePdf($xmlArr, $TagArr, $repeat, '', '', $csv, '', '', $enc);
        $pdfcontent = "<h1 align='center'>Invoice Details</h1></br>" . $pdfcontent;
        // Prints($csvcontent);exit;
        break;
}
//exit();
//$html = $exportobj->GenerateFormat($fieldArr,$dataArr,$CallFunctionArr);
$xml .= $htmlcontent;
$xml .= '</Dataroot>' . "\n";
// pr($csvcontent); exit;
// print($exportobj->output_xml($xml));exit;
ini_set('zlib.output_compression', 'Off');
$html = $exportobj->GenerateXml($xml);
// pr($html); exit;
$timeval = date('Y-m-d_H_i_s');
$zip->add_file($html, 'export_' . $timeval . '.xml');
$zip->add_file($csvcontent, 'export_' . $timeval . '.csv');
define('_MPDF_PATH', SITE_CO_PATH . 'MPDF44/');
//include(DIR_LIB . '/fpdf/mpdf.php');
include SITE_CO_PATH . "MPDF44/mpdf.php";
$mpdf = new mPDF();
//$mpdf=new mPDF('utf-8-s');
$mpdf->AddPage();
$mpdf->WriteHTML($pdfcontent);
$pdffile = $mpdf->Output('export_' . $timeval . '.pdf', 'S');
$zip->add_file($pdffile, 'export_' . $timeval . '.pdf');
//$filepath = $zip->file();
// $mime = 'application/download';
$mime = 'application/zip';
header('Content-type: ' . $mime);
header('Content-Disposition: attachment; filename=export.zip');
开发者ID:nstungxd,项目名称:F2CA5,代码行数:31,代码来源:exportinvoice.php


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