getConfigsByDirname($mydirname); $data['module'] = []; foreach (['name', 'dirname'] as $key) { $data['module'][$key] = $module[$key]; } foreach (['storyhome', 'displaynav', 'disp_list_of_cat', 'stories_of_cat', 'use_pankuzu'] as $key) { $data['module'][$key] = intval($moduleConfig[$key]); } $langman->read('main.php', $mydirname, $mytrustdirname); $mydirpath = XOOPS_ROOT_PATH.'/modules/'.$mydirname; $mydirurl = XOOPS_URL.'/modules/'.$mydirname; include "$mytrustdirpath/main/header.php"; $gperm = BulletinGP::getInstance($mydirname); $can_read_topic_ids = $gperm->makeOnTopics('can_read'); // get topics $table = $xoopsDB->prefix($mydirname.'_topics'); $topic_ids_sql = implode(', ', $can_read_topic_ids); $sql = <<< SQL SELECT `topic_id`, `topic_pid`, `topic_title` FROM `${table}` WHERE `topic_id` IN (${topic_ids_sql}) ORDER BY `topic_id` ASC SQL; if (!($res = $xoopsDB->query($sql))) { var_dump($xoopsDB); exit(); } $data['topics'] = []; while ($row = $xoopsDB->fetchArray($res)) { MyDumpTool::decode($row); MyDumpTool::convertToInt($row, ['topic_id', 'topic_pid']); $data['topics'][] = [ 'id' => $row['topic_id'], 'pid' => $row['topic_pid'], 'title' => $row['topic_title'], ]; } $xoopsDB->freeRecordSet($res); // get all stories $articles = Bulletin::getAllPublished($mydirname, 0, 0, 0, 1, true, true, true); foreach ($articles as $article) { $article->unifyHomeTextAndBodyText(); $story = []; $story['id'] = intval($article->getVar('storyid', 'n')); $url = $mydirurl.'/index.php?page=article&storyid='.$story['id']; $story['posttime'] = formatTimestamp($article->getVar('published'), $bulletin_date_format); $story['topic_id'] = intval($article->getVar('topicid', 'n')); $story['title'] = $article->getVar('title', 'n'); $text = $article->getVar('text', 'n'); $doHtml = $article->getVar('html', 'n'); $doSmiley = $article->getVar('smiley', 'n'); $doBr = $article->getVar('br', 'n'); $doXcode = $article->getVar('xcode', 'n'); $story['text'] = [ 'en' => normalizeHtml($ts->displayTarea(MyDumpTool::mlang($text, $url, 'en'), $doHtml, $doSmiley, $doXcode, 0, $doBr), $url), 'ja' => normalizeHtml($ts->displayTarea(MyDumpTool::mlang($text, $url, 'ja'), $doHtml, $doSmiley, $doXcode, 0, $doBr), $url), ]; $type = $article->getVar('type', 'n'); if (1 != $type) { echo 'Error: other type is unsupported'.PHP_EOL; exit(); } if (!empty($article->getRelated())) { echo 'Error: related article feature is unsupported'.PHP_EOL; exit(); } $data['stories'][] = $story; } MyDumpTool::makeDirectory('public/modules/'.$mydirname); MyDumpTool::saveJson('public/modules/'.$mydirname.'/index.json', $data); }