1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* **************************************************************************** |
4
|
|
|
* GBOOK - MODULE FOR XOOPS |
5
|
|
|
* Copyright (c) 2007 - 2012 |
6
|
|
|
* Ingo H. de Boer (http://www.winshell.org) |
7
|
|
|
* |
8
|
|
|
* This program is free software; you can redistribute it and/or modify |
9
|
|
|
* it under the terms of the GNU General Public License as published by |
10
|
|
|
* the Free Software Foundation; either version 2 of the License, or |
11
|
|
|
* (at your option) any later version. |
12
|
|
|
* |
13
|
|
|
* You may not change or alter any portion of this comment or credits |
14
|
|
|
* of supporting developers from this source code or any supporting |
15
|
|
|
* source code which is considered copyrighted (c) material of the |
16
|
|
|
* original comment or credit authors. |
17
|
|
|
* |
18
|
|
|
* This program is distributed in the hope that it will be useful, |
19
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
20
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21
|
|
|
* GNU General Public License for more details. |
22
|
|
|
* --------------------------------------------------------------------------- |
23
|
|
|
* |
24
|
|
|
* @copyright Ingo H. de Boer (http://www.winshell.org) |
25
|
|
|
* @license GNU General Public License (GPL) |
26
|
|
|
* @package GBook |
27
|
|
|
* @author Ingo H. de Boer ([email protected]) |
28
|
|
|
* |
29
|
|
|
* **************************************************************************** |
30
|
|
|
*/ |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @package kernel |
34
|
|
|
* @copyright copyright © 2000 XOOPS.org |
35
|
|
|
*/ |
36
|
|
|
class GbookEntries extends XoopsObject |
|
|
|
|
37
|
|
|
{ |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* |
41
|
|
|
*/ |
42
|
|
|
public function __construct() |
43
|
|
|
{ |
44
|
|
|
$this->initVar('id', XOBJ_DTYPE_INT, null, true); |
45
|
|
|
$this->initVar('name', XOBJ_DTYPE_TXTBOX); |
46
|
|
|
$this->initVar('email', XOBJ_DTYPE_TXTBOX); |
47
|
|
|
$this->initVar('url', XOBJ_DTYPE_TXTBOX); |
48
|
|
|
$this->initVar('message', XOBJ_DTYPE_OTHER); |
49
|
|
|
$this->initVar('note', XOBJ_DTYPE_OTHER); |
50
|
|
|
$this->initVar('time', XOBJ_DTYPE_INT); |
51
|
|
|
$this->initVar('date', XOBJ_DTYPE_TXTBOX); |
52
|
|
|
$this->initVar('ip', XOBJ_DTYPE_TXTBOX); |
53
|
|
|
$this->initVar('admin', XOBJ_DTYPE_TXTBOX); |
54
|
|
|
|
55
|
|
|
$this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false); |
56
|
|
|
$this->initVar('dosmiley', XOBJ_DTYPE_INT, 1, false); |
57
|
|
|
$this->initVar('doxcode', XOBJ_DTYPE_INT, 1, false); |
58
|
|
|
$this->initVar('doimage', XOBJ_DTYPE_INT, 1, false); |
59
|
|
|
$this->initVar('dobr', XOBJ_DTYPE_INT, 1, false); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Get {@link XoopsThemeForm} for adding/editing categories |
64
|
|
|
* |
65
|
|
|
* @param mixed $action URL to submit to or false for $_SERVER['REQUEST_URI'] |
66
|
|
|
* |
67
|
|
|
* @return XoopsThemeForm |
68
|
|
|
*/ |
69
|
|
|
public function getForm($action = false) |
|
|
|
|
70
|
|
|
{ |
71
|
|
|
if ($action === false) { |
72
|
|
|
$action = $_SERVER['REQUEST_URI']; |
73
|
|
|
} |
74
|
|
|
$title = _GBOOK_AM_ENTRY_EDIT; |
75
|
|
|
|
76
|
|
|
include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
77
|
|
|
include_once dirname(__DIR__) . '/class/utilities.php'; |
78
|
|
|
|
79
|
|
|
$form = new XoopsThemeForm($title, 'form', $action, 'post', true); |
80
|
|
|
|
81
|
|
|
$form->addElement(new XoopsFormText(_GBOOK_AM_NAME, 'name', 35, 255, $this->getVar('name'))); |
82
|
|
|
$form->addElement(new XoopsFormText(_GBOOK_AM_EMAIL, 'email', 35, 255, $this->getVar('email'))); |
83
|
|
|
$form->addElement(new XoopsFormText(_GBOOK_AM_URL, 'url', 35, 255, $this->getVar('url'))); |
84
|
|
|
|
85
|
|
|
$messageEditor = GBookUtilities::getEditor('message', $this->getVar('message', 'e')); |
86
|
|
|
// $form->addElement(new XoopsFormTextArea(_GBOOK_AM_MESSAGE, 'message', $this->getVar('message', 'e'))); |
|
|
|
|
87
|
|
|
$form->addElement($messageEditor); |
88
|
|
|
|
89
|
|
|
$noteEditor = GBookUtilities::getEditor('note', $this->getVar('note', 'e')); |
90
|
|
|
// $form->addElement(new XoopsFormTextArea(_GBOOK_AM_NOTE, 'note', $this->getVar('note', 'e'))); |
|
|
|
|
91
|
|
|
$form->addElement($noteEditor); |
92
|
|
|
|
93
|
|
|
$form->addElement(new XoopsFormHidden('op', 'save')); |
94
|
|
|
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
95
|
|
|
|
96
|
|
|
return $form; |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @package kernel |
102
|
|
|
* @copyright copyright © 2000 XOOPS.org |
103
|
|
|
*/ |
104
|
|
|
class GbookEntriesHandler extends XoopsPersistableObjectHandler |
|
|
|
|
105
|
|
|
{ |
106
|
|
|
/** |
107
|
|
|
* @param null|XoopsDatabase $db |
108
|
|
|
*/ |
109
|
|
|
public function __construct(XoopsDatabase $db) |
110
|
|
|
{ |
111
|
|
|
parent::__construct($db, 'gbook_entries', 'gbookEntries', 'id', 'name', 'email', 'url', 'message', 'note', 'time', 'date', 'ip', 'admin'); |
112
|
|
|
} |
113
|
|
|
} |
114
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.