| 1 | <?php
|
---|
| 2 |
|
---|
| 3 | // タグ出力用クラス
|
---|
| 4 | class LC_EbisPage {
|
---|
| 5 | function LC_EbisPage() {
|
---|
| 6 | $this->tpl_mainpage = MODULE_PATH . "ebis_tag_text.tpl";
|
---|
| 7 | }
|
---|
| 8 | }
|
---|
| 9 |
|
---|
| 10 | // エビスタグの発行
|
---|
| 11 | function sfPrintEbisTag($pid = "") {
|
---|
| 12 | $objQuery = new SC_Query();
|
---|
| 13 | $arrRet = $objQuery->select("sub_data", "dtb_module", "module_id = ?", array(EBIS_TAG_MID));
|
---|
| 14 | $arrSubData = unserialize($arrRet[0]['sub_data']);
|
---|
| 15 | $arrEbis = array();
|
---|
| 16 |
|
---|
| 17 | if($arrSubData['cid'] != "") {
|
---|
| 18 | $arrEbis['cid'] = $arrSubData['cid'];
|
---|
| 19 | } else {
|
---|
| 20 | return;
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | // 「/」が重複しているものへの対応
|
---|
| 24 | $php_self = ereg_replace("[/]+", "/", $_SERVER['PHP_SELF']);
|
---|
| 25 | // PHPファイルの後ろに「/」がついてしまっているものへの対応
|
---|
| 26 | $php_self = ereg_replace(".php[/]+$", ".php", $php_self);
|
---|
| 27 |
|
---|
| 28 | if(!is_array($pid) && $pid != "") {
|
---|
| 29 | if(!ereg(".tpl$", $pid)) {
|
---|
| 30 | // ページIDを上書きする
|
---|
| 31 | $arrEbis['pid'] = $pid;
|
---|
| 32 | } else {
|
---|
| 33 | // テンプレートのパスが与えられている場合
|
---|
| 34 | $temp_id = ereg_replace(HTML_PATH,"",$pid);
|
---|
| 35 | $temp_id = ereg_replace("^[/]+","",$temp_id);
|
---|
| 36 | $temp_id = ereg_replace(".tpl$","",$temp_id);
|
---|
| 37 | $temp_id = ereg_replace("[\./]","_",$temp_id);
|
---|
| 38 | $arrEbis['pid'] = $temp_id;
|
---|
| 39 | }
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | // 商品一覧ページは、特殊IDを発行
|
---|
| 43 | if(ereg("/products/list.php\?category_id=[0-9]+$", $_SERVER["REQUEST_URI"])) {
|
---|
| 44 | $filename = basename($_SERVER["REQUEST_URI"]);
|
---|
| 45 | $arrEbis['pid'] = ereg_replace("list.php\?category_id=", "list-c", $filename);
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | // 商品詳細ページは、特殊IDを発行
|
---|
| 49 | if(ereg("/products/detail.php\?product_id=[0-9]+$", $_SERVER["REQUEST_URI"])) {
|
---|
| 50 | $filename = basename($_SERVER["REQUEST_URI"]);
|
---|
| 51 | $arrEbis['pid'] = ereg_replace("detail.php\?product_id=", "detail-p", $filename);
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | // ID割り当てされていないページは、自動的に生成する。
|
---|
| 55 | if($arrEbis['pid'] == "") {
|
---|
| 56 | $temp_id = ereg_replace("^[/]+","",$_SERVER['PHP_SELF']);
|
---|
| 57 | $temp_id = ereg_replace(".php$","",$temp_id);
|
---|
| 58 | $temp_id = ereg_replace("[\./]","_",$temp_id);
|
---|
| 59 | $arrEbis['pid'] = $temp_id;
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | // ページIDが登録されている場合のみタグを出力する。
|
---|
| 63 | if($arrEbis['pid'] != "") {
|
---|
| 64 | $objSubPage = new LC_EbisPage();
|
---|
| 65 | $objSubPage->arrEbis = $arrEbis;
|
---|
| 66 | $objSubView = new SC_SiteView();
|
---|
| 67 | $objSubView->assignobj($objSubPage);
|
---|
| 68 | $objSubView->display($objSubPage->tpl_mainpage);
|
---|
| 69 | }
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | // コンバージョンタグの発行
|
---|
| 73 | function sfPrintAffTag($conv_page, $option) {
|
---|
| 74 | if(is_numeric($conv_page)) {
|
---|
| 75 | // sub_dataよりタグ情報を読み込む
|
---|
| 76 | $objQuery = new SC_Query();
|
---|
| 77 | $arrRet = $objQuery->select("sub_data", "dtb_module", "module_id = ?", array(AFF_TAG_MID));
|
---|
| 78 | $arrSubData = unserialize($arrRet[0]['sub_data']);
|
---|
| 79 | $aff_tag = $arrSubData[$conv_page];
|
---|
| 80 |
|
---|
| 81 | $array = split("\|", $option);
|
---|
| 82 |
|
---|
| 83 | // 特定文字の置き換え
|
---|
| 84 | foreach($array as $each) {
|
---|
| 85 | list($key, $value) = split("=", $each);
|
---|
| 86 | $aff_tag = ereg_replace("\[\[" . $key . "\]\]", $value, $aff_tag);
|
---|
| 87 | }
|
---|
| 88 | print($aff_tag);
|
---|
| 89 | }
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | // dtb_paymentに汎用項目が存在していなければ追加する
|
---|
| 93 | function sfAlterMemo(){
|
---|
| 94 | $objQuery = new SC_Query();
|
---|
| 95 |
|
---|
| 96 | // 汎用項目の存在チェック
|
---|
| 97 | if(!sfColumnExists("dtb_payment", "memo01")){
|
---|
| 98 |
|
---|
| 99 | // モジュールIDを追加
|
---|
| 100 | $objQuery->query("alter table dtb_payment add module_id int4;");
|
---|
| 101 |
|
---|
| 102 | // モジュールパスを追加
|
---|
| 103 | $objQuery->query("alter table dtb_payment add module_path text;");
|
---|
| 104 |
|
---|
| 105 | // 汎用項目を10個追加
|
---|
| 106 | for($i=1; $i<=9; $i++){
|
---|
| 107 | $objQuery->query("alter table dtb_payment add memo0".$i." text;");
|
---|
| 108 | }
|
---|
| 109 | $objQuery->query("alter table dtb_payment add memo10 text;");
|
---|
| 110 | }
|
---|
| 111 | }
|
---|
| 112 |
|
---|
| 113 | ?> |
---|