root/websites/planet.php.gr.jp/trunk/action/Comment.php @ 12921

Revision 12921, 3.2 kB (checked in by ha1t, 5 years ago)

first import

Line 
1<?php
2/**
3 *  Comment.php
4 *
5 *  @author     halt <halt.hde@gmail.com>
6 *  @package    Delphinus
7 *  @version    $Id: skel.action.php,v 1.4 2005/01/04 12:53:26 fujimoto Exp $
8 */
9
10/**
11 *  comment�ե��������
12 *  @author     halt <halt.hde@gmail.com>
13 *  @access     public
14 *  @package    Delphinus
15 */
16class Delphinus_Form_Comment extends Ethna_ActionForm
17{
18    /**
19     *  @access private
20     *  @var    array   �ե��������     */
21    var $form = array(
22        /*
23        'sample' => array(
24            'name'          => '�����      // ɽ��̾
25            'required'      => true,            // ɬ�ܥ��ץ���(true/false)
26            'min'           => null,            // �Ǿ��
27            'max'           => null,            // ���
28            'regexp'        => null,            // ʸ���(���ɽ��)
29            'custom'        => null,            // �᥽�åɤˤ�����å�
30            'filter'        => null,            // �������ե��륿���ץ���
31            'form_type'     => FORM_TYPE_TEXT   // �ե����෿
32            'type'          => VAR_TYPE_INT,    // �����
33        ),
34        */
35        'name' => array(
36            'name' => 'Name',
37            'required' => true,
38            'form_type' => FORM_TYPE_TEXT,
39            'type' => VAR_TYPE_STRING,
40        ),
41
42        'comment' => array(
43            'name' => 'Comment',
44            'required' => true,
45            'form_type' => FORM_TYPE_TEXTAREA,
46            'type' => VAR_TYPE_STRING,
47        ),
48
49        'url' => array(
50            'name' => 'Url',
51            'required' => false,
52            'form_type' => FORM_TYPE_TEXT,
53            'type' => VAR_TYPE_STRING,
54        ),
55
56        'submit' => array(
57            'name' => 'Submit',
58            'required' => true,
59            'form_type' => FORM_TYPE_SUBMIT,
60            'type' => VAR_TYPE_STRING,
61        ),
62    );
63}
64
65/**
66 *  comment���������μ��
67 *  @author     halt <halt.hde@gmail.com>
68 *  @access     public
69 *  @package    Delphinus
70 */
71class Delphinus_Action_Comment extends Ethna_ActionClass
72{
73    /**
74     *  comment�������������
75     *
76     *  @access public
77     *  @return string      ����(��ェλ�ʤ�ll, ����λ�ʤ�lse)
78     */
79    function prepare()
80    {
81        //get query
82        $request = explode('/', $_SERVER['PATH_INFO']);
83        if ( is_numeric($request[2]) ){
84         
85            $this->af->setApp('id', $request[2]);
86           
87            if( $this->af->get('submit') ){
88               
89                if( $this->af->validate() > 0 ) {
90                    return 'error';
91                } else {
92                    return null;
93                }
94           
95            }
96       
97        }
98 
99        return 'error';
100    }
101
102    /**
103     *  comment���������μ��   *
104     *  @access public
105     *  @return string  ����
106     */
107    function perform()
108    {
109       
110        //get query
111        $request = explode('/', $_SERVER['PATH_INFO']);
112        $id = $request[2];
113 
114        $DB = $this->backend->getDB();
115        $Config = $this->backend->getConfig();
116        $base_url = $Config->get('base_url');
117
118        $DB->registerComment($id, $this->af->getArray());
119        header("Location: {$base_url}");
120        exit();
121
122    }
123
124}
125?>
Note: See TracBrowser for help on using the browser.