source: branches/beta/data/downloads/module/mdl_cybs/mdl_cybs.php @ 16911

Revision 16911, 2.5 KB checked in by adachi, 15 years ago (diff)

暫定コミット(サイバーソース決済モジュール)

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-httpd-php
Line 
1<?php
2/**
3 * ¥â¥¸¥å¡¼¥ë¥Ð¡¼¥¸¥ç¥óɽµ­
4 * @version CVS: $Id$
5 */
6require_once 'mdl_cybs.inc';
7require_once 'class/mdl_cybs_config.php';
8
9class LC_Page {
10    //¥³¥ó¥¹¥È¥é¥¯¥¿
11    function LC_Page() {
12        //¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È¤Î»ØÄê
13        $this->tpl_mainpage = MODULE_PATH . 'mdl_cybs/mdl_cybs.tpl';
14        $this->tpl_subtitle = '¥µ¥¤¥Ð¡¼¥½¡¼¥¹·èºÑ¥â¥¸¥å¡¼¥ë';
15        $this->extension_installed = lfIsInstalledCybsExt();
16    }
17}
18
19$objPage = new LC_Page;
20$objView = new SC_AdminView;
21
22$objForm = lfInitParam();
23$objPage->arrForm = $objForm->getFormParamList();
24
25$mode = isset($_POST['mode']) ? $_POST['mode'] : '';
26switch($mode) {
27// ÆþÎϹàÌܤÎÅÐÏ¿
28case 'edit':
29    if ($arrErr = lfCheckError($objForm)) {
30        $objPage->arrErr = $arrErr;
31        break;
32    }
33
34    $objConfig =& Mdl_Cybs_Config::getInstanse();
35    $objConfig->registerConfig($objConfig->createSqlArray($objForm));
36    $objPage->tpl_onload = 'alert("ÅÐÏ¿´°Î»¤·¤Þ¤·¤¿¡£"); window.close();';
37    break;
38
39// Ä̾ïɽ¼¨
40default:
41    // DB¤ÎÅÐÏ¿Ãͤò¼èÆÀ¤¹¤ë.
42    $objConfig =& Mdl_Cybs_Config::getInstanse();
43    $arrConfig = $objConfig->getConfig();
44
45    // DB¤ËÃͤ¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ì¤Ð¤½¤ÎÃͤòɽ¼¨¤µ¤»¤ë
46    if (!empty($arrConfig)) {
47        $objForm = lfInitParam($arrConfig);
48        $objPage->arrForm = $objForm->getFormParamList();
49    }
50}
51
52$objView->assignObj($objPage);
53$objView->display($objPage->tpl_mainpage);
54//sfPrintR($objView->_smarty->get_template_vars());
55
56/**
57 * ¥Ñ¥é¥á¡¼¥¿¤Î½é´ü²½
58 *
59 * @param array
60 * @return SC_FormParam
61 */
62function lfInitParam($arrParam = null) {
63    $objForm = new SC_FormParam;
64    $objForm->addParam('¥ê¥¯¥¨¥¹¥ÈÀè', 'cybs_request_url', INT_LEN, '', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK'));
65    $objForm->addParam('¥Þ¡¼¥Á¥ã¥ó¥ÈID', 'cybs_merchant_id', MTEXT_LEN, '', array('EXIST_CHECK', 'MAX_LENGTH_CHECK'));
66    $objForm->addParam('¥µ¥Ö¥¹¥¯¥ê¥×¥·¥ç¥ó¥µ¡¼¥Ó¥¹', 'cybs_subs_use', INT_LEN, '', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
67
68    if (empty($arrParam)) {
69        $arrParam = $_POST;
70    }
71    $objForm->setParam($arrParam);
72    return $objForm;
73}
74/**
75 * ¥¨¥é¡¼¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
76 *
77 * @param SC_FormParam $objForm
78 * @return array|null
79 */
80function lfCheckError($objForm) {
81    $arrErr = $objForm->checkError();
82    if ($arrErr) return $arrErr;
83
84    return null;
85}
86
87/**
88 * mod_cybs¤¬¥¤¥ó¥¹¥È¡¼¥ëºÑ¤ß¤«¥Á¥§¥Ã¥¯¤¹¤ë.
89 *
90 * @return boolean
91 */
92function lfIsInstalledCybsExt() {
93    if (!extension_loaded(MDL_CYBS_EXT)) {
94        if (!dl(MDL_CYBS_EXT)) {
95            return false;
96        }
97    }
98    return true;
99}
100?>
Note: See TracBrowser for help on using the repository browser.