prefix(); $moduleHandler = xoops_gethandler('module'); $module = $moduleHandler->getByDirname($d3forum); $moduleConfigHandler = xoops_gethandler('config'); $moduleConfig = $moduleConfigHandler->getConfigsByDirname($d3forum); $table = $d3forum.'_categories'; if (!MyDumpTool::tableExists($table)) { exit('d3forum('.$d3forum.') module not found'.PHP_EOL); } $gidGuest = XOOPS_GROUP_ANONYMOUS; // get anonymous readable categories $categories = []; $sql = <<< SQL SELECT `c`.* FROM `${prefix}_${d3forum}_categories` AS `c` INNER JOIN `${prefix}_${d3forum}_category_access` AS `ca` ON `c`.`cat_id`=`ca`.`cat_id` WHERE `ca`.`groupid`=${gidGuest} GROUP BY `c`.`cat_id` ORDER BY `c`.`cat_order_in_tree` ASC, `c`.`cat_weight` ASC SQL; if (!($res = $xoopsDB->query($sql))) { var_dump($xoopsDB); exit(); } while ($row = $xoopsDB->fetchArray($res)) { MyDumpTool::decode($row); MyDumpTool::convertToInt($row, ['cat_id', 'pid', 'cat_topics_count', 'cat_posts_count', 'cat_last_post_id', 'cat_last_post_time', 'cat_topics_count_in_tree', 'cat_posts_count_in_tree', 'cat_last_post_id_in_tree', 'cat_last_post_time_in_tree', 'cat_depth_in_tree', 'cat_order_in_tree', 'cat_weight']); $row['cat_path_in_tree'] = unserialize($row['cat_path_in_tree']); $row['cat_options'] = unserialize($row['cat_options']); $categories[] = $row; } $xoopsDB->freeRecordSet($res); //var_dump($categories); // get anonymous readable forums $forums = []; $sql = <<< SQL SELECT `f`.* FROM `${prefix}_${d3forum}_forums` AS `f` INNER JOIN `${prefix}_${d3forum}_forum_access` AS `fa` ON `f`.`forum_id`=`fa`.`forum_id` INNER JOIN `${prefix}_${d3forum}_category_access` AS `ca` ON `f`.`cat_id`=`ca`.`cat_id` WHERE `fa`.`groupid`=${gidGuest} AND `ca`.`groupid`=${gidGuest} GROUP BY `f`.`forum_id` ORDER BY `f`.`cat_id` ASC, `f`.`forum_weight` ASC SQL; if (!($res = $xoopsDB->query($sql))) { var_dump($xoopsDB); exit(); } while ($row = $xoopsDB->fetchArray($res)) { MyDumpTool::decode($row); MyDumpTool::convertToInt($row, ['forum_id', 'cat_id', 'forum_topics_count', 'forum_posts_count', 'forum_last_post_id', 'forum_last_post_time', 'forum_weight'], true); $row['forum_options'] = unserialize($row['forum_options']); $forums[] = $row; } $xoopsDB->freeRecordSet($res); //var_dump($forums); // get anonymous readable topics $topics = []; $sql = <<< SQL SELECT `t`.*, `uf`.`name` AS `topic_first_uid_name`, `uf`.`uname` AS `topic_first_uid_uname`, `ul`.`name` AS `topic_last_uid_name`, `ul`.`uname` AS `topic_last_uid_uname` FROM `${prefix}_${d3forum}_topics` AS `t` INNER JOIN `${prefix}_${d3forum}_forums` AS `f` ON `t`.`forum_id`=`f`.`forum_id` INNER JOIN `${prefix}_${d3forum}_forum_access` AS `fa` ON `f`.`forum_id`=`fa`.`forum_id` INNER JOIN `${prefix}_${d3forum}_category_access` AS `ca` ON `f`.`cat_id`=`ca`.`cat_id` LEFT JOIN `${prefix}_users` AS `uf` ON `t`.`topic_first_uid`=`uf`.`uid` LEFT JOIN `${prefix}_users` AS `ul` ON `t`.`topic_last_uid`=`ul`.`uid` WHERE `fa`.`groupid`=${gidGuest} AND `ca`.`groupid`=${gidGuest} GROUP BY `t`.`topic_id` ORDER BY `t`.`forum_id` ASC, `t`.`topic_id` ASC SQL; if (!($res = $xoopsDB->query($sql))) { var_dump($xoopsDB); exit(); } while ($row = $xoopsDB->fetchArray($res)) { MyDumpTool::decode($row); MyDumpTool::convertToInt($row, ['topic_id', 'forum_id', 'topic_first_uid', 'topic_first_post_id', 'topic_first_post_time', 'topic_last_uid', 'topic_last_post_id', 'topic_last_post_time', 'topic_views', 'topic_posts_count', 'topic_locked', 'topic_sticky', 'topic_solved', 'topic_invisible', 'topic_votes_sum', 'topic_votes_count'], true); $topics[] = $row; } $xoopsDB->freeRecordSet($res); //var_dump($topics); // get anonymous readable posts $posts = []; $sql = <<< SQL SELECT `p`.*, `u`.`name` AS `uid_name`, `u`.`uname` AS `uid_uname`, `u`.`rank` AS `uid_rank`, `u`.`posts` AS `uid_posts` FROM `${prefix}_${d3forum}_posts` AS `p` INNER JOIN `${prefix}_${d3forum}_topics` AS `t` ON `p`.`topic_id`=`t`.`topic_id` INNER JOIN `${prefix}_${d3forum}_forums` AS `f` ON `t`.`forum_id`=`f`.`forum_id` INNER JOIN `${prefix}_${d3forum}_forum_access` AS `fa` ON `f`.`forum_id`=`fa`.`forum_id` INNER JOIN `${prefix}_${d3forum}_category_access` AS `ca` ON `f`.`cat_id`=`ca`.`cat_id` LEFT JOIN `${prefix}_users` AS `u` ON `p`.`uid`=`u`.`uid` WHERE `fa`.`groupid`=${gidGuest} AND `ca`.`groupid`=${gidGuest} GROUP BY `p`.`post_id` ORDER BY `t`.`topic_id` ASC, `p`.`post_id` ASC SQL; if (!($res = $xoopsDB->query($sql))) { var_dump($xoopsDB); exit(); } while ($row = $xoopsDB->fetchArray($res)) { MyDumpTool::decode($row); MyDumpTool::convertToInt($row, ['post_id', 'pid', 'topic_id', 'post_time', 'modified_time', 'uid', 'uid_hidden', 'html', 'smiley', 'xcode', 'br', 'number_entity', 'special_entity', 'icon', 'attachsig', 'invisible', 'approval', 'votes_sum', 'votes_count', 'depth_in_tree', 'order_in_tree', 'uid_rank', 'uid_posts'], true); MyDumpTool::dropColumn($row, ['guest_email', 'guest_url', 'guest_pass_md5', 'guest_trip']); $posts[] = $row; } $xoopsDB->freeRecordSet($res); //var_dump($posts); var_dump(count($posts)); $moduleinfo = [ 'name' => $module->get('name'), 'dirname' => $d3forum, 'message' => $moduleConfig['top_message'], ]; MyDumpTool::decode($moduleinfo); $data = [ 'module' => $moduleinfo, 'categories' => $categories, 'forums' => $forums, 'topics' => $topics, 'posts' => $posts, ]; $contents[] = $data; }