29 public function __construct()
31 parent::__construct();
36 if (PHP_VERSION_ID > 50000) {
37 if ($this->check_pm()) {
38 return parent::executeInstall();
41 $this->mLog->addError(_MI_MESSAGE_INSTALL_ERROR);
46 public function check_pm()
48 $hand = xoops_gethandler(
'module');
49 $obj = $hand->getByDirname(
'pm');
50 if (is_object($obj)) {
51 $this->mLog->addError(_MI_MESSAGE_INSTALL_ERROR2);
57 public function _processScript()
59 $root = XCube_Root::getSingleton();
60 $db = $root->mController->getDB();
74 $INBOX =
'INSERT INTO `' . $db->prefix(
'message_inbox') .
'` (`inbox_id`, `uid`, `from_uid`, `title`, `message`, `utime`, `is_read`) VALUES (0, %d, %d, %s, %s, %d, %d)';
75 $OUTBOX =
'INSERT INTO `' . $db->prefix(
'message_outbox') .
'` (`outbox_id`, `uid`, `to_uid`, `title`, `message`, `utime`) VALUES (0, %d, %d, %s, %s, %d)';
78 $sql =
'SELECT * FROM `' . $db->prefix(
'priv_msgs') .
'` ORDER BY `msg_id`';
79 $result = $db->query($sql);
80 while ($val = $db->fetchArray($result)) {
81 $sql = sprintf($INBOX, $val[
'to_userid'], $val[
'from_userid'], $db->quoteString($val[
'subject']), $db->quoteString($val[
'msg_text']), $val[
'msg_time'], $val[
'read_msg']);
84 $sql = sprintf($OUTBOX, $val[
'from_userid'], $val[
'to_userid'], $db->quoteString($val[
'subject']), $db->quoteString($val[
'msg_text']), $val[
'msg_time']);
88 $this->mLog->addReport(
'Update to '.$num.
' records.');