function b_bulletin_topics_show($options) { global $xoopsDB; $mydirname = $options[0]; require_once XOOPS_ROOT_PATH . '/class/xoopstopic.php'; require_once dirname(dirname(__FILE__)) . '/class/bulletinTopic.php'; // GIJ $block = array(); // $xt = new XoopsTopic($xoopsDB->prefix("{$mydirname}_topics")); $bt = new BulletinTopic($mydirname); // GIJ $jump = XOOPS_URL . '/modules/' . $mydirname . '/index.php?storytopic='; $storytopic = isset($_GET['storytopic']) ? intval($_GET['storytopic']) : 0; // ob_start(); // $xt->makeTopicSelBox(1, $storytopic,"storytopic","location=\"".$jump."\"+this.options[this.selectedIndex].value"); // $block['selectbox'] = ob_get_contents(); // ob_end_clean(); $block['selectbox'] = $bt->makeTopicSelBox(true, $storytopic, "storytopic", "location=\"" . $jump . "\"+this.options[this.selectedIndex].value"); $block['mydirname'] = $mydirname; return $block; }
require_once XOOPS_ROOT_PATH.'/class/pagenav.php'; $pagenav = new XoopsPageNav($totalcount, $storynum, $start, 'start', $query); $xoopsTpl->assign('pagenav', $pagenav->renderNav()); } else { $xoopsTpl->assign('pagenav', ''); } $xoopsTpl->assign($assing_array); if($bulletin_assing_rssurl_head){ $xoopsTpl->assign('xoops_module_header', $rss_feed . $xoopsTpl->get_template_vars( "xoops_module_header" )); } // GIJ $breadcrumbs = array( array( 'name' => $xoopsModule->getVar('name') , 'url' => XOOPS_URL.'/modules/'.$mydirname.'/' ) ) ; $topic = new BulletinTopic( $mydirname , $storytopic ) ; if( $storytopic ) { $pankuzu4assign = $topic->makePankuzuForHTML( $storytopic ) ; foreach( $pankuzu4assign as $p4a ) { if( $p4a['topic_id'] == $storytopic ) $breadcrumbs[] = array( 'name' => $p4a['topic_title'] ) ; else $breadcrumbs[] = array( 'name' => $p4a['topic_title'] , 'url' => XOOPS_URL.'/modules/'.$mydirname.'/index.php?storytopic='.$p4a['topic_id'] ) ; } } $xoopsTpl->assign( 'xoops_breadcrumbs' , $breadcrumbs ) ; $xoopsTpl->assign( 'mod_config' , $xoopsModuleConfig ) ; //Template $xoopsOption['template_main'] = "{$mydirname}_index.html"; require_once XOOPS_ROOT_PATH.'/footer.php'; ?>
} // Delete the topic $eachtopic->delete(); //ver3.0 $gperm->delete_topic_access($eachtopic->topic_id()); xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'category', $eachtopic->topic_id); } redirect_header('index.php?op=topicsmanager', 1, _AM_DBUPDATED); } break; case 'modTopicS': //ver3.0 if (!$xoopsGTicket->check(true, 'bulletin_admin')) { redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors()); } $BTopic = new BulletinTopic($mydirname, $_POST['topic_id']); if (empty($BTopic)) { redirect_header('index.php?op=topicsmanager', 1, _TAKINGBACK); } 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); }
$topicid = isset($_GET['topicid']) ? intval($_GET['topicid']) : 0; $topicid = isset($_POST['topicid']) ? intval($_POST['topicid']) : $topicid; /* * Data loading section */ $story = new Bulletin( $mydirname , $storyid ); if ( $storyid ){ $topicid = $story->getVar('topicid'); if( empty($topicid) ){ die(_MD_NO_TOPICS); exit; } } // In case of No Topic $BTopic = new BulletinTopic( $mydirname, $topicid ); $topicid = $BTopic->getTopicIdByPermissionCheck($topicid); if( $topicid ){ $story->setVar('topicid', $topicid); } if( !$BTopic->topicExists() ){ die(_MD_NO_TOPICS); exit; } $xoopsTpl->assign('topic_title', $BTopic->topic_title()); // Chanege the WSYWIG editor if( ! empty( $_REQUEST['using_fck'] ) ) { $_POST['text'] = $_POST['text_fck'] ; }
<?php //テンプレート $xoopsOption['template_main'] = "{$mydirname}_index.html"; require XOOPS_ROOT_PATH . '/header.php'; $storytopic = isset($_GET['storytopic']) ? intval($_GET['storytopic']) : 0; $storynum = isset($_GET['storynum']) ? intval($_GET['storynum']) : $bulletin_storyhome; $start = isset($_GET['start']) ? intval($_GET['start']) : 0; $caldate = isset($_GET['caldate']) ? $_GET['caldate'] : ''; $storynum = $storynum > 30 ? $bulletin_storyhome : $storynum; // ナビゲータ if ($bulletin_displaynav == 1) { // ナビを使うと宣言 $xoopsTpl->assign('displaynav', true); // セレクタをアサイン $bt = new BulletinTopic($mydirname); $xoopsTpl->assign('topic_select', $bt->makeTopicSelBox(true, $storytopic, 'storytopic')); /* // オプションをアサイン for ( $i = 5; $i <= 30; $i = $i + 5 ) { $option = array(); $option['sel'] = ($i == $storynum) ? ' selected="selected"' : '' ; $option['option'] = $i ; $xoopsTpl->append('option', $option); }*/ } else { $xoopsTpl->assign('displaynav', false); } // カレンダからのリンク(日付指定が有った場合) if (!empty($caldate) && preg_match('/([0-9]{4})-([0-9]{2})-([0-9]{2})/', $caldate, $datearr)) { $articles = Bulletin::getAllToday($mydirname, $storynum, $start, $caldate); $xoopsTpl->assign('displaynav', false);
// // form stage // // create jump box options as array //TODO WHY $sql = "SELECT topic_id,topic_title,topic_pid FROM ".$db->prefix($mydirname."_topics")." ORDER BY topic_pid,topic_title"; $crs = $db->query( $sql ) ; $topic_options = array() ; while( list( $id , $title , $depth ) = $db->fetchRow( $crs ) ) { $topic_options[ $id ] = str_repeat( '--' , $depth ) . htmlspecialchars( $title , ENT_QUOTES ) ; } // Assign Selector ,add ver3.0beta3 $bt = new BulletinTopic( $mydirname ) ; $topicselbox = $bt->makeTopicSelBox( false , $topic_id , 'topic_id' ); // create group form $group_handler =& xoops_gethandler( 'group' ) ; $groups =& $group_handler->getObjects() ; $group_trs = '' ; foreach( $groups as $group ) { $gid = $group->getVar('groupid') ; $sql = "SELECT can_post,can_edit,can_delete,post_auto_approved FROM ".$db->prefix($mydirname."_topic_access")." WHERE groupid=".$group->getVar('groupid')." AND topic_id=$topic_id"; $fars = $db->query( $sql ) ; if( $db->getRowsNum( $fars ) > 0 ) { $can_read = true ; list( $can_post , $can_edit , $can_delete , $post_auto_approved ) = $db->fetchRow( $fars ) ; } else { $can_post = $can_read = $can_edit = $can_delete = $post_auto_approved = false ;
function countPublished($mydirname, $topicid = 0, $topic_recursive = false, $gpermited = false) { $gperm =& BulletinGP::getInstance($mydirname); $criteria = array(); if ($gpermited && !$gperm->group_perm(2)) { $criteria[] = 'type > 0'; } else { $criteria[] = 'type > 0'; } $criteria[] = 'published > 0'; $criteria[] = 'published <= ' . time(); $criteria[] = '(expired = 0 OR expired > ' . time() . ')'; //ver3.0 if ($gpermited) { $can_read_topic_ids = $gperm->makeOnTopics('can_read'); $criteria[] = "topicid IN (" . implode(',', $can_read_topic_ids) . ")"; } if (!empty($topicid)) { if ($topic_recursive) { $topic = new BulletinTopic($mydirname, intval($topicid)); $topics = $topic->getAllChildId(null, $gpermited); $topics[] = intval($topicid); $criteria[] = "topicid IN (" . implode(',', $topics) . ")"; } else { $criteria[] = 'topicid=' . intval($topicid); } } else { $criteria[] = 'ihome=1'; } return Bulletin::countAll($mydirname, $criteria); }
<?php //投稿権限が無い場合 if (!$gperm->group_perm(1)) { die(_NOPERM); exit; } // トピックがない場合 $BTopic = new BulletinTopic($mydirname); if (!$BTopic->topicExists()) { die(_MD_NO_TOPICS); exit; } // $op = isset($_POST['op']) ? trim($_POST['op']) : 'form'; $op = isset($_GET['op']) && $_GET['op'] == 'delete' ? 'delete' : $op; // error log $errors = array(); // チケットのチェック require_once dirname(dirname(__FILE__)) . "/include/gtickets.php"; if (!empty($_POST['preview'])) { if (!$xoopsGTicket->check()) { $errors['ticket'] = 'Ticket Error'; $op = 'form'; } else { $op = 'preview'; } } elseif (!empty($_POST['post'])) { if (!$xoopsGTicket->check()) { $errors['ticket'] = 'Ticket Error'; $op = 'form';
$time = time(); $form = new XoopsThemeForm(_MD_SUBMITNEWS, 'storyform', '?page=submit'); if ($storyid > 0) { if ($story->isActiveUser()) { $form->addElement(new XoopsFormLabel(_MD_POSTEDBY, $story->getUname())); } else { $form->addElement(new XoopsFormLabel(_MD_POSTEDBY, $story->getUname() . ' (' . $story->getVar('hostname') . ')')); } } else { $form->addElement(new XoopsFormLabel(_MD_POSTEDBY, XoopsUser::getUnameFromId($my_uid))); } $form->addElement(new XoopsFormText(_MD_TITLE, 'title', 50, 255, $story->getVar('title', 'f')), true); // GIJ //$topic_select = new XoopsFormSelect(_MD_TOPIC, 'topicid', $story->getVar('topicid') ); //$topic_select->addOptionArray(Bulletin::makeCategoryArrayForSelect( $mydirname )); $bt = new BulletinTopic($mydirname); // GIJ $topic_select = new XoopsFormLabel(_MD_TOPIC, $bt->makeTopicSelBox(false, $story->getVar('topicid'), 'topicid')); // GIJ $form->addElement($topic_select); $topicalign_select = new XoopsFormSelect(_MD_TOPIC_IMAGE, 'topicimg', $story->getVar('topicimg')); $topicalign_select->addOptionArray(array('1' => _MD_TOPIC_RIGHT, '2' => _MD_TOPIC_LEFT, '0' => _MD_TOPIC_DISABLE)); $form->addElement($topicalign_select); // bodytext $bodytext_tray = new XoopsFormElementTray(_MD_THESCOOP, ''); if (empty($xoopsModuleConfig['use_fckeditor']) || !$gperm->group_perm(4)) { // XoopsForm Dhtml $bodytext_tray->addElement(new XoopsFormDhtmlTextArea('', 'text', $story->getVar('text', 'f'), $bulletin_post_tray_row, $bulletin_post_tray_col), true); } else { // fckeditor $wysiwyg_header = '
if ($storyid > 0) { if ($story->isActiveUser()) { $xoopsTpl->assign('poster', $story->getUname()); } else { $xoopsTpl->assign('poster', $story->getUname() . ' (' . $story->getVar('hostname') . ')'); } } else { $xoopsTpl->assign('poster', XoopsUser::getUnameFromId($my_uid)); } $xoopsTpl->assign('title', $story->getVar('title', 'e')); $xoopsTpl->assign('title_raw', $story->getVar('title', 'n')); $xoopsTpl->assign('text', $story->getVar('text', 'e')); $xoopsTpl->assign('text_raw', $story->getVar('text', 'n')); $xoopsTpl->assign('bulletin_post_tray_row', $bulletin_post_tray_row); $xoopsTpl->assign('bulletin_post_tray_col', $bulletin_post_tray_col); $bt = new BulletinTopic($mydirname); // GIJ $xoopsTpl->assign('topic_selbox', $bt->makeTopicSelBox(false, $story->getVar('topicid'), 'topicid')); $xoopsTpl->assign('topicimg', $story->getVar('topicimg')); // fckeditor $xoopsTpl->assign('use_fckeditor', !empty($xoopsModuleConfig['use_fckeditor']) && $gperm->group_perm(4)); // if user has right to set date. if ($can_use_date = $gperm->group_perm(3)) { // autodate $xoopsTpl->assign('autodate', $story->getVar('autodate')); $post_date_xf =& new XoopsFormSelectTime('', 'auto', $auto, _MD_DATE_FORMAT); $xoopsTpl->assign('post_date_selector', $post_date_xf->render()); // auto expire $xoopsTpl->assign('autoexpdate', $story->getVar('autoexpdate')); $expire_date_xf =& new XoopsFormSelectTime('', 'autoexp', $autoexp, _MD_DATE_FORMAT); $xoopsTpl->assign('expire_date_selector', $expire_date_xf->render());