/**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     $masterData = new SC_DB_MasterData_Ex();
     $this->arrMasterDataName = $this->getMasterDataNames(array());
     // システム固定
     if (is_array($_POST)) {
         GC_Utils_Ex::gfDebugLog($_POST);
         $temp = $_POST;
     } else {
         $temp = array();
     }
     $temp["master_data_name"] = "cp_mtb_android_os_version";
     switch ($this->getMode()) {
         case 'edit':
             // POST 文字列の妥当性チェック
             $this->masterDataName = $this->checkMasterDataName($temp, $this->arrMasterDataName);
             $this->errorMessage = $this->checkUniqueID($temp);
             if (empty($this->errorMessage)) {
                 // 取得したデータからマスターデータを生成
                 $this->registMasterData($temp, $masterData, $this->masterDataName);
                 $this->tpl_onload = "window.alert('マスターデータの設定が完了しました。');";
             }
             // FIXME break 入れ忘れと思われる。そうでないなら、要コメント。
         // FIXME break 入れ忘れと思われる。そうでないなら、要コメント。
         default:
         case 'show':
             // POST 文字列の妥当性チェック
             $this->masterDataName = $this->checkMasterDataName($temp, $this->arrMasterDataName);
             // DB からマスターデータを取得
             $this->arrMasterData = $masterData->getDbMasterData($this->masterDataName);
             break;
     }
 }
 /**
  * ブロックファイルに応じて tpl_mainpage を設定する
  *
  * @param string $bloc_file ブロックファイル名
  * @return void
  */
 function setTplMainpage($bloc_file)
 {
     if (SC_Utils_Ex::isAbsoluteRealPath($bloc_file)) {
         $this->tpl_mainpage = $bloc_file;
     } else {
         $this->tpl_mainpage = SC_Helper_PageLayout_Ex::getTemplatePath($this->objDisplay->detectDevice()) . BLOC_DIR . $bloc_file;
     }
     $this->setTemplate($this->tpl_mainpage);
     $debug_message = "block:" . $this->tpl_mainpage . "\n";
     GC_Utils_Ex::gfDebugLog($debug_message);
 }
 /**
  * enableかどうかを判別する
  * インスタンス化
  */
 function load(&$lcpage)
 {
     //データベースからクラス名を読み込む
     $objQuery = new SC_Query_Ex();
     $col = "*";
     $table = "dtb_plugin";
     $where = "enable = 1 AND del_flg = 0";
     // XXX 2.11.0 互換のため
     $arrCols = $objQuery->listTableFields($table);
     if (in_array('rank', $arrCols)) {
         $objQuery->setOrder('rank');
     }
     $arrRet = $objQuery->select($col, $table, $where);
     $class_name = get_class($lcpage);
     // 現在のページで使用するプラグインが存在するかどうかを検証する
     foreach ($arrRet as $plugins) {
         // プラグインを稼働させるクラス名のリストを取得する
         // プラグインのディレクトリ内の設定ファイルを参照する
         $plugin_name = $plugins['plugin_name'];
         $plugin_class_name = $plugins['class_name'];
         $plugin_path = DATA_REALDIR . "plugin/{$plugin_name}/{$plugin_class_name}.php";
         if (file_exists($plugin_path)) {
             require_once $plugin_path;
             if (class_exists($class_name)) {
                 $code_str = "\$is_enable = {$plugin_class_name}::isEnable(\$class_name);";
                 eval($code_str);
                 if ($is_enable) {
                     $arrPluginList[] = $plugin_class_name;
                     GC_Utils_Ex::gfDebugLog($class_name . ' で、プラグイン ' . $plugin_name . ' をロードしました');
                 } else {
                     GC_Utils_Ex::gfDebugLog($class_name . ' で、プラグイン ' . $plugin_name . ' は無効になっています');
                 }
             } else {
                 GC_Utils_Ex::gfDebugLog('プラグイン ' . $plugin_name . ' の ' . $class_name . ' が見つかりませんでした');
             }
         } else {
             GC_Utils_Ex::gfDebugLog('プラグイン ' . $plugin_name . " が読み込めませんでした。\n" . 'Failed opening required ' . $plugin_path);
         }
     }
     return $arrPluginList;
 }
Exemple #4
0
 /**
  * TXTメール送信を実行する.
  *
  * 設定された情報を利用して, メールを送信する.
  *
  * @return void
  */
 function sendMail($isHtml = false)
 {
     $header = $isHtml ? $this->getHTMLHeader() : $this->getTEXTHeader();
     $recip = $this->getRecip();
     // メール送信
     $result = $this->objMail->send($recip, $header, $this->body);
     if (PEAR::isError($result)) {
         // XXX Windows 環境では SJIS でメッセージを受け取るようなので変換する。
         $msg = mb_convert_encoding($result->getMessage(), CHAR_CODE, 'auto');
         $msg = 'メール送信に失敗しました。[' . $msg . ']';
         trigger_error($msg, E_USER_WARNING);
         GC_Utils_Ex::gfDebugLog($header);
         return false;
     }
     return true;
 }
 /**
  * 指定サイズで画像を出力する.
  *
  * @param string $FromImgPath ファイル名までのパス
  * @param string $ToImgPath 出力先パス
  * @param integer $tmpMW 最大横幅
  * @param integer $tmpMH 最大縦幅
  * @param integer $newFileName 新ファイル名
  * @param array 新ファイル名を格納した配列
  */
 function MakeThumb($FromImgPath, $ToImgPath, $tmpMW, $tmpMH, $newFileName = '')
 {
     // 画像の最大横幅(単位:ピクセル)
     $ThmMaxWidth = LARGE_IMAGE_WIDTH;
     // 画像の最大縦幅(単位:ピクセル)
     $ThmMaxHeight = LARGE_IMAGE_HEIGHT;
     //サムネイル画像の接頭文字
     $PreWord = $head;
     //拡張子取得
     $array_ext = explode('.', $FromImgPath);
     $ext = $array_ext[count($array_ext) - 1];
     $MW = $ThmMaxWidth;
     if ($tmpMW) {
         $MW = $tmpMW;
     }
     // $MWに最大横幅セット
     $MH = $ThmMaxHeight;
     if ($tmpMH) {
         $MH = $tmpMH;
     }
     // $MHに最大縦幅セット
     if (empty($FromImgPath) || empty($ToImgPath)) {
         return array(0, '出力元画像パス、または出力先フォルダが指定されていません。');
     }
     if (!file_exists($FromImgPath)) {
         return array(0, '出力元画像が見つかりません。');
     }
     $size = @GetImageSize($FromImgPath);
     $re_size = $size;
     // 画像の種類が不明 or swf
     if (!$size[2] || $size[2] > 3) {
         return array(0, '画像形式がサポートされていません。');
     }
     //アスペクト比固定処理
     $tmp_w = $size[0] / $MW;
     if ($MH != 0) {
         $tmp_h = $size[1] / $MH;
     }
     if ($tmp_w > 1 || $tmp_h > 1) {
         if ($MH == 0) {
             if ($tmp_w > 1) {
                 $re_size[0] = $MW;
                 $re_size[1] = $size[1] * $MW / $size[0];
             }
         } else {
             if ($tmp_w > $tmp_h) {
                 $re_size[0] = $MW;
                 $re_size[1] = $size[1] * $MW / $size[0];
             } else {
                 $re_size[1] = $MH;
                 $re_size[0] = $size[0] * $MH / $size[1];
             }
         }
     }
     // サムネイル画像ファイル名作成処理
     $tmp = array_pop(explode('/', $FromImgPath));
     // /の一番最後を切り出し
     $FromFileName = array_shift(explode('.', $tmp));
     // .で区切られた部分を切り出し
     $ToFile = $PreWord . $FromFileName;
     // 拡張子以外の部分までを作成
     $ImgNew = imagecreatetruecolor($re_size[0], $re_size[1]);
     switch ($size[2]) {
         case '1':
             //gif形式
             if ($tmp_w <= 1 && $tmp_h <= 1) {
                 if ($newFileName) {
                     $ToFile = $newFileName;
                 } elseif ($ext) {
                     $ToFile .= '.' . $ext;
                 } else {
                     $ToFile .= '.gif';
                 }
                 if (!@copy($FromImgPath, $ToImgPath . $ToFile)) {
                     // エラー処理
                     return array(0, 'ファイルのコピーに失敗しました。');
                 }
                 ImageDestroy($ImgNew);
                 return array(1, $ToFile);
             }
             ImageColorAllocate($ImgNew, 255, 235, 214);
             //背景色
             $black = ImageColorAllocate($ImgNew, 0, 0, 0);
             $red = ImageColorAllocate($ImgNew, 255, 0, 0);
             Imagestring($ImgNew, 4, 5, 5, "GIF {$size['0']}x{$size['1']}", $red);
             ImageRectangle($ImgNew, 0, 0, $re_size[0] - 1, $re_size[1] - 1, $black);
             if ($newFileName) {
                 $ToFile = $newFileName;
             } elseif ($ext) {
                 $ToFile .= '.' . $ext;
             } else {
                 $ToFile .= '.png';
             }
             $TmpPath = $ToImgPath . $ToFile;
             @Imagepng($ImgNew, $TmpPath);
             // 画像が作成されていない場合
             if (!@file_exists($TmpPath)) {
                 return array(0, '画像の出力に失敗しました。');
             }
             ImageDestroy($ImgNew);
             return array(1, $ToFile);
         case '2':
             //jpg形式
             $ImgDefault = ImageCreateFromJpeg($FromImgPath);
             //ImageCopyResized($ImgNew,$ImgDefault, 0, 0, 0, 0,$re_size[0], $re_size[1],$size[0], $size[1]);
             if ($re_size[0] != $size[0] || $re_size[0] != $size[0]) {
                 ImageCopyResampled($ImgNew, $ImgDefault, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]);
             }
             GC_Utils_Ex::gfDebugLog($size);
             GC_Utils_Ex::gfDebugLog($re_size);
             if ($newFileName) {
                 $ToFile = $newFileName;
             } elseif ($ext) {
                 $ToFile .= '.' . $ext;
             } else {
                 $ToFile .= '.jpg';
             }
             $TmpPath = $ToImgPath . $ToFile;
             @ImageJpeg($ImgNew, $TmpPath);
             // 画像が作成されていない場合
             if (!@file_exists($TmpPath)) {
                 return array(0, "画像の出力に失敗しました。<br>{$ImgNew}<br>{$TmpPath}");
             }
             $RetVal = $ToFile;
             break;
         case '3':
             //png形式
             $ImgDefault = ImageCreateFromPNG($FromImgPath);
             //ImageCopyResized($ImgNew, $ImgDefault, 0, 0, 0, 0,$re_size[0], $re_size[1],$size[0], $size[1]);
             ImageCopyResampled($ImgNew, $ImgDefault, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]);
             if ($newFileName) {
                 $ToFile = $newFileName;
             } elseif ($ext) {
                 $ToFile .= '.' . $ext;
             } else {
                 $ToFile .= '.png';
             }
             $TmpPath = $ToImgPath . $ToFile;
             @ImagePNG($ImgNew, $TmpPath);
             // 画像が作成されていない場合
             if (!@file_exists($TmpPath)) {
                 return array(0, '画像の出力に失敗しました。');
             }
             $RetVal = $ToFile;
             break;
     }
     ImageDestroy($ImgDefault);
     ImageDestroy($ImgNew);
     return array(1, $RetVal);
 }
 function doCheckBuyAndDownload($config)
 {
     $objFormParam = new SC_FormParam();
     $this->lfInitParam($objFormParam);
     $objFormParam->setParam($_REQUEST);
     $objCustomer = new SC_Customer_Ex();
     $objQuery = SC_Query::getSingletonInstance();
     $detect = new Mobile_Detect();
     $version = $detect->version("iOS", Mobile_Detect::VERSION_TYPE_FLOAT);
     $contentid = $this->arrProduct["product_code_min"];
     $curl = $this->curl_init(KISEKAE_TOUCH_IPHONE_API01);
     $post = $this->getPost($config, array("contentid" => $contentid, "device" => $objFormParam->getValue("device_name", "iPhone6"), "version" => floor($version), "apiversion" => null, "operator" => "au", "lang" => "ja"));
     $this->getDs($post, $config);
     curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));
     GC_Utils_Ex::gfPrintLog(print_r($post, TRUE), DEBUG_LOG_REALFILE);
     $result = curl_exec($curl);
     $status = SC_XML::xpath($result, "//status/@value");
     $vid = SC_XML::xpath($result, "//validation/@id");
     switch ($status) {
         default:
             SC_Utils_Ex::sfDispSiteError(PAGE_ERROR);
         case "000":
             GC_Utils_Ex::gfDebugLog($result);
             $_COOKIE["product_ktc_vid"] = $vid;
             break;
     }
     // API2
     $openid = $objCustomer->getValue("au_open_id");
     $curl = $this->curl_init(KISEKAE_TOUCH_IPHONE_API02);
     $post = $this->getPost($config, array("contentid" => $contentid, "userid" => $openid, "vid" => $vid));
     $this->getDs($post, $config);
     curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));
     GC_Utils_Ex::gfPrintLog(print_r($post, TRUE), DEBUG_LOG_REALFILE);
     $result = curl_exec($curl);
     $status = SC_XML::xpath($result, "//status/@value");
     switch ($status) {
         default:
             SC_Utils_Ex::sfDispSiteError(PAGE_ERROR);
             break;
         case "000":
         case "010":
             // TEST
             // /ios/products/detail.php?mode=check_buy_and_download&product_id=13&classcategory_id1=0&classcategory_id2=0&quantity=1&admin=&favorite_product_id=&product_class_id=&device_name=iPhone6Plus&device_height=736&device_width=414&device_rate=3&device_lang=ja&ignore_redownload=1
             if ($_GET["ignore_redownload"] == "1") {
                 $status = "000";
             }
             break;
     }
     if ($status == "000") {
         // FIXME 課金処理
         // API03
         $curl = $this->curl_init(KISEKAE_TOUCH_IPHONE_API03);
         if ($objCustomer->getValue("buy_to_nopoint") == "1") {
             $price = $this->arrProduct["price02_min"];
             $settlementtype = "998";
             $redownloaddate = date("Ymd");
         } else {
             $price = $this->arrProduct["price02_min"];
             $settlementtype = "001";
             $redownloaddate = date("Ymd", strtotime($this->downloadable_days2));
         }
         $post = $this->getPost($config, array("contentid" => $contentid, "price" => $price, "redownloaddate" => $redownloaddate, "userid" => $openid, "vid" => $vid, "settlementtype" => $settlementtype));
         $this->getDs($post, $config);
         curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));
         GC_Utils_Ex::gfPrintLog(print_r($post, TRUE), DEBUG_LOG_REALFILE);
         $result = curl_exec($curl);
         $authentication_id = SC_XML::xpath($result, "//authentication/@id");
         $objFormParam = new SC_FormParam();
         $this->setOrderParam($objFormParam, $vid, $authentication_id);
         $objFormParam->convParam();
         $message = '';
         $arrValBef = array();
         $objPurchase = new SC_Helper_Purchase_Ex();
         $objPurchase->saveShippingTemp(array());
         $order_id = $this->doRegister("", $objPurchase, $objFormParam, $message, $arrValBef);
         $customer_id = $objCustomer->getValue("customer_id");
         $this->addPointHistory($order_id, $customer_id, $objFormParam, $objQuery);
     } else {
         $authentication_id = SC_XML::xpath($result, "//authentication/@id");
     }
     $netUrl = new Net_URL(KISEKAE_TOUCH_IPHONE_CST02);
     $netUrl->addQueryString("aid", $authentication_id);
     $netUrl->addQueryString("cpid", $config["cpid"]);
     $netUrl->addQueryString("siteid", $config["siteid"]);
     $netUrl->addQueryString("contentid", $contentid);
     $netUrl->addQueryString("ts", date("YmdHis"));
     $post2 = $netUrl->querystring;
     $this->getDs($post2, $config);
     $netUrl->addRawQueryString(http_build_query($post2));
     GC_Utils_Ex::gfPrintLog(print_r($post2, TRUE), DEBUG_LOG_REALFILE);
     header("Location: " . $netUrl->getURL());
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     $objQuery = SC_Query_Ex::getSingletonInstance();
     parent::action();
     switch ($this->getMode()) {
         case "operate_cancel_cont_bill":
             $objFormParam = new SC_FormParam_Ex();
             $objFormSearchParam = new SC_FormParam_Ex();
             // パラメーター処理
             $this->lfInitParam($objFormParam);
             $objFormParam->setParam($_POST);
             $objFormParam->convParam();
             // 入力パラメーターチェック
             $this->arrErr = $this->lfCheckError($objFormParam);
             $this->arrForm = $objFormParam->getHashArray();
             // 検索引き継ぎ用パラメーター処理
             $this->lfInitSearchParam($objFormSearchParam);
             $objFormSearchParam->setParam($objFormParam->getValue('search_data'));
             $this->arrSearchErr = $this->lfCheckErrorSearchParam($objFormSearchParam);
             $this->arrSearchData = $objFormSearchParam->getSearchArray();
             break;
     }
     GC_Utils_Ex::gfDebugLog($this->arrErr);
     $objDb = new SC_Helper_DB_Ex();
     $this->customer_id = $this->arrForm['customer_id'];
     $this->customer = SC_Helper_Customer_Ex::sfGetCustomerData($this->customer_id);
     // モードによる処理切り替え
     switch ($this->getMode()) {
         case 'confirm':
             // 購入履歴情報の取得 (ポイント付与でエラーチェックに通らない時用)
             list($this->tpl_linemax, $this->arrPurchaseHistory, $this->objNavi) = $this->lfPurchaseHistory($this->customer_id);
             break;
         case "operate_cancel_cont_bill":
             list($this->tpl_linemax, $this->arrPurchaseHistory, $this->objNavi) = $this->lfPurchaseHistory($this->customer_id);
             $curl = $this->curl_init(true, false);
             $transactionId = $_REQUEST["au_payment_transaction_id"];
             $config = SC_AuonePayment_Ex::getConfig();
             if (strlen($transactionId) == 32) {
                 $post = $this->getPost("OperateCancelContBill", $config, compact("transactionId"));
                 curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));
                 $result = $this->curl_result($curl);
                 $result["post_history"] = $post;
                 $this->arrErr["au_payment_transaction_id"] = $this->check_result($result, array());
                 $this->arrErr = array_filter($this->arrErr);
                 if (!isset($this->arrErr["au_payment_transaction_id"])) {
                     $curl = $this->curl_init(true);
                     // FIXME 状態確認
                     $post = $this->getPost("ConditionInquiryForPayTranStat", $config, compact("transactionId"));
                     curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));
                     $result = $this->curl_result($curl);
                     $arrWhereVal = array("del_flg" => 1, "transaction_status" => $result["body"]["transactionStatus"], "pay_status" => $result["body"]["payStatus"]);
                     $arrWhereVal = array_filter($arrWhereVal, "strlen");
                     $objQuery->update("cp_dtb_customer_transaction", $arrWhereVal, "transaction_id = ? AND del_flg = 0", array($transactionId));
                 }
             } else {
                 $this->arrErr["au_payment_transaction_id"] = "不正な処理";
             }
             break;
     }
     if ($objDb->sfColumnExists("cp_dtb_customer_transaction", "id")) {
         $objQuery->setOrder("id DESC");
         $this->customer["transaction"] = $objQuery->select("*", "cp_dtb_customer_transaction", "\n                    customer_id = ?\n                AND continue_account_id IS NOT NULL\n                AND transaction_status = '40'\n            ", array($this->customer_id));
         $this->customer["transaction2"] = $objQuery->select("*", "cp_dtb_customer_transaction", "\n                    customer_id = ?\n                AND continue_account_id IS NULL\n                AND transaction_status = '40'\n            ", array($this->customer_id));
         $objQuery->setOrder("");
         if (count($this->customer["transaction"]) == 0 && $this->customer["status"] == "2") {
             SC_Helper_Customer_Ex::sfEditCustomerData(array("status" => 1), $this->customer_id);
             $this->arrForm["status"]["value"] = 1;
         }
     }
     foreach ($this->arrErr as $msg) {
         $this->tpl_onload .= ";console.log('{$msg}');";
     }
 }
 /**
  * TXTメール送信を実行する.
  *
  * 設定された情報を利用して, メールを送信する.
  *
  * @return void
  */
 function sendMail($isHtml = false)
 {
     $header = $isHtml ? $this->getHTMLHeader() : $this->getTEXTHeader();
     $recip = $this->getRecip();
     // メール送信
     $result = $this->objMail->send($recip, $header, $this->body);
     if (PEAR::isError($result)) {
         // XXX Windows 環境では SJIS でメッセージを受け取るようなので変換する。
         $tokens = array('T_ARG1' => mb_convert_encoding($result->getMessage(), CHAR_CODE, 'auto'));
         $msg = t('c_E-mail sending failed.[T_ARG1]_01', $tokens);
         trigger_error($msg, E_USER_WARNING);
         GC_Utils_Ex::gfDebugLog($header);
         return false;
     }
     return true;
 }
 /**
  * お届け先チェックの値に応じて, お届け先情報を保存する.
  *
  * 会員住所がチェックされている場合は, 会員情報からお届け先を取得する.
  * その他のお届け先がチェックされている場合は, その他のお届け先からお届け先を取得する.
  * お届け先チェックの値が不正な場合は false を返す.
  *
  * @param integer $other_deliv_id
  * @param string $uniqid 受注一時テーブルのユニークID
  * @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス
  * @param SC_Customer $objCustomer SC_Customer インスタンス
  * @return boolean お届け先チェックの値が妥当な場合 true
  */
 function registerDeliv($other_deliv_id, $uniqid, &$objPurchase, &$objCustomer)
 {
     GC_Utils_Ex::gfDebugLog('register deliv. deliv_check=' . $deliv_check);
     $arrValues = array();
     // 会員登録住所がチェックされている場合
     if ($other_deliv_id == 0) {
         $objPurchase->copyFromCustomer($arrValues, $objCustomer, 'shipping');
     } else {
         $objQuery =& SC_Query_Ex::getSingletonInstance();
         $arrOtherDeliv = $objQuery->getRow('*', 'dtb_other_deliv', 'customer_id = ? AND other_deliv_id = ?', array($objCustomer->getValue('customer_id'), $other_deliv_id));
         if (empty($arrOtherDeliv)) {
             return false;
         }
         $objPurchase->copyFromOrder($arrValues, $arrOtherDeliv, 'shipping', '');
     }
     $objPurchase->saveShippingTemp($arrValues, $other_deliv_id);
     $objPurchase->saveOrderTemp($uniqid, $arrValues, $objCustomer);
     return true;
 }
 /**
  *
  * @param string $src
  * @param string $des
  */
 public static function sfCopyDir($src, $des, $mess = '', $override = false)
 {
     $src_dir = new SplFileInfo($src);
     if ($src_dir->isDir() === false) {
         trigger_error('src is not dir', E_USER_WARNING);
         return;
     }
     $des_dir = new SplFileInfo($des);
     if ($des_dir->isDir() === false && $des_dir->isFile()) {
         trigger_error('des is not dir', E_USER_WARNING);
         return;
     }
     SC_Utils_Ex::recursiveMkdir($des_dir->getPathname());
     $src = $src_dir->getRealPath();
     $des = $des_dir->getRealPath();
     /**
      *
      * @var SplFileInfo[]
      */
     $iterator = new RecursiveDirectoryIterator($src);
     $files = new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::SELF_FIRST);
     foreach ($files as $filepath) {
         $finfo = new SplFileInfo($filepath);
         if ($finfo->isDir()) {
             continue;
         }
         $rel_file = substr($finfo->getRealPath(), strlen($src_dir->getRealPath()));
         $src_file = $finfo->getRealPath();
         $des_file = new SplFileInfo($des_dir->getRealPath() . $rel_file);
         $des_file = $des_file->getPathname();
         SC_Utils_Ex::recursiveMkdir(dirname($des_file));
         if ($override) {
             // nop
         } elseif (file_exists($des_file)) {
             trigger_error($des_file . ":ファイルが存在します", E_USER_NOTICE);
             $mess .= $des . $des_file . ":ファイルが存在します\n";
             continue;
         }
         if (@copy($src_file, $des_file)) {
             $mess .= $des_file . ":コピー成功\n";
             trigger_error($des_file . ":コピー成功", E_USER_NOTICE);
         } else {
             trigger_error($des_file . ":コピー失敗", E_USER_WARNING);
             $mess .= $des_file . ":コピー失敗\n";
         }
         GC_Utils_Ex::gfDebugLog(compact("src_file", "des_file"));
     }
     return $mess;
 }
Exemple #11
0
 function sendHtmlMail()
 {
     $header = $this->getHTMLHeader();
     // メール送信
     $result = $this->objMail->send($this->getRecip(), $header, $this->body);
     if (PEAR::isError($result)) {
         GC_Utils_Ex::gfPrintLog($result->getMessage());
         GC_Utils_Ex::gfDebugLog($header);
         return false;
     }
     return true;
 }
 function doCheckBuyAndDownload($config)
 {
     $mode = $this->getMode();
     unset($_COOKIE["product_ktc_vid"]);
     $makeUrl = P_DETAIL_URLPATH . $_REQUEST["product_id"];
     $netOkUrl = new Net_URL($makeUrl);
     $netOkUrl->addQueryString("mode", "{$mode}_ok");
     if ("on" == @$_GET["admin"]) {
         $netOkUrl->addQueryString("admin", "on");
     }
     $netNgUrl = new Net_URL($makeUrl);
     $netNgUrl->addQueryString("mode", "{$mode}_ng");
     $curl = $this->curl_init(KISEKAE_TOUCH_API01);
     $post = $this->getPost($config, array("contentid" => $this->arrProduct["product_code_min"], "okurl" => $netOkUrl->getURL(), "ngurl" => $netNgUrl->getURL()));
     $this->getDs($post, $config);
     curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));
     GC_Utils_Ex::gfPrintLog(print_r($post, TRUE), DEBUG_LOG_REALFILE);
     $result = curl_exec($curl);
     $status = SC_XML::xpath($result, "//status/@value");
     $vid = SC_XML::xpath($result, "//validation/@id");
     switch ($status) {
         default:
             SC_Utils_Ex::sfDispSiteError(PAGE_ERROR);
         case "000":
             GC_Utils_Ex::gfDebugLog($result);
             $_COOKIE["product_ktc_vid"] = $vid;
             break;
     }
     $post2 = array("vid" => $vid, "cpid" => $post["cpid"], "siteid" => $post["siteid"], "contentid" => $post["contentid"], "operator" => "androidmarket", "operator" => "au", "lang" => "ja", "ts" => $post["ts"]);
     $netUrl = new Net_URL(KISEKAE_TOUCH_CST01);
     // $post2 = $netUrl->querystring;
     $this->getDs($post2, $config);
     $netUrl->addRawQueryString(http_build_query($post2));
     header("Location: " . $netUrl->getURL());
 }
 /**
  * お届け先チェックの値に応じて, お届け先情報を保存する.
  *
  * 会員住所がチェックされている場合は, 会員情報からお届け先を取得する.
  * その他のお届け先がチェックされている場合は, その他のお届け先からお届け先を取得する.
  * お届け先チェックの値が不正な場合は false を返す.
  *
  * @param integer $other_deliv_id
  * @param string $uniqid 受注一時テーブルのユニークID
  * @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス
  * @param SC_Customer $objCustomer SC_Customer インスタンス
  * @return boolean お届け先チェックの値が妥当な場合 true
  */
 function registerDeliv($other_deliv_id, $uniqid, &$objPurchase, &$objCustomer, $objAddress)
 {
     GC_Utils_Ex::gfDebugLog('register deliv. deliv_check=' . $deliv_check);
     $arrValues = array();
     // 会員登録住所がチェックされている場合
     if ($other_deliv_id == 0) {
         $objPurchase->copyFromCustomer($arrValues, $objCustomer, 'shipping');
     } else {
         $arrOtherDeliv = $objAddress->getAddress($other_deliv_id);
         if (!$arrOtherDeliv) {
             return false;
         }
         $objPurchase->copyFromOrder($arrValues, $arrOtherDeliv, 'shipping', '');
     }
     $objPurchase->saveShippingTemp($arrValues, $other_deliv_id);
     $objPurchase->saveOrderTemp($uniqid, $arrValues, $objCustomer);
     return true;
 }
 /**
  * 折れ線グラフの作成
  *
  * @param string $keyname
  * @param string $type
  * @param string $xtitle
  * @param string $ytitle
  * @param boolean $xincline
  */
 public function lfGetGraphLine($arrResults, $keyname, $type, $xtitle, $ytitle, $sdate, $edate, $xincline)
 {
     $ret_path = '';
     // 結果が0行以上ある場合のみグラフを生成する。
     if (count($arrResults) > 0 && $this->install_GD) {
         // グラフの生成
         $arrList1 = SC_Utils_Ex::sfArrKeyValue($arrResults, $keyname, 'add_point');
         $arrList2 = SC_Utils_Ex::sfArrKeyValue($arrResults, $keyname, 'minus_point');
         $arrList3 = SC_Utils_Ex::sfArrKeyValue($arrResults, $keyname, 'total_sum');
         array_walk($arrList1, function ($v, $k) use(&$arrList1) {
             $arrList1[$k] = max($v, 0);
         });
         array_walk($arrList2, function ($v, $k) use(&$arrList2) {
             $arrList2[$k] = max($v, 0);
         });
         array_walk($arrList3, function ($v, $k) use(&$arrList3) {
             $arrList3[$k] = max($v, 0);
         });
         GC_Utils_Ex::gfDebugLog(array($arrList1, $arrList2, $arrList3));
         // 一時ファイル名の取得
         $pngname = $this->lfGetGraphPng($type);
         // ラベル表示インターバルを求める
         $base = 30;
         $interval = intval(count($arrList1) / $base);
         if ($interval < 1) {
             $interval = 1;
         }
         // X ラベルが 20以下になるまでインターバルを変更する
         while (count($arrList1) / $interval > 30) {
             $base++;
             $interval = intval(count($arrList1) / $base);
         }
         $objGraphLine = new SC_Graph_Line_Ex();
         $objGraphLine->init();
         // 値のセット
         $objGraphLine->setXLabel(array_keys($arrList1));
         // 複数レジェンドの場合は共通メソッドが使えない
         $objGraphLine->arrDataList[$objGraphLine->line_max++] = array_values($arrList1);
         $objGraphLine->arrDataList[$objGraphLine->line_max++] = array_values($arrList2);
         $objGraphLine->arrDataList[$objGraphLine->line_max++] = array_values($arrList3);
         $allData = array();
         foreach ($objGraphLine->arrDataList as $arrDataList) {
             $allData = array_merge($allData, $arrDataList);
         }
         GC_Utils_Ex::gfDebugLog($allData);
         // $objGraphLine->setMax ( $allData );
         $this->setMax($objGraphLine, $allData);
         // 値の描画変換率
         $rate = $objGraphLine->area_height / $objGraphLine->graph_max;
         // 描画率を計算
         $objGraphLine->arrPointList = array();
         foreach ($objGraphLine->arrDataList as $index => &$arrDataList) {
             GC_Utils_Ex::gfDebugLog($arrDataList);
             $count = count($arrDataList);
             $scale_width = $objGraphLine->area_width / ($count + 1);
             $objGraphLine->arrPointList[$index] = array();
             for ($i = 0; $i < $count; $i++) {
                 // X座標を求める
                 $x = intval($objGraphLine->left + $scale_width * ($i + 1));
                 // Y座標を求める
                 if ($arrDataList[$i] > 0) {
                     $y = intval($objGraphLine->top + $objGraphLine->area_height - $arrDataList[$i] * $rate);
                 } else {
                     // マイナス値の場合は底べた
                     $y = intval($objGraphLine->top + $objGraphLine->area_height);
                 }
                 // XY座標を保存する
                 $objGraphLine->arrPointList[$index][] = array($x, $y);
             }
         }
         GC_Utils_Ex::gfDebugLog($objGraphLine->arrPointList);
         $objGraphLine->setLegend(array("追加", "消費", "残高"));
         // ラベル回転(日本語不可)
         if ($xincline == true || count($arrList1) > 20) {
             $objGraphLine->setXLabelAngle(45);
         }
         // タイトルセット
         $objGraphLine->setXTitle($xtitle);
         $objGraphLine->setYTitle($ytitle);
         // メインタイトル作成
         list($sy, $sm, $sd) = preg_split('|[/ ]|', $sdate);
         list($ey, $em, $ed) = preg_split('|[/ ]|', $edate);
         $start_date = $sy . '年' . $sm . '月' . $sd . '日';
         $end_date = $ey . '年' . $em . '月' . $ed . '日';
         $objGraphLine->drawTitle('集計期間:' . $start_date . ' - ' . $end_date);
         // グラフ描画
         // $objGraphLine->drawGraph ();
         $this->drawGraph($objGraphLine);
         // グラフの出力
         if (DRAW_IMAGE) {
             $objGraphLine->outputGraph();
             SC_Response_Ex::actionExit();
         }
         // ファイルパスを返す
         $ret_path = GRAPH_URLPATH . $pngname;
     }
     return $ret_path;
 }