1: <?php
2: /**
3: * Extended object handlers
4: *
5: * For backward compatibility
6: *
7: * @copyright (c) 2000-2016 XOOPS Project (www.xoops.org)
8: * @license GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html)
9: * @author Taiwen Jiang <phppp@users.sourceforge.net>
10: * @since 1.00
11: * @package Frameworks
12: * @subpackage art
13: */
14:
15: //if (!class_exists("ArtObject")):
16: if (class_exists('ArtObject')) {
17: return null;
18: }
19:
20: /**
21: * Art Object
22: *
23: * @author D.J. (phppp)
24: * @copyright (c) 2000-2016 XOOPS Project (www.xoops.org)
25: * @package module::article
26: *
27: * @deprecated ArtObject is deprecated since XOOPS 2.5.8 and will be removed in the next major release
28: */
29: class ArtObject extends XoopsObject
30: {
31: /**
32: * @var string
33: */
34: public $plugin_path;
35:
36: /**
37: * Constructor
38: *
39: */
40:
41: public function __construct()
42: {
43: $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
44: trigger_error("ArtObject is deprecated, instantiated from {$trace[0]['file']} line {$trace[0]['line']},");
45: }
46: }
47:
48: /**
49: * object handler class.
50: * @package module::article
51: *
52: * @author D.J. (phppp)
53: * @copyright (c) 2000-2016 XOOPS Project (www.xoops.org)
54: *
55: * @deprecated ArtObjectHandler is deprecated since XOOPS 2.5.8 and will be removed in the next major release
56: */
57: class ArtObjectHandler extends XoopsPersistableObjectHandler
58: {
59: public $db;
60:
61: /**
62: * Constructor
63: *
64: * @param XoopsMySQLDatabase $db reference to the {@link XoopsDatabase} object
65: * @param string $table
66: * @param string $className
67: * @param string $keyName
68: * @param string $identifierName
69: */
70:
71: public function __construct(XoopsMySQLDatabase $db, $table = '', $className = '', $keyName = '', $identifierName = '')
72: {
73: $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
74: trigger_error("ArtObjectHandler is deprecated, instantiated from {$trace[0]['file']} line {$trace[0]['line']},");
75: $this->db = $db;
76: parent::__construct($db, $table, $className, $keyName, $identifierName);
77: }
78:
79: /**
80: * get MySQL server version
81: *
82: * @param null|XoopsDatabase|mysqli $conn
83: *
84: * @return string
85: */
86: public function mysql_server_version($conn = null)
87: {
88: if (null === $conn) {
89: $conn = $this->db->conn;
90: }
91: return mysqli_get_server_info($conn);
92: }
93:
94: /**
95: * get MySQL major version
96: *
97: * @return integer : 3 - 4.1-; 4 - 4.1+; 5 - 5.0+
98: */
99: public function mysql_major_version()
100: {
101: $version = $this->mysql_server_version($this->db->conn);
102: if (version_compare($version, '5.0.0', 'ge')) {
103: $mysql_version = 5;
104: } elseif (version_compare($version, '4.1.0', 'ge')) {
105: $mysql_version = 4;
106: } else {
107: $mysql_version = 3;
108: }
109:
110: return $mysql_version;
111: }
112:
113: /**
114: * @param XoopsObject|ArtObject $object
115: * @param bool $force
116: *
117: * @return mixed
118: */
119: public function insert(XoopsObject $object, $force = true)
120: {
121: if (!($object instanceof $this->className)) {
122: return false;
123: }
124: if ($ret = parent::insert($object, $force)) {
125: $object->unsetNew();
126: }
127:
128: return $ret;
129: }
130: }
131: //endif;
132: