Source for file GC_Utils.php
Documentation is available at GC_Utils.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* @author LOCKON CO.,LTD.
* @version $Id: GC_Utils.php 18734 2010-06-22 08:45:33Z nanasess $
/*----------------------------------------------------------------------
* [概要] 引数データをCSVとして、クライアントにダウンロードさせる
* [注釈] 引数は1,2ともカンマ区切りになっていること
*----------------------------------------------------------------------*/
$fiest_name = date("YmdHis") . ".csv";
Header("Content-disposition: attachment; filename=${fiest_name}");
Header("Content-type: application/octet-stream; name=${fiest_name}");
$return = $header. $contents;
if (mb_detect_encoding($return) == CHAR_CODE){ //文字コード変換
$return = mb_convert_encoding($return,'SJIS',CHAR_CODE);
$return = str_replace( array( "\r\n", "\r" ), "\n", $return); // 改行方法の統一
/*----------------------------------------------------------------------
* [引数] 1:CSVにする配列 2:引数1が連想配列時の添え字を指定した配列
*----------------------------------------------------------------------*/
function gfSetCsv( $array, $arrayIndex = "" ){
//引数$arrayIndexは、$arrayが連想配列のときに添え字を指定してやるために使用する
for ($i= 0; $i< count($array); $i++ ){
for ($j= 0; $j< count($array[$i]); $j++ ){
if ( $j > 0 ) $return .= ",";
$return .= mb_ereg_replace("<","<",mb_ereg_replace( "\"","\"\"",$array[$i][$arrayIndex[$j]] )) . "\"";
$return .= mb_ereg_replace("<","<",mb_ereg_replace( "\"","\"\"",$array[$i][$j] )) . "\"";
/*----------------------------------------------------------------------
* [引数] 1:日付文字列(yyyy/mm/dd、yyyy-mm-dd hh:mm:ss等)
*----------------------------------------------------------------------*/
list ($by, $bm, $bd) = split("[-/ ]", $dbdate);
if($tm * 100 + $td < $bm * 100 + $bd) $age-- ;
/*----------------------------------------------------------------------
* [概要] ログファイルに変数の詳細を出力する。
*----------------------------------------------------------------------*/
if(DEBUG_MODE === true) {
$fp = fopen(LOG_PATH, "a+");
/*----------------------------------------------------------------------
* [概要] ログファイルに日時、処理ファイル名、メッセージを出力
*----------------------------------------------------------------------*/
$today = date("Y/m/d H:i:s");
$mess = strtr($mess, $trans_tbl);
$fp = fopen($path, "a+");
fwrite( $fp, $today. " [". $_SERVER['PHP_SELF']. "] ". $mess. " from ". $_SERVER['REMOTE_ADDR']. "\n" );
* XXX この類のローテーションは通常 0 開始だが、本実装は 1 開始である。
* @param integer $max_log 最大ファイル数
* @param integer $max_size 最大サイズ
* @param string $path ファイルパス
// ファイルが最大サイズを超えていない場合、終了
if (filesize($path) <= $max_size) return;
for ($i = $max_log; $i >= 2; $i-- ) {
$path_old = "$path." . ($i - 1);
/*----------------------------------------------------------------------
*----------------------------------------------------------------------*/
$character = "abcdefghkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ2345679";
$pw = preg_split("//", $character, 0, PREG_SPLIT_NO_EMPTY);
for($i = 0; $i< $pwLength; $i++ ) {
/*----------------------------------------------------------------------
*----------------------------------------------------------------------*/
$ext2 = $ext1[count($ext1) - 1];
/*----------------------------------------------------------------------------------------------------------------------
* [概要] 入力されたメールアドレスをメール関数用の宛先に変換
* [引数] 「メールアドレス」または「名前<メールアドレス>」、複数アドレス指定時はカンマ区切りで指定する。
* [戻値] 「メールアドレス」または「JIS_MIMEにコード変換した名前 <メールアドレス>」、複数アドレス指定時はカンマ区切りで返却する。
*----------------------------------------------------------------------------------------------------------------------*/
$addrs = explode(",", $str); //アドレスを配列に入れる
foreach ($addrs as $addr) {
if (preg_match("/^(.+)<(.+)>$/", $addr, $matches)) {
$mailaddrs[] = mb_encode_mimeheader(trim($matches[1])). " <". trim($matches[2]). ">";
$mailaddrs[] = trim($addr);
return implode(", ", $mailaddrs); //複数アドレスはカンマ区切りにする
Documentation generated on Fri, 24 Feb 2012 13:58:22 +0900 by Seasoft
|