public static function sfInitInstall() { if (!defined('ECCUBE_INSTALL') && !GC_Utils_Ex::isInstallFunction()) { $install_url = SC_Utils_Ex::getInstallerPath(); header('Location: ' . $install_url); exit; } $path = HTML_REALDIR . 'install/' . DIR_INDEX_FILE; if (file_exists($path)) { SC_Utils_Ex::sfErrorHeader('>> /install/' . DIR_INDEX_FILE . ' は、インストール完了後にファイルを削除してください。'); } }
/** * フックポイント. * * @param LC_Page $objPage */ function preProcess(LC_Page $objPage) { if (!extension_loaded("dom")) { SC_Utils_Ex::sfErrorHeader("dom extension が有効でないため キャリアIDによるログインができません。"); } if (GC_Utils_Ex::isFrontFunction()) { $xrds = new Net_URL(ROOT_URLPATH . 'au/xrds.php'); $xrds = $xrds->getURL(); header("X-XRDS-Location: {$xrds}"); header("X-Content-TYpe-Options: nosniff"); } }
function sfInitInstall() { // インストール済みが定義されていない。 if (!defined('ECCUBE_INSTALL')) { $phpself = $_SERVER['SCRIPT_NAME']; if (strpos('/install/', $phpself) === false) { $path = substr($phpself, 0, strpos($phpself, basename($phpself))); $install_url = SC_Utils_Ex::searchInstallerPath($path); header('Location: ' . $install_url); exit; } } $path = HTML_REALDIR . 'install/' . DIR_INDEX_FILE; if (file_exists($path)) { SC_Utils_Ex::sfErrorHeader('>> /install/' . DIR_INDEX_FILE . ' は、インストール完了後にファイルを削除してください。'); } }
function sfInitInstall() { // インストール済みが定義されていない。 if (!defined('ECCUBE_INSTALL')) { $phpself = $_SERVER['SCRIPT_NAME']; if (strpos('/install/', $phpself) === false) { $path = substr($phpself, 0, strpos($phpself, basename($phpself))); $install_url = SC_Utils_Ex::searchInstallerPath($path); header('Location: ' . $install_url); exit; } } $path = HTML_REALDIR . 'install/' . DIR_INDEX_FILE; if (file_exists($path)) { SC_Utils_Ex::sfErrorHeader(t('c_>> /install/T_ARG1, delete this file after completing installation._01', array('T_ARG1' => DIR_INDEX_FILE))); } }
/** * リリース情報を取得する. * * @return array 取得した情報配列 */ function lfGetInfo() { // 更新情報の取得ON/OFF確認 if (!ECCUBE_INFO) { return array(); } // パラメーター「UPDATE_HTTP」が空文字の場合、処理しない。 // XXX これと別に on/off を持たせるべきか。 if (strlen(UPDATE_HTTP) == 0) { return array(); } $query = ''; // サイト情報の送信可否設定 // XXX インストール時に問い合わせて送信可否設定を行うように設定すべきか。 // XXX (URLは強制送信すべきではないと思うが)バージョンは強制送信すべきか。 if (UPDATE_SEND_SITE_INFO === true) { $query = '?site_url=' . HTTP_URL . '&eccube_version=' . ECCUBE_VERSION; } $url = UPDATE_HTTP . $query; // タイムアウト時間設定 $context = array('http' => array('timeout' => HTTP_REQUEST_TIMEOUT)); $jsonStr = @file_get_contents($url, false, stream_context_create($context)); $arrTmpData = is_string($jsonStr) ? SC_Utils_Ex::jsonDecode($jsonStr) : null; if (empty($arrTmpData)) { SC_Utils_Ex::sfErrorHeader(t('c_>> Update information was not obtained._01')); return array(); } $arrInfo = array(); foreach ($arrTmpData as $objData) { $arrInfo[] = get_object_vars($objData); } return $arrInfo; }
function getAll($n, $arr = "") { // mysqlの場合にはビュー表を変換する if (DB_TYPE == "mysql") { $n = $this->dbFactory->sfChangeMySQL($n); } if (PEAR::isError($this->conn)) { if (ADMIN_MODE) { SC_Utils_Ex::sfErrorHeader("DBへの接続に失敗しました。:" . $this->dsn); } else { SC_Utils_Ex::sfErrorHeader("DBへの接続に失敗しました。:"); } return 0; } if ($arr) { $result = $this->conn->getAll($n, $arr, DB_FETCHMODE_ASSOC); } else { $result = $this->conn->getAll($n, DB_FETCHMODE_ASSOC); } if ($this->conn->isError($result)) { $this->send_err_mail($result, $n); } $this->result = $result; return $this->result; }
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ require_once "../require.php"; $INSTALL_DIR = realpath(dirname(__FILE__)); require_once "../" . HTML2DATA_DIR . "module/Request.php"; define("INSTALL_LOG", "./temp/install.log"); define("INSTALL_INFO_URL", "http://www.ec-cube.net/install_info/index.php"); ini_set("max_execution_time", 300); $objPage = new StdClass(); $objPage->arrDB_TYPE = array('pgsql' => 'PostgreSQL', 'mysql' => 'MySQL'); $objPage->arrDB_PORT = array('pgsql' => '', 'mysql' => ''); $objDb = new SC_Helper_DB_Ex(); // テンプレートコンパイルディレクトリの書込み権限チェック $temp_dir = $INSTALL_DIR . '/temp'; if (!is_writable($temp_dir)) { SC_Utils_Ex::sfErrorHeader($temp_dir . "にユーザ書込み権限(777, 707等)を付与して下さい。", true); exit; } $objView = new SC_InstallView($INSTALL_DIR . '/templates', $INSTALL_DIR . '/temp'); // パラメータ管理クラス $objWebParam = new SC_FormParam(); $objDBParam = new SC_FormParam(); // パラメータ情報の初期化 $objWebParam = lfInitWebParam($objWebParam); $objDBParam = lfInitDBParam($objDBParam); //フォーム配列の取得 $objWebParam->setParam($_POST); $objDBParam->setParam($_POST); switch ($_POST['mode']) { // ようこそ case 'welcome':
/** * Page のプロセス. * * @return void */ function process() { $objQuery = new SC_Query(); $objSess = new SC_Session(); // 認証可否の判定 SC_Utils_Ex::sfIsSuccess($objSess); $fp = fopen(ZIP_CSV_FILE_PATH, "r"); $img_path = USER_URL . "packages/" . TEMPLATE_NAME . "/img/"; // 一部のIEは256バイト以上受け取ってから表示を開始する。 for ($i = 0; $i < 256; $i++) { print " "; } print "\n"; $this->myFlush(); if (!$fp) { SC_Utils_Ex::sfErrorHeader(">> " . ZIP_CSV_FILE_PATH . "の取得に失敗しました。"); } else { print "<img src='" . $img_path . "install/main_w.jpg'><br>"; $this->myFlush(); // CSVの件数を数える $line = 0; while (!feof($fp)) { fgets($fp, ZIP_CSV_LINE_MAX); $line++; } print "<img src='" . $img_path . "install/space_w.gif'>"; $this->myFlush(); // ファイルポインタを戻す fseek($fp, 0); // 画像を一個表示する件数を求める。 $disp_line = intval($line / IMAGE_MAX); // 既に書き込まれたデータを数える $end_cnt = $objQuery->count("mtb_zip"); $cnt = 1; $img_cnt = 0; while (!feof($fp)) { $arrCSV = fgetcsv($fp, ZIP_CSV_LINE_MAX); // すでに書き込まれたデータを飛ばす。 if ($cnt > $end_cnt) { $sqlval['code'] = $arrCSV[0]; $sqlval['old_zipcode'] = $arrCSV[1]; $sqlval['zipcode'] = $arrCSV[2]; $sqlval['state_kana'] = $arrCSV[3]; $sqlval['city_kana'] = $arrCSV[4]; $sqlval['town_kana'] = $arrCSV[5]; $sqlval['state'] = $arrCSV[6]; $sqlval['city'] = $arrCSV[7]; $sqlval['town'] = $arrCSV[8]; $sqlval['flg1'] = $arrCSV[9]; $sqlval['flg2'] = $arrCSV[10]; $sqlval['flg3'] = $arrCSV[11]; $sqlval['flg4'] = $arrCSV[12]; $sqlval['flg5'] = $arrCSV[13]; $sqlval['flg6'] = $arrCSV[14]; $objQuery->insert("mtb_zip", $sqlval); } $cnt++; // $disp_line件ごとに進捗表示する if ($cnt % $disp_line == 0 && $img_cnt < IMAGE_MAX) { print "<img src='" . $img_path . "install/graph_1_w.gif'>"; $this->myFlush(); $img_cnt++; } } fclose($fp); print "<img src='" . $img_path . "install/space_w.gif'><br>\n"; print "<table width='700' height='50' border='0' cellpadding='0' cellspacing='0' bgcolor='#494E5F'>\n"; print "<tr>\n"; print "<td align='center'><a href='javascript:window.close()'><img src='" . $img_path . "install/close.gif' alt='CLOSE' width='85' height='22' border='0' /></a></td>\n"; print "</tr>\n"; print "</table>\n"; } }
/** * CSVファイルからインサート実行. * * @param object $objQuery * @param string $csv * @param string $mode * @return void */ function lfExeInsertSQL(&$objQuery, $csv, $mode) { $tbl_flg = false; $col_flg = false; $ret = true; $pagelayout_flg = false; $table_name = ""; $arrVal = array(); $arrCol = array(); // csvファイルからデータの取得 $fp = fopen($csv, 'r'); if ($fp === false) { SC_Utils_Ex::sfDispException($csv . ' のファイルオープンに失敗しました。'); } while (!feof($fp)) { $data = fgetcsv($fp, 1000000); //空白行のときはテーブル変更 if (count($data) <= 1 and $data[0] == "") { $tbl_flg = false; $col_flg = false; $table_name = ""; $arrVal = array(); $arrCol = array(); continue; } // テーブルフラグがたっていない場合にはテーブル名セット if (!$tbl_flg) { $table_name = $data[0]; $tbl_flg = true; if ($table_name == "dtb_pagelayout") { $pagelayout_flg = true; } continue; } // カラムフラグがたっていない場合にはカラムセット if (!$col_flg) { if ($mode != "restore_config") { for ($i = 0; $i < count($data); $i++) { $arrCol[$i] = $data[$i]; } } $col_flg = true; continue; } for ($i = 0; $i < count($data); $i++) { if ($arrCol[$i] != '') { $arrVal[$arrCol[$i]] = $data[$i]; } } $err = $objQuery->insert($table_name, $arrVal); // エラーがあれば終了 if (PEAR::isError($err)) { SC_Utils_Ex::sfErrorHeader(">> " . $objQuery->getlastquery(false)); return false; } if ($pagelayout_flg) { // dtb_pagelayoutの場合には最初のデータはpage_id = 0にする $arrVal['page_id'] = '0'; $objQuery->update("dtb_pagelayout", $arrVal); $pagelayout_flg = false; } // タイムアウトを防ぐ SC_Utils_Ex::sfFlush(); } fclose($fp); return $ret; }
/** * Page のプロセス. * * @return void */ function process() { //---- ページ初期設定 $conn = new SC_DBConn(); $objView = new SC_AdminView(); $objDate = new SC_Date(); $objQuery = new SC_Query(); $objDb = new SC_Helper_DB_Ex(); $this->objDate = $objDate; $this->arrTemplate = $this->getTemplateList($conn); $objSess = new SC_Session(); // 認証可否の判定 SC_Utils_Ex::sfIsSuccess($objSess); /* query:配信履歴「確認」 */ if ($_GET["mode"] == "query" && SC_Utils_Ex::sfCheckNumLength($_GET["send_id"])) { // 送信履歴より、送信条件確認画面 $sql = "SELECT search_data FROM dtb_send_history WHERE send_id = ?"; $result = $conn->getOne($sql, array($_GET["send_id"])); $tpl_path = "mail/query.tpl"; $list_data = unserialize($result); // 都道府県を変換 $list_data['pref_disp'] = $this->arrPref[$list_data['pref']]; // 配信形式 $list_data['htmlmail_disp'] = $this->arrHtmlmail[$list_data['htmlmail']]; // 性別の変換 if (count($list_data['sex']) > 0) { foreach ($list_data['sex'] as $key => $val) { $list_data['sex'][$key] = $this->arrSex[$val]; $sex_disp .= $list_data['sex'][$key] . " "; } $list_data['sex_disp'] = $sex_disp; } // 職業の変換 if (count($list_data['job']) > 0) { foreach ($list_data['job'] as $key => $val) { $list_data['job'][$key] = $this->arrJob[$val]; $job_disp .= $list_data['job'][$key] . " "; } $list_data['job_disp'] = $job_disp; } // カテゴリ変換 $arrCatList = $objDb->sfGetCategoryList(); $list_data['category_name'] = $arrCatList[$list_data['category_id']]; $this->list_data = $list_data; $this->arrCampaignList = $this->lfGetCampaignList($objQuery); $objView->assignobj($this); $objView->display($tpl_path); exit; } if ($_POST['mode'] == 'delete') { } switch ($_POST['mode']) { /* search:「検索」ボタン back:検索結果画面「戻る」ボタン */ case 'delete': case 'search': case 'back': //-- 入力値コンバート $this->list_data = $this->lfConvertParam($_POST, $this->arrSearchColumn); //-- 入力エラーのチェック $this->arrErr = $this->lfErrorCheck($this->list_data); //-- 検索開始 if (!is_array($this->arrErr)) { $this->list_data['name'] = isset($this->list_data['name']) ? SC_Utils_Ex::sfManualEscape($this->list_data['name']) : ""; // hidden要素作成 $this->arrHidden = $this->lfGetHidden($this->list_data); //-- 検索データ取得 $objSelect = new SC_CustomerList($this->list_data, "magazine"); // 生成されたWHERE文を取得する list($where, $arrval) = $objSelect->getWhere(); // 「WHERE」部分を削除する。 $where = ereg_replace("^WHERE", "", $where); // 検索結果の取得 $from = "dtb_customer"; // 行数の取得 $linemax = $objQuery->count($from, $where, $arrval); $this->tpl_linemax = $linemax; // 何件が該当しました。表示用 // ページ送りの取得 $objNavi = new SC_PageNavi($this->tpl_pageno, $linemax, SEARCH_PMAX, "fnResultPageNavi", NAVI_PMAX); $this->arrPagenavi = $objNavi->arrPagenavi; $startno = $objNavi->start_row; // 取得範囲の指定(開始行番号、行数のセット) $objQuery->setlimitoffset(SEARCH_PMAX, $startno); // 表示順序 $objQuery->setorder("customer_id DESC"); // 検索結果の取得 $col = $objSelect->getMailMagazineColumn($this->lfGetIsMobile($_POST['mail_type'])); $this->arrResults = $objQuery->select($col, $from, $where, $arrval); //現在時刻の取得 $this->arrNowDate = $this->lfGetNowDate(); } break; /* input:検索結果画面「htmlmail内容設定」ボタン */ /* input:検索結果画面「htmlmail内容設定」ボタン */ case 'input': //-- 入力値コンバート $this->list_data = $this->lfConvertParam($_POST, $this->arrSearchColumn); //-- 入力エラーのチェック $this->arrErr = $this->lfErrorCheck($this->list_data); //-- エラーなし if (!is_array($this->arrErr)) { //-- 現在時刻の取得 $this->arrNowDate = $this->lfGetNowDate(); $this->arrHidden = $this->lfGetHidden($this->list_data); // hidden要素作成 $this->tpl_mainpage = 'mail/input.tpl'; } break; /* template:テンプレート選択 */ /* template:テンプレート選択 */ case 'template': //-- 入力値コンバート $this->list_data = $this->lfConvertParam($_POST, $this->arrSearchColumn); //-- 時刻設定の取得 $this->arrNowDate['year'] = isset($_POST['send_year']) ? $_POST['send_year'] : ""; $this->arrNowDate['month'] = isset($_POST['send_month']) ? $_POST['send_month'] : ""; $this->arrNowDate['day'] = isset($_POST['send_day']) ? $_POST['send_day'] : ""; $this->arrNowDate['hour'] = isset($_POST['send_hour']) ? $_POST['send_hour'] : ""; $this->arrNowDate['minutes'] = isset($_POST['send_minutes']) ? $_POST['send_minutes'] : ""; //-- 入力エラーのチェック $this->arrErr = $this->lfErrorCheck($this->list_data); //-- 検索開始 if (!is_array($this->arrErr)) { $this->list_data['name'] = isset($this->list_data['name']) ? SC_Utils_Ex::sfManualEscape($this->list_data['name']) : ""; $this->arrHidden = $this->lfGetHidden($this->list_data); // hidden要素作成 $this->tpl_mainpage = 'mail/input.tpl'; $template_data = $this->getTemplateData($conn, $_POST['template_id']); if ($template_data) { foreach ($template_data as $key => $val) { $this->list_data[$key] = $val; } } //-- HTMLテンプレートを使用する場合は、HTMLソースを生成してBODYへ挿入 if ($this->list_data["mail_method"] == 3) { $objTemplate = new LC_HTMLtemplate(); $objTemplate->list_data = lfGetHtmlTemplateData($_POST['template_id']); $objSiteInfo = new SC_SiteInfo(); $objTemplate->arrInfo = $objSiteInfo->data; //メール担当写真の表示 $objUpFile = new SC_UploadFile(IMAGE_TEMP_URL, IMAGE_SAVE_URL); $objUpFile->addFile("メール担当写真", 'charge_image', array('jpg'), IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); $objUpFile->setDBFileList($objTemplate->list_data); $objTemplate->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL); $objMakeTemplate = new SC_AdminView(); $objMakeTemplate->assignobj($objTemplate); $this->list_data["body"] = $objMakeTemplate->fetch("mail/html_template.tpl"); } } break; /* regist_confirm:「入力内容を確認」 regist_back:「テンプレート設定画面へ戻る」 regist_complete:「登録」 */ /* regist_confirm:「入力内容を確認」 regist_back:「テンプレート設定画面へ戻る」 regist_complete:「登録」 */ case 'regist_confirm': case 'regist_back': case 'regist_complete': //-- 入力値コンバート $this->arrCheckColumn = array_merge($this->arrSearchColumn, $this->arrRegistColumn); $this->list_data = $this->lfConvertParam($_POST, $this->arrCheckColumn); //現在時刻の取得 $this->arrNowDate = $this->lfGetNowDate(); //-- 入力エラーのチェック $this->arrErr = $this->lfErrorCheck($this->list_data, 1); $this->tpl_mainpage = 'mail/input.tpl'; $this->arrHidden = $this->lfGetHidden($this->list_data); // hidden要素作成 //-- 検索開始 if (!is_array($this->arrErr)) { $this->list_data['name'] = isset($this->list_data['name']) ? SC_Utils_Ex::sfManualEscape($this->list_data['name']) : ""; if ($_POST['mode'] == 'regist_confirm') { $this->tpl_mainpage = 'mail/input_confirm.tpl'; } else { if ($_POST['mode'] == 'regist_complete') { $this->lfRegistData($conn, $this->list_data); if (MELMAGA_SEND == true) { if (MELMAGA_BATCH_MODE) { $this->sendRedirect($this->getLocation(URL_DIR . "admin/mail/history.php")); } else { $this->sendRedirect($this->getLocation(URL_DIR . "admin/mail/sendmail.php", array("mode" => "now"))); } exit; } else { SC_Utils_Ex::sfErrorHeader(">> 本サイトではメルマガ配信は行えません。"); } } } } break; default: $this->list_data['mail_type'] = 1; break; } // 配信時間の年を、「現在年~現在年+1」の範囲に設定 for ($year = date("Y"); $year <= date("Y") + 1; $year++) { $arrYear[$year] = $year; } $this->arrYear = $arrYear; $this->arrCustomerOrderId = $this->lfGetCustomerOrderId($_POST['buy_product_code']); $this->arrCatList = $objDb->sfGetCategoryList(); $this->arrCampaignList = $this->lfGetCampaignList($objQuery); //---- ページ表示 $objView->assignobj($this); $objView->display(MAIN_FRAME); }
function lfExeInsertSQL($objQuery, $csv) { $sql = ""; $base_sql = ""; $tbl_flg = false; $col_flg = false; $ret = true; $pagelayout_flg = false; $mode = $this->mode; // csvファイルからデータの取得 $fp = fopen($csv, "r"); while (!feof($fp)) { $data = fgetcsv($fp, 1000000); //空白行のときはテーブル変更 if (count($data) <= 1 and $data[0] == "") { $base_sql = ""; $tbl_flg = false; $col_flg = false; continue; } // テーブルフラグがたっていない場合にはテーブル名セット if (!$tbl_flg) { $base_sql = "INSERT INTO {$data['0']} "; $tbl_flg = true; if ($data[0] == "dtb_pagelayout") { $pagelayout_flg = true; } continue; } // カラムフラグがたっていない場合にはカラムセット if (!$col_flg) { if ($mode != "restore_config") { $base_sql .= " ( {$data['0']} "; for ($i = 1; $i < count($data); $i++) { $base_sql .= "," . $data[$i]; } $base_sql .= " ) "; } $col_flg = true; continue; } // インサートする値をセット $sql = $base_sql . "VALUES ( ? "; for ($i = 1; $i < count($data); $i++) { $sql .= ", ?"; } $sql .= " );"; $data = str_replace("\\\"", "\"", $data); $err = $objQuery->query($sql, $data); // エラーがあれば終了 if ($err->message != "") { SC_Utils_Ex::sfErrorHeader(">> " . $objQuery->getlastquery(false)); return false; } if ($pagelayout_flg) { // dtb_pagelayoutの場合には最初のデータはpage_id = 0にする $sql = "UPDATE dtb_pagelayout SET page_id = '0'"; $objQuery->query($sql); $pagelayout_flg = false; } // タイムアウトを防ぐ SC_Utils_Ex::sfFlush(); } fclose($fp); return $ret; }
/** * リリース情報を取得する. * * @return unknown */ function lfGetInfo() { $query = ''; // TODO サイト情報の送信可否設定を行う if (true) { $query = '?site_url=' . SITE_URL . '&eccube_version=' . ECCUBE_VERSION; } $url = UPDATE_HTTP . $query; $jsonStr = @file_get_contents($url); $objJson = new Services_JSON(); $arrTmpData = is_string($jsonStr) ? $objJson->decode($jsonStr) : null; if (empty($arrTmpData)) { SC_Utils_Ex::sfErrorHeader(">> 更新情報の取得に失敗しました。"); return array(); } $arrInfo = array(); foreach ($arrTmpData as $objData) { $arrInfo[] = get_object_vars($objData); } return $arrInfo; }