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


PHP TimeDate::httpTime方法代码示例

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


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

示例1: generateItem

    protected function generateItem($item)
    {
        $name = !empty($item['name_value_list']['name']['value']) ? htmlentities($item['name_value_list']['name']['value']) : '';
        $url = $GLOBALS['sugar_config']['site_url'] . htmlentities('/index.php?module=' . $item['module_name'] . '&action=DetailView&record=' . $item['id']);
        $date = TimeDate::httpTime(TimeDate::getInstance()->fromDb($item['name_value_list']['date_modified']['value'])->getTimestamp());
        $description = '';
        $displayFieldNames = true;
        if (count($item['name_value_list']) == 2 && isset($item['name_value_list']['name'])) {
            $displayFieldNames = false;
        }
        foreach ($item['name_value_list'] as $k => $v) {
            if ($k == 'name' || $k == 'date_modified') {
                continue;
            }
            if ($displayFieldNames) {
                $description .= '<b>' . htmlentities($k) . ':<b>&nbsp;';
            }
            $description .= htmlentities($v['value']) . "<br>";
        }
        echo <<<EORSS
    <item>
        <title>{$name}</title>
        <link>{$url}</link>
        <description><![CDATA[{$description}]]></description>
        <pubDate>{$date} GMT</pubDate>
        <guid>{$item['id']}</guid>
    </item>

EORSS;
    }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:30,代码来源:SugarRestRSS.php

示例2: doExport

 /**
  * Utility method to allow for subclasses to do the same export calls
  *
  * @param ServiceBase $api
  * @param string $filename The File name for the export
  * @param string $content What should be in the exported file
  * @return mixed
  */
 protected function doExport(ServiceBase $api, $filename, $content)
 {
     $api->setHeader("Pragma", "cache");
     $api->setHeader("Content-Type", "application/octet-stream; charset=" . $GLOBALS['locale']->getExportCharset());
     $api->setHeader("Content-Disposition", "attachment; filename={$filename}.csv");
     $api->setHeader("Content-transfer-encoding", "binary");
     $api->setHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT");
     $api->setHeader("Last-Modified", TimeDate::httpTime());
     $api->setHeader("Cache-Control", "post-check=0, pre-check=0");
     return $GLOBALS['locale']->translateCharset($content, 'UTF-8', $GLOBALS['locale']->getExportCharset());
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:19,代码来源:ExportApi.php

示例3: template_handle_export

function template_handle_export(&$reporter)
{
    ini_set('zlib.output_compression', 'Off');
    $reporter->plain_text_output = true;
    //disable paging so we get all results in one pass
    $reporter->enable_paging = false;
    $reporter->run_query();
    $reporter->_load_currency();
    $header_arr = array();
    $header_row = $reporter->get_header_row();
    $content = '';
    foreach ($header_row as $cell) {
        array_push($header_arr, $cell);
    }
    $header = implode("\"" . getDelimiter() . "\"", array_values($header_arr));
    $header = "\"" . $header;
    $header .= "\"\r\n";
    $content .= $header;
    while (($row = $reporter->get_next_row('result', 'display_columns', false, true)) != 0) {
        $new_arr = array();
        for ($i = 0; $i < count($row['cells']); $i++) {
            array_push($new_arr, preg_replace("/\"/", "\"\"", from_html($row['cells'][$i])));
        }
        $line = implode("\"" . getDelimiter() . "\"", $new_arr);
        $line = "\"" . $line;
        $line .= "\"\r\n";
        $content .= $line;
    }
    global $locale;
    $transContent = $GLOBALS['locale']->translateCharset($content, 'UTF-8', $GLOBALS['locale']->getExportCharset());
    ob_clean();
    header("Pragma: cache");
    header("Content-type: application/octet-stream; charset=" . $locale->getExportCharset());
    header("Content-Disposition: attachment; filename={$_REQUEST['module']}.csv");
    header("Content-transfer-encoding: binary");
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Last-Modified: " . TimeDate::httpTime());
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Content-Length: " . mb_strlen($transContent, '8bit'));
    $BOM = "";
    print $BOM . $transContent;
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:42,代码来源:templates_export.php

示例4: set_time_limit

global $current_user, $beanFiles;
set_time_limit(3600);
$db = DBManagerFactory::getInstance();
if (is_admin($current_user) || isset($from_sync_client) || is_admin_for_any_module($current_user)) {
    isset($_REQUEST['execute']) ? $execute = $_REQUEST['execute'] : ($execute = false);
    $export = false;
    if (sizeof($_POST) && isset($_POST['raction'])) {
        if (isset($_POST['raction']) && strtolower($_POST['raction']) == "export") {
            //jc - output buffering is being used. if we do not clean the output buffer
            //the contents of the buffer up to the length of the repair statement(s)
            //will be saved in the file...
            ob_clean();
            header("Content-Disposition: attachment; filename=repairSugarDB.sql");
            header("Content-Type: text/sql; charset={$app_strings['LBL_CHARSET']}");
            header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
            header("Last-Modified: " . TimeDate::httpTime());
            header("Cache-Control: post-check=0, pre-check=0", false);
            header("Content-Length: " . strlen($_POST['sql']));
            //jc:7347 - for whatever reason, html_entity_decode is choking on converting
            //the html entity &#039; to a single quote, so we will use str_replace
            //instead
            $sql = str_replace('&#039;', "'", $_POST['sql']);
            //echo html_entity_decode($_POST['sql']);
            echo $sql;
        } elseif (isset($_POST['raction']) && strtolower($_POST['raction']) == "execute") {
            $sql = str_replace(array("\n", '&#039;'), array('', "'"), preg_replace('#(/\\*.+?\\*/\\n*)#', '', $_POST['sql']));
            foreach (explode(";", $sql) as $stmt) {
                $stmt = trim($stmt);
                if (!empty($stmt)) {
                    $db->query($stmt, true, 'Executing repair query: ');
                }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:31,代码来源:repairDatabase.php

示例5: build_report_csv

 function build_report_csv()
 {
     ini_set('zlib.output_compression', 'Off');
     ob_start();
     require_once 'include/export_utils.php';
     $delimiter = getDelimiter();
     $csv = '';
     //text/comma-separated-values
     $sql = "SELECT id FROM aor_fields WHERE aor_report_id = '" . $this->id . "' AND deleted = 0 ORDER BY field_order ASC";
     $result = $this->db->query($sql);
     $fields = array();
     $i = 0;
     while ($row = $this->db->fetchByAssoc($result)) {
         $field = new AOR_Field();
         $field->retrieve($row['id']);
         $path = unserialize(base64_decode($field->module_path));
         $field_module = $this->report_module;
         if ($path[0] != $this->report_module) {
             foreach ($path as $rel) {
                 $field_module = getRelatedModule($field_module, $rel);
             }
         }
         $label = str_replace(' ', '_', $field->label) . $i;
         $fields[$label]['field'] = $field->field;
         $fields[$label]['display'] = $field->display;
         $fields[$label]['function'] = $field->field_function;
         $fields[$label]['module'] = $field_module;
         if ($field->display) {
             $csv .= $this->encloseForCSV($field->label);
             $csv .= $delimiter;
         }
         ++$i;
     }
     $sql = $this->build_report_query();
     $result = $this->db->query($sql);
     while ($row = $this->db->fetchByAssoc($result)) {
         $csv .= "\r\n";
         foreach ($fields as $name => $att) {
             if ($att['display']) {
                 if ($att['function'] != '') {
                     $csv .= $this->encloseForCSV($row[$name]);
                 } else {
                     $csv .= $this->encloseForCSV(trim(strip_tags(getModuleField($att['module'], $att['field'], $att['field'], 'DetailView', $row[$name]))));
                 }
                 $csv .= $delimiter;
             }
         }
     }
     $csv = $GLOBALS['locale']->translateCharset($csv, 'UTF-8', $GLOBALS['locale']->getExportCharset());
     ob_clean();
     header("Pragma: cache");
     header("Content-type: text/comma-separated-values; charset=" . $GLOBALS['locale']->getExportCharset());
     header("Content-Disposition: attachment; filename={$this->name}.csv");
     header("Content-transfer-encoding: binary");
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     header("Last-Modified: " . TimeDate::httpTime());
     header("Cache-Control: post-check=0, pre-check=0", false);
     header("Content-Length: " . mb_strlen($csv, '8bit'));
     if (!empty($sugar_config['export_excel_compatible'])) {
         $csv == chr(255) . chr(254) . mb_convert_encoding($csv, 'UTF-16LE', 'UTF-8');
     }
     print $csv;
     sugar_cleanup(true);
 }
开发者ID:omusico,项目名称:suitecrm-docker,代码行数:64,代码来源:AOR_Report.php

示例6: http_GET

 /**
  * GET method handler
  *
  * @param void
  * @returns void
  */
 function http_GET()
 {
     // TODO check for invalid stream
     $options = array();
     $options["path"] = $this->path;
     $this->_get_ranges($options);
     if (true === ($status = $this->get($options))) {
         if (!headers_sent()) {
             $status = "200 OK";
             if (!isset($options['mimetype'])) {
                 $options['mimetype'] = "application/octet-stream";
             }
             header("Content-type: {$options['mimetype']}");
             if (isset($options['mtime'])) {
                 header("Last-modified: " . TimeDate::httpTime());
             }
             if (isset($options['stream'])) {
                 // GET handler returned a stream
                 if (!empty($options['ranges']) && 0 === fseek($options['stream'], 0, SEEK_SET)) {
                     // partial request and stream is seekable
                     if (count($options['ranges']) === 1) {
                         $range = $options['ranges'][0];
                         if (isset($range['start'])) {
                             fseek($options['stream'], $range['start'], SEEK_SET);
                             if (feof($options['stream'])) {
                                 http_status("416 Requested range not satisfiable");
                                 exit;
                             }
                             if (isset($range['end'])) {
                                 $size = $range['end'] - $range['start'] + 1;
                                 http_status("206 partial");
                                 header("Content-length: {$size}");
                                 header("Content-range: {$range['start']}-{$range['end']}/" . (isset($options['size']) ? $options['size'] : "*"));
                                 while ($size && !feof($options['stream'])) {
                                     $buffer = fread($options['stream'], 4096);
                                     $size -= strlen($buffer);
                                     echo $buffer;
                                 }
                             } else {
                                 http_status("206 partial");
                                 if (isset($options['size'])) {
                                     header("Content-length: " . ($options['size'] - $range['start']));
                                     header("Content-range: {$start}-{$end}/" . (isset($options['size']) ? $options['size'] : "*"));
                                 }
                                 fpassthru($options['stream']);
                             }
                         } else {
                             header("Content-length: " . $range['last']);
                             fseek($options['stream'], -$range['last'], SEEK_END);
                             fpassthru($options['stream']);
                         }
                     } else {
                         $this->_multipart_byterange_header();
                         // init multipart
                         foreach ($options['ranges'] as $range) {
                             // TODO what if size unknown? 500?
                             if (isset($range['start'])) {
                                 $from = $range['start'];
                                 $to = !empty($range['end']) ? $range['end'] : $options['size'] - 1;
                             } else {
                                 $from = $options['size'] - $range['last'] - 1;
                                 $to = $options['size'] - 1;
                             }
                             $total = isset($options['size']) ? $options['size'] : "*";
                             $size = $to - $from + 1;
                             $this->_multipart_byterange_header($options['mimetype'], $from, $to, $total);
                             fseek($options['stream'], $start, SEEK_SET);
                             while ($size && !feof($options['stream'])) {
                                 $buffer = fread($options['stream'], 4096);
                                 $size -= strlen($buffer);
                                 echo $buffer;
                             }
                         }
                         $this->_multipart_byterange_header();
                         // end multipart
                     }
                 } else {
                     // normal request or stream isn't seekable, return full content
                     if (isset($options['size'])) {
                         header("Content-length: " . $options['size']);
                     }
                     fpassthru($options['stream']);
                     return;
                     // no more headers
                 }
             } elseif (isset($options['data'])) {
                 if (is_array($options['data'])) {
                     // reply to partial request
                 } else {
                     header("Content-length: " . strlen($options['data']));
                     echo $options['data'];
                 }
             }
         }
//.........这里部分代码省略.........
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:101,代码来源:Server.php

示例7: substr

    if (empty($yui_path[$version])) {
        continue;
    }
    $path = $yui_path[$version] . substr($param, strlen($version));
    $extension = substr($path, strrpos($path, "_") + 1);
    //Only allowed file extensions
    if (empty($types[$extension])) {
        continue;
    }
    if (empty($contentType)) {
        $contentType = $types[$extension];
    }
    //Put together the final filepath
    $path = substr($path, 0, strrpos($path, "_")) . "." . $extension;
    $contents = '';
    if (is_file($path)) {
        $out .= "/*" . $path . "*/\n";
        $contents = file_get_contents($path);
        $out .= $contents . "\n";
    }
    $path = empty($contents) ? $path : $contents;
    $allpath .= md5($path);
}
$etag = '"' . md5($allpath) . '"';
// try to use the content cached locally if it's the same as we have here.
header("Cache-Control: private");
header("Pragma: dummy=bogus");
header("Etag: {$etag}");
header('Expires: ' . TimeDate::httpTime(time() + 86400));
header("Content-Type: {$contentType}");
echo $out;
开发者ID:rgauss,项目名称:sugarcrm_dev,代码行数:31,代码来源:getYUIComboFile.php

示例8: saveVCard

 function saveVCard()
 {
     global $locale;
     $content = $this->toString();
     if (!defined('SUITE_PHPUNIT_RUNNER')) {
         header("Content-Disposition: attachment; filename={$this->name}.vcf");
         header("Content-Type: text/x-vcard; charset=" . $locale->getExportCharset());
         header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
         header("Last-Modified: " . TimeDate::httpTime());
         header("Cache-Control: max-age=0");
         header("Pragma: public");
         //bug45856 IIS Doesn't like this to be set and it causes the vCard to not get saved
         if (preg_match('/iis/i', $_SERVER['SERVER_SOFTWARE']) === 0) {
             header("Content-Length: " . strlen($content));
         }
     }
     print $locale->translateCharset($content, 'UTF-8', $locale->getExportCharset());
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:18,代码来源:vCard.php

示例9: outputFile

 /**
  * Sends an HTTP response with the contents of the request file for download
  *
  * @param boolean $forceDownload true if force to download the file
  * @param array $info Array containing the file details.
  * Currently supported:
  * - content-type - content type for the file
  *
  */
 public function outputFile($forceDownload, array $info)
 {
     if (empty($info['path'])) {
         throw new SugarApiException('No file name supplied');
     }
     if (!empty($info['doc_type']) && $info['doc_type'] != "Sugar") {
         $this->api->setHeader("Location", $info['uri']);
         return;
     }
     $this->api->setHeader("Expires", TimeDate::httpTime(time() + 2592000));
     if (!$forceDownload) {
         if (!empty($info['content-type'])) {
             $this->api->setHeader("Content-Type", $info['content-type']);
         } else {
             $this->api->setHeader("Content-Type", "application/octet-stream");
         }
     } else {
         $this->api->setHeader("Content-Type", "application/force-download");
         $this->api->setHeader("Content-type", "application/octet-stream");
         if (empty($info['name'])) {
             $info['name'] = pathinfo($info['path'], PATHINFO_BASENAME);
         }
         $this->api->setHeader("Content-Disposition", "attachment; filename=\"" . $info['name'] . "\"");
     }
     $this->api->fileResponse($info['path']);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:35,代码来源:download_file.php

示例10: export

 /**
  * export
  *
  * @param $contents String value of the file contents
  */
 public function export($contents)
 {
     global $locale;
     $filename = $this->getFilename();
     header("Content-Disposition: attachment; filename=\"{$filename}\"");
     header("Content-Type: text/x-csv");
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     header("Last-Modified: " . TimeDate::httpTime());
     header("Cache-Control: post-check=0, pre-check=0", false);
     header("Content-Length: " . mb_strlen($locale->translateCharset($contents, 'UTF-8', $locale->getExportCharset())));
     echo $locale->translateCharset($contents, 'UTF-8', $locale->getExportCharset());
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:17,代码来源:AbstractExport.php

示例11: action_exportrss

 function action_exportrss()
 {
     //Bug 30094, If zlib is enabled, it can break the calls to header() due to output buffering. This will only work php5.2+
     ini_set('zlib.output_compression', 'Off');
     ob_start();
     $tmpfname = tempnam(sys_get_temp_dir(), "kitten");
     $zip = new ZipArchive();
     $res = $zip->open($tmpfname, ZipArchive::CREATE);
     if ($res === TRUE) {
         $bean = BeanFactory::getBean('xeBaySellerLists');
         $auction_list = $bean->get_full_list("", "listing_type='Chinese'");
         $fixedprice_list = $bean->get_full_list("", "listing_type='FixedPriceItem'");
         if (empty($auction_list)) {
             $auction_list = array();
         }
         if (empty($fixedprice_list)) {
             $fixedprice_list = array();
         }
         $item_list = array_merge($auction_list, $fixedprice_list);
         foreach ($item_list as &$item) {
             if (empty($item->xebaylisting_id)) {
                 continue;
             }
             $rss = $item->build_shopwindow_topmost(true);
             if (!empty($rss)) {
                 $zip->addFromString("{$item->xebaylisting_id}-topmost.xml", $rss);
             }
             $rss = $item->build_shopwindow_correlation(true);
             if (!empty($rss)) {
                 $zip->addFromString("{$item->xebaylisting_id}-correlation.xml", $rss);
             }
             $rss = $item->build_shopwindow_random(true);
             if (!empty($rss)) {
                 $zip->addFromString("{$item->xebaylisting_id}-random.xml", $rss);
             }
         }
         $zip->close();
         $zipContent = file_get_contents($tmpfname);
         unlink($tmpfname);
         ob_clean();
         header("Pragma: cache");
         header('Content-Type: application/octet-stream');
         header("Content-Disposition: attachment; filename=rss.zip");
         header("Content-transfer-encoding: binary");
         header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
         header("Last-Modified: " . TimeDate::httpTime());
         header("Cache-Control: post-check=0, pre-check=0", false);
         header("Content-Length: " . strlen($zipContent));
         print $zipContent;
     } else {
         echo 'Export RSS failed';
     }
     sugar_cleanup(true);
 }
开发者ID:sunmo,项目名称:snowlotus,代码行数:54,代码来源:controller.php

示例12: exportPdf

 /**
  * Export a Report As PDF
  * @param SugarBean $report
  * @return null
  */
 protected function exportPdf(ServiceBase $api, SugarBean $report)
 {
     global $beanList, $beanFiles;
     global $sugar_config, $current_language;
     require_once 'modules/Reports/templates/templates_pdf.php';
     $report_filename = false;
     if ($report->id != null) {
         //Translate pdf to correct language
         $reporter = new Report(html_entity_decode($report->content), '', '');
         $reporter->layout_manager->setAttribute("no_sort", 1);
         $reporter->fromApi = true;
         //Translate pdf to correct language
         $mod_strings = return_module_language($current_language, 'Reports');
         //Generate actual pdf
         $report_filename = template_handle_pdf($reporter, false);
         $api->setHeader("Content-Type", "application/pdf");
         $api->setHeader("Content-Disposition", 'attachment; filename="' . basename($report_filename) . '"');
         $api->setHeader("Expires", TimeDate::httpTime(time() + 2592000));
         $api->fileResponse($report_filename);
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:26,代码来源:ReportsExportApi.php

示例13: saveVCardApi

 public function saveVCardApi(ServiceBase $api)
 {
     global $locale;
     $content = $this->toString();
     $api->setHeader("Content-Disposition", "attachment; filename={$this->name}.vcf");
     $api->setHeader("Content-Type", "text/x-vcard; charset=" . $locale->getExportCharset());
     $api->setHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT");
     $api->setHeader("Last-Modified", TimeDate::httpTime());
     $api->setHeader("Cache-Control", "max-age=0");
     $api->setHeader("Pragma", "public");
     return $locale->translateCharset($content, 'UTF-8', $locale->getExportCharset());
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:12,代码来源:vCard.php

示例14: exportProject

 /**
  * Method to download a file exported
  * @codeCoverageIgnore
  */
 public function exportProject($id, ServiceBase $api)
 {
     $projectContent = $this->getProject(array('id' => $id));
     //File Name
     $filename = str_replace(' ', '_', $projectContent['project'][$this->name]) . '.' . $this->extension;
     $api->setHeader("Content-Disposition", "attachment; filename=" . $filename);
     $api->setHeader("Content-Type", "application/" . $this->extension);
     $api->setHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT");
     $api->setHeader("Last-Modified", TimeDate::httpTime());
     $api->setHeader("Cache-Control", "max-age=0");
     $api->setHeader("Pragma", "public");
     return serialize($projectContent);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:17,代码来源:PMSEExporter.php

示例15: saveVCard

 function saveVCard()
 {
     global $locale;
     $content = $this->toString();
     if (!defined('SUGAR_PHPUNIT_RUNNER')) {
         header("Content-Disposition: attachment; filename={$this->name}.vcf");
         header("Content-Type: text/x-vcard; charset=" . $locale->getExportCharset());
         header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
         header("Last-Modified: " . TimeDate::httpTime());
         header("Cache-Control: max-age=0");
         header("Pragma: public");
         header("Content-Length: " . strlen($content));
     }
     print $locale->translateCharset($content, 'UTF-8', $locale->getExportCharset());
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:15,代码来源:vCard.php


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