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 (https://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: $GLOBALS['xoopsLogger']->addDeprecated('Class ' . __CLASS__ . " is deprecated, instantiated from {$trace[0]['file']} line {$trace[0]['line']}");
45:
46: }
47: }
48:
49: /**
50: * object handler class.
51: * @package module::article
52: *
53: * @author D.J. (phppp)
54: * @copyright (c) 2000-2016 XOOPS Project (www.xoops.org)
55: *
56: * @deprecated ArtObjectHandler is deprecated since XOOPS 2.5.8 and will be removed in the next major release
57: */
58: class ArtObjectHandler extends XoopsPersistableObjectHandler
59: {
60: public $db;
61:
62: /**
63: * Constructor
64: *
65: * @param XoopsMySQLDatabase $db reference to the {@link XoopsDatabase} object
66: * @param string $table
67: * @param string $className
68: * @param string $keyName
69: * @param string $identifierName
70: */
71:
72: public function __construct(XoopsMySQLDatabase $db, $table = '', $className = '', $keyName = '', $identifierName = '')
73: {
74: $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
75: $GLOBALS['xoopsLogger']->addDeprecated('Class ' . __CLASS__ . " is deprecated, instantiated from {$trace[0]['file']} line {$trace[0]['line']}");
76: $this->db = $db;
77: parent::__construct($db, $table, $className, $keyName, $identifierName);
78: }
79:
80: /**
81: * get MySQL server version
82: *
83: * @param null|XoopsDatabase|mysqli $conn
84: *
85: * @return string
86: */
87: public function mysql_server_version($conn = null)
88: {
89: if (null === $conn) {
90: $conn = $this->db->conn;
91: }
92: return mysqli_get_server_info($conn);
93: }
94:
95: /**
96: * get MySQL major version
97: *
98: * @return integer : 3 - 4.1-; 4 - 4.1+; 5 - 5.0+
99: */
100: public function mysql_major_version()
101: {
102: $version = $this->mysql_server_version($this->db->conn);
103: if (version_compare($version, '5.0.0', 'ge')) {
104: $mysql_version = 5;
105: } elseif (version_compare($version, '4.1.0', 'ge')) {
106: $mysql_version = 4;
107: } else {
108: $mysql_version = 3;
109: }
110:
111: return $mysql_version;
112: }
113:
114: /**
115: * @param XoopsObject|ArtObject $object
116: * @param bool $force
117: *
118: * @return mixed
119: */
120: public function insert(XoopsObject $object, $force = true)
121: {
122: if (!($object instanceof $this->className)) {
123: return false;
124: }
125: if ($ret = parent::insert($object, $force)) {
126: $object->unsetNew();
127: }
128:
129: return $ret;
130: }
131: }
132: //endif;
133: