} if (empty($BTopic->topic_id)) { redirect_header('index.php?op=topicsmanager', 1, _TAKINGBACK); } if ($_POST['topic_pid'] == $_POST['topic_id']) { echo "ERROR: Cannot select this topic for parent topic!"; exit; // TODO check parent tree or not } $BTopic->setTopicPid($_POST['topic_pid']); if (empty($_POST['topic_title'])) { redirect_header("index.php?op=topicsmanager", 2, _AM_ERRORTOPICNAME); } $BTopic->setTopicTitle($_POST['topic_title']); $BTopic->setTopicImgurl(@$_POST['topic_imgurl']); $BTopic->store(); redirect_header('index.php?op=topicsmanager', 1, _AM_DBUPDATED); break; case 'convert': xoops_cp_header(); include dirname(__FILE__) . '/mymenu.php'; if (empty($_POST['ok'])) { xoops_confirm(array('op' => 'convert', 'ok' => 1), 'index.php', _AM_DO_YOU_CONVERT); } else { // Topic Convert $sql = "SELECT * FROM " . $xoopsDB->prefix('topics') . " ORDER BY topic_id"; $result = $xoopsDB->query($sql); while ($topic = $xoopsDB->fetchArray($result)) { $sql = sprintf("INSERT INTO %s (topic_id, topic_pid, topic_imgurl, topic_title, topic_created, topic_modified) VALUES (%u, %u, %s, %s, UNIX_TIMESTAMP(), UNIX_TIMESTAMP())", $xoopsDB->prefix("{$mydirname}_topics"), $topic['topic_id'], $topic['topic_pid'], $xoopsDB->quoteString($topic['topic_imgurl']), $xoopsDB->quoteString($topic['topic_title'])); if ($xoopsDB->query($sql)) { echo '<br />Topic "' . htmlspecialchars($topic['topic_title']) . '" was successfully converted.';