function transfer_pm(&$data) { global $xoopsModule, $xoopsConfig, $xoopsUser, $xoopsModuleConfig; global $xoopsLogger, $xoopsOption, $xoopsTpl, $xoopsblock; $_config = require(dirname(__FILE__)."/config.php"); $hiddens["to_userid"] = $data["uid"]; $hiddens["subject"] = $data["title"]; $content = str_replace("<br />", "\n\r", $data["content"]); $content = str_replace("<br>", "\n\r", $content); $content = "[quote]\n".forum_html2text($content)."\n[/quote]"; $content = $data["title"]."\n\r".$content."\n\r\n\r"._MORE."\n\r".$data["url"]; $hiddens["message"] = $content; include XOOPS_ROOT_PATH."/header.php"; if(!empty($_config["module"]) && is_dir(XOOPS_ROOT_PATH."/modules/".$_config["module"])){ $action = XOOPS_URL."/modules/".$_config["module"]."/pmlite.php"; }else{ $action = XOOPS_URL."/pmlite.php?send2=1&to_userid=".$data["uid"]; } xoops_confirm($hiddens, $action, $_config["title"]); $GLOBALS["xoopsOption"]['output_type'] = "plain"; include XOOPS_ROOT_PATH."/footer.php"; exit(); }
function transfer_email(&$data) { global $xoopsModule, $xoopsConfig, $xoopsUser, $xoopsModuleConfig; global $xoopsLogger, $xoopsOption, $xoopsTpl, $xoopsblock; $_config = require(dirname(__FILE__)."/config.php"); include XOOPS_ROOT_PATH."/header.php"; require_once(XOOPS_ROOT_PATH . "/class/xoopsformloader.php"); $content = str_replace("<br />", "\n", $data["content"]); $content = str_replace("<br>", "\n", $content); $content = forum_html2text($content); $content = $data["title"]."\n".$content."\n\n"._MORE."\n".$data["url"]; $form_email = new XoopsThemeForm(_MD_TRANSFER_EMAIL, "formemail", XOOPS_URL."/modules/".$GLOBALS["xoopsModule"]->getVar("dirname")."/class/transfer/email/action.email.php"); $form_email->addElement(new XoopsFormText(_MD_TRANSFER_EMAIL_ADDRESS, "email", 50, 100), true); $form_email->addElement(new XoopsFormText(_MD_TRANSFER_EMAIL_TITLE, "title", 50, 255, $data["title"]), true); $form_email->addElement(new XoopsFormTextArea(_MD_TRANSFER_EMAIL_CONTENT, "content", $content, 10, 60), true); $form_email->addElement(new XoopsFormButton("", "email_submit", _SUBMIT, "submit")); $form_email->display(); $GLOBALS["xoopsOption"]['output_type'] = "plain"; include XOOPS_ROOT_PATH."/footer.php"; exit(); }
function buildDigest(&$digest) { global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig; if (!defined('SUMMARY_LENGTH')) define('SUMMARY_LENGTH', 100); $forum_handler = &xoops_getmodulehandler('forum', 'xforum'); $thisUser = $xoopsUser; $xoopsUser = null; // To get posts accessible by anonymous $access_forums = $forum_handler->getForums(0, 'access'); // get all accessible forums $xoopsUser = $thisUser; $forum_criteria = ' AND t.forum_id IN (' . implode(',', array_keys($access_forums)) . ')'; unset($access_forums); $approve_criteria = ' AND t.approved = 1 AND p.approved = 1'; $time_criteria = ' AND t.digest_time > ' . $this->last_digest; $karma_criteria = ($xoopsModuleConfig['enable_karma'])? " AND p.post_karma=0":""; $reply_criteria = ($xoopsModuleConfig['allow_require_reply'])? " AND p.require_reply=0":""; $query = 'SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_time, t.digest_time, p.uid, p.poster_name, pt.post_text FROM ' . $this->db->prefix('xf_topics') . ' t, ' . $this->db->prefix('xf_posts_text') . ' pt, ' . $this->db->prefix('xf_posts') . ' p WHERE t.topic_digest = 1 AND p.topic_id=t.topic_id AND p.pid=0 ' . $forum_criteria . $approve_criteria . $time_criteria . $karma_criteria . $reply_criteria . ' AND pt.post_id=p.post_id ORDER BY t.digest_time DESC'; if (!$result = $this->db->query($query)) { //echo "<br />No result:<br />$query"; return false; } $rows = array(); $users = array(); while ($row = $this->db->fetchArray($result)) { $users[$row['uid']] = 1; $rows[] = $row; } if (count($rows) < 1) { return false; } $uids = array_keys($users); if (count($uids) > 0) { $member_handler = &xoops_gethandler('member'); $user_criteria = new Criteria('uid', "(" . implode(',', $uids) . ")", 'IN'); $users = $member_handler->getUsers(new Criteria('uid', "(" . implode(',', $uids) . ")", 'IN'), true); } else { $users = array(); } foreach($rows as $topic) { if ($topic['uid'] > 0) { if (isset($users[$topic['uid']]) && (is_object($users[$topic['uid']])) && ($users[$topic['uid']]->isActive())) { $topic['uname'] = $users[$topic['uid']]->getVar('uname'); } else { $topic['uname'] = $xoopsConfig['anonymous']; } } else { $topic['uname'] = $topic['poster_name']?$topic['poster_name']:$xoopsConfig['anonymous']; } $summary = xoops_substr(forum_html2text($topic['post_text']), 0, SUMMARY_LENGTH); $author = $topic['uname'] . " (" . formatTimestamp($topic['topic_time']) . ")"; $link = XOOPS_URL . "/modules/" . $xoopsModule->dirname() . '/viewtopic.php?topic_id=' . $topic['topic_id'] . '&forum=' . $topic['forum_id']; $title = $topic['topic_title']; $digest->addItem($title, $link, $author, $summary); } $digest->buildContent(); return true; }
function getAllTopics(&$xforum, $startdate, $start, $sortname, $sortorder, $type = '', $excerpt = 0) { global $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $xforumImage, $xforumUrl, $myts, $xoopsUser, $viewall_forums; include_once XOOPS_ROOT_PATH.'/modules/xforum/include/functions.php'; $UserUid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : null; $topic_lastread = forum_getcookie('LT', true); if (is_object($xforum)) { $criteria_forum = ' AND t.forum_id = ' . $xforum->getVar('forum_id'); $hot_threshold = $xforum->getVar('hot_threshold'); $allow_subject_prefix = $xforum->getVar('allow_subject_prefix'); } else { $hot_threshold = 10; $allow_subject_prefix = 0; if (is_array($xforum) && count($xforum) > 0){ $criteria_forum = ' AND t.forum_id IN (' . implode(',', array_keys($xforum)) . ')'; }elseif(!empty($xforum)){ $criteria_forum = ' AND t.forum_id ='.intval($xforum); }else{ $criteria_forum = ''; } } $sort = array(); $criteria_post = ' p.post_time > ' . $startdate; $criteria_extra = ''; $criteria_approve = ' AND t.approved = 1 AND p.approved = 1'; $post_on = ' p.post_id = t.topic_last_post_id'; //$post_criteria = ''; $leftjoin = ' LEFT JOIN ' . $this->db->prefix('xf_posts') . ' p ON p.post_id = t.topic_last_post_id'; switch ($type) { case 'digest': $criteria_extra = ' AND t.topic_digest = 1'; break; case 'unreplied': $criteria_extra = ' AND t.topic_replies < 1'; break; case 'unread': //$time_criterion = max($GLOBALS['last_visit'], $startdate); if(empty($xoopsModuleConfig["read_mode"])){ }elseif($xoopsModuleConfig["read_mode"] ==2){ $leftjoin .= ' LEFT JOIN ' . $this->db->prefix('xf_reads_topic') . ' r ON r.read_item = t.topic_id'; $criteria_post .= ' AND (r.read_id IS NULL OR r.post_id < t.topic_last_post_id)'; }elseif($xoopsModuleConfig["read_mode"] == 1){ $topics = array(); $topic_lastread = forum_getcookie('LT', true); if(count($topic_lastread)>0) foreach($topic_lastread as $id=>$time){ if($time > $time_criterion) $topics[] = $id; } if(count($topics)>0){ $criteria_extra = ' AND t.topic_id NOT IN ('.implode(",", $topics).')'; } $criteria_post = ' p.post_time > ' . max($GLOBALS['last_visit'], $startdate); } break; case 'pending': $post_on = ' p.topic_id = t.topic_id'; $criteria_post .= ' AND p.pid=0'; $criteria_approve = ' AND t.approved = 0'; break; case 'deleted': $criteria_approve = ' AND t.approved = -1'; break; case 'all': // For viewall.php; do not display sticky topics at first case 'active': // same as "all" //$criteria_post = ' p.post_time > ' . $startdate; break; default: $criteria_post = ' (p.post_time > ' . $startdate . ' OR t.topic_sticky=1)'; $sort[] = 't.topic_sticky DESC'; break; } $select = 't.*, '. ' p.post_time as last_post_time, p.poster_name as last_poster_name, p.icon, p.post_id, p.uid'; $from = $this->db->prefix("xf_topics") . ' t '.$leftjoin; $where = $criteria_post. $criteria_forum . $criteria_extra . $criteria_approve; if($excerpt){ $select .=', p.post_karma, p.require_reply, pt.post_text'; $from .= ' LEFT JOIN ' . $this->db->prefix('xf_posts_text') . ' pt ON pt.post_id = t.topic_last_post_id'; } if($sortname == "u.uname"){ $sortname = "t.topic_poster"; } $sort[] = trim($sortname.' '.$sortorder); $sort = implode(", ", $sort); if(empty($sort)) $sort = 'p.post_time DESC'; $sql = 'SELECT '.$select. ' FROM '.$from. ' WHERE '.$where. ' ORDER BY '.$sort; if (!$result = $this->db->query($sql, $xoopsModuleConfig['topics_per_page'], $start)) { redirect_header('index.php', 2, _MD_ERROROCCURED . '<br />' . $sql); exit(); } $subject_array = array(); if(!empty($allow_subject_prefix) && !empty($xoopsModuleConfig['subject_prefix'])): $subjectpres = explode(',', $xoopsModuleConfig['subject_prefix']); if (count($subjectpres) > 1) { foreach($subjectpres as $subjectpre) { $subject_array[] = $subjectpre." "; } } endif; $subject_array[0] = null; $sticky = 0; $topics = array(); $posters = array(); $reads = array(); while ($myrow = $this->db->fetchArray($result)) { if ($myrow['topic_sticky']) { $sticky++; } // ------------------------------------------------------ // topic_icon: priority: sticky -> digest -> regular if ($myrow['topic_haspoll']) { if ($myrow['topic_sticky']) { $topic_icon = forum_displayImage($xforumImage['folder_sticky'], _MD_TOPICSTICKY) . '<br />' . forum_displayImage($xforumImage['poll'], _MD_TOPICHASPOLL); }else{ $topic_icon = forum_displayImage($xforumImage['poll'], _MD_TOPICHASPOLL); } }elseif($myrow['topic_sticky']) { $topic_icon = forum_displayImage($xforumImage['folder_sticky'], _MD_TOPICSTICKY); }elseif (!empty($myrow['icon'])) { $topic_icon = '<img src="' . XOOPS_URL . '/images/subject/' . htmlspecialchars($myrow['icon']) . '" alt="" />'; } else { $topic_icon = '<img src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" />'; } // ------------------------------------------------------ // rating_img $rating = number_format($myrow['rating'] / 2, 0); $rating_img = forum_displayImage($xforumImage[($rating < 1)?'blank':'rate' . $rating]); // ------------------------------------------------------ // topic_page_jump $topic_page_jump = ''; $topic_page_jump_icon = ''; $totalpages = ceil(($myrow['topic_replies'] + 1) / $xoopsModuleConfig['posts_per_page']); if ($totalpages > 1) { $topic_page_jump .= ' '; $append = false; for ($i = 1; $i <= $totalpages; $i++) { if ($i > 3 && $i < $totalpages) { if(!$append){ $topic_page_jump .= "..."; $append = true; } } else { $topic_page_jump .= '[<a href="'.XOOPS_URL.'/modules/xforum/'.'viewtopic.php?topic_id=' . $myrow['topic_id'] . '&start=' . (($i - 1) * $xoopsModuleConfig['posts_per_page']) . '">' . $i . '</a>]'; $topic_page_jump_icon = "<a href='" . XOOPS_URL . "/modules/xforum/viewtopic.php?topic_id=" . $myrow['topic_id'] . "&start=" . (($i - 1) * $xoopsModuleConfig['posts_per_page']) . "#forumpost" . $myrow['post_id'] . "'>" . forum_displayImage($xforumImage['docicon']) . "</a>"; } } } else { $topic_page_jump_icon = "<a href='" . XOOPS_URL . "/modules/xforum/viewtopic.php?topic_id=" . $myrow['topic_id'] . "#forumpost" . $myrow['post_id'] . "'>" . forum_displayImage($xforumImage['docicon']) . "</a>"; } // ------------------------------------------------------ // => topic array if (is_object($viewall_forums[$myrow['forum_id']])){ $forum_link = '<a href="' . XOOPS_URL . '/modules/xforum/viewforum.php?forum=' . $myrow['forum_id'] . '">' . $viewall_forums[$myrow['forum_id']]->getVar('forum_name') . '</a>'; }else { $forum_link = ''; } $topic_title = $myts->htmlSpecialChars($myrow['topic_title']); if ($myrow['topic_digest']) $topic_title = "<span class='digest'>" . $topic_title . "</span>"; if( $excerpt == 0 ){ $topic_excerpt = ""; }elseif( ($myrow['post_karma']>0 || $myrow['require_reply']>0) && !forum_isAdmin($xforum) ){ $topic_excerpt = ""; }else{ $topic_excerpt = xoops_substr(forum_html2text($myts->displayTarea($myrow['post_text'])), 0, $excerpt); $topic_excerpt = str_replace("[", "[", $myts->htmlSpecialChars($topic_excerpt)); } $topic_subject = ($allow_subject_prefix)?$subject_array[$myrow['topic_subject']]:""; $topics[$myrow['topic_id']] = array( 'topic_id' => $myrow['topic_id'], 'topic_icon' => $topic_icon, //'topic_folder' => forum_displayImage($topic_folder), 'topic_title' => $topic_subject.$topic_title, 'topic_link' => XOOPS_URL.'/modules/xforum/'.'viewtopic.php?topic_id=' . $myrow['topic_id'] . '&forum=' . $myrow['forum_id'], 'rating_img' => $rating_img, 'topic_page_jump' => $topic_page_jump, 'topic_page_jump_icon' => $topic_page_jump_icon, 'topic_replies' => $myrow['topic_replies'], 'topic_poster_uid' => $myrow['topic_poster'], 'topic_poster_name' => $myts->htmlSpecialChars( ($myrow['poster_name'])?$myrow['poster_name']:$xoopsConfig['anonymous']), 'topic_views' => $myrow['topic_views'], 'topic_time' => forum_formatTimestamp($myrow['topic_time']), 'topic_last_posttime' => forum_formatTimestamp($myrow['last_post_time']), 'topic_last_poster_uid' => $myrow['uid'], 'topic_last_poster_name' => $myts->htmlSpecialChars( ($myrow['last_poster_name'])?$myrow['last_poster_name']:$xoopsConfig['anonymous']), 'topic_forum_link' => $forum_link, 'topic_excerpt' => $topic_excerpt, 'stick' => empty($myrow['topic_sticky']), "stats" => array($myrow['topic_status'], $myrow['topic_digest'], $myrow['topic_replies']), ); /* users */ $posters[$myrow['topic_poster']] = 1; $posters[$myrow['uid']] = 1; // reads if(!empty($xoopsModuleConfig["read_mode"])){ $reads[$myrow['topic_id']] = ($xoopsModuleConfig["read_mode"] == 1)?$myrow['last_post_time']:$myrow["topic_last_post_id"]; } } $posters_name =& forum_getUnameFromIds(array_keys($posters), $xoopsModuleConfig['show_realname'], true); $topic_isRead = forum_isRead("topic", $reads); foreach(array_keys($topics) as $id){ $topics[$id]["topic_poster"] = !empty($posters_name[$topics[$id]["topic_poster_uid"]])? $posters_name[$topics[$id]["topic_poster_uid"]] :$topics[$id]["topic_poster_name"]; $topics[$id]["topic_last_poster"] = !empty($posters_name[$topics[$id]["topic_last_poster_uid"]])? $posters_name[$topics[$id]["topic_last_poster_uid"]] :$topics[$id]["topic_last_poster_name"]; // ------------------------------------------------------ // topic_folder: priority: newhot -> hot/new -> regular list($topic_status, $topic_digest, $topic_replies) = $topics[$id]["stats"]; if ($topic_status == 1) { $topic_folder = $xforumImage['locked_topic']; } else { if ($topic_digest) $topic_folder = $xforumImage['folder_digest']; elseif ($topic_replies >= $hot_threshold) { if(empty($topic_isRead[$id])){ $topic_folder = $xforumImage['hot_newposts_topic']; } else { $topic_folder = $xforumImage['hot_folder_topic']; } } else { if(empty($topic_isRead[$id])){ $topic_folder = $xforumImage['newposts_topic']; } else { $topic_folder = $xforumImage['folder_topic']; } } } $topics[$id]['topic_folder'] = forum_displayImage($topic_folder); unset($topics[$id]["topic_poster_name"], $topics[$id]["topic_last_poster_name"], $topics[$id]["stats"]); } if ( count($topics) > 0) { $sql = " SELECT DISTINCT topic_id FROM " . $this->db->prefix("xf_posts"). " WHERE attachment != ''". " AND topic_id IN (" . implode(',', array_keys($topics)) . ")"; if($result = $this->db->query($sql)) { while (list($topic_id) = $this->db->fetchRow($result)) { $topics[$topic_id]['attachment'] = ' ' . forum_displayImage($xforumImage['clip'], _MD_TOPICSHASATT); } } } return array($topics, $sticky); }
}else{ $forum_id = $xforumtopic->getVar('forum_id'); $viewtopic_forum =& $forum_handler->get($forum_id); if (!$forum_handler->getPermission($viewtopic_forum)){ $message = _MD_NORIGHTTOACCESS; }elseif(!$topic_handler->getPermission($viewtopic_forum, $xforumtopic->getVar('topic_status'), "view")){ $message = _MD_NORIGHTTOVIEW; }else{ $post = & $post_handler->get($post_id); if(!$post->getVar('approved')){ $message = _MD_NORIGHTTOVIEW; }else{ $post_data = $post_handler->getPostForPrint($post); $postdata = str_replace("<br />", "\n\r", $post_data["text"]); $postdata = str_replace("<br>", "\n\r", $postdata); $postdata = "[quote]\n".forum_html2text($postdata)."\n[/quote]"; } } } } $msg = empty($message)?$myts->displayTarea($postdata):$message; include_once(XOOPS_ROOT_PATH."/class/xoopsformloader.php"); $pmform = new XoopsThemeForm(_MD_PM, 'pmform', XOOPS_URL."/modules/pm/pmlite.php", 'post'); $pmform->addElement(new XoopsFormLabel(_MD_MESSAGEC, $msg)); $button_tray = new XoopsFormElementTray(''); if(isset($postdata)){ $button_tray->addElement(new XoopsFormButton('', 'sendmod', _SUBMIT, 'submit')); $pmform->addElement(new XoopsFormHidden('to_userid', $post->getVar('uid'))); $pmform->addElement(new XoopsFormHidden('post_id', $post_id)); $pmform->addElement(new XoopsFormHidden('subject', $post->getVar('subject')));
function b_forum_post_show($options) { global $xoopsConfig; global $access_forums; $db = &Database::getInstance(); $myts = &MyTextSanitizer::getInstance(); $block = array(); $i = 0; $order = ""; $extra_criteria = ""; $time_criteria = null; if(!empty($options[2])) { $time_criteria = time() - forum_getSinceTime($options[2]); $extra_criteria = " AND p.post_time>".$time_criteria; } switch ($options[0]) { case "text": if(!empty($xforumConfig['enable_karma'])) $extra_criteria .= " AND p.post_karma = 0"; if(!empty($xforumConfig['allow_require_reply'])) $extra_criteria .= " AND p.require_reply = 0"; default: $order = 'p.post_time'; break; } $xforumConfig = getConfigForBlock(); if(!isset($access_forums)){ $forum_handler = &xoops_getmodulehandler('forum', 'xforum'); if(!$access_obj =& $forum_handler->getForums(0, 'access', array('forum_id', 'cat_id', 'forum_type')) ){ return null; } $access_forums = array_keys( $access_obj ); // get all accessible forums unset($access_obj ); } if (!empty($options[6])) { $allowedforums = array_filter(array_slice($options, 6), "b_forum_array_filter"); // get allowed forums $allowed_forums = array_intersect($allowedforums, $access_forums); }else{ $allowed_forums = $access_forums; } $forum_criteria = ' AND p.forum_id IN (' . implode(',', $allowed_forums) . ')'; $approve_criteria = ' AND p.approved = 1'; $query = 'SELECT'; $query .= ' p.post_id, p.subject, p.post_time, p.icon, p.uid, p.poster_name,'; if($options[0]=="text"){ $query .= ' p.dohtml, p.dosmiley, p.doxcode, p.dobr, pt.post_text,'; } $query .= ' f.forum_id, f.forum_name, f.allow_subject_prefix'. ' FROM ' . $db->prefix('xf_posts') . ' AS p '. ' LEFT JOIN ' . $db->prefix('xf_forums') . ' AS f ON f.forum_id=p.forum_id'; if($options[0]=="text"){ $query .= ' LEFT JOIN ' . $db->prefix('xf_posts_text') . ' AS pt ON pt.post_id=p.post_id'; } $query .= ' WHERE 1=1 ' . $forum_criteria . $approve_criteria . $extra_criteria . ' ORDER BY ' . $order . ' DESC'; $result = $db->query($query, $options[1], 0); if (!$result) { forum_message("xforum block query error: ".$query); return false; } $block['disp_mode'] = ($options[0]=="text")?3:$options[3]; // 0 - full view; 1 - compact view; 2 - lite view; $rows = array(); $author = array(); while ($row = $db->fetchArray($result)) { $rows[] = $row; $author[$row["uid"]] = 1; } if (count($rows) < 1) return false; $author_name = forum_getUnameFromIds(array_keys($author), $xforumConfig['show_realname'], true); foreach ($rows as $arr) { //if ($arr['icon'] && is_file(XOOPS_ROOT_PATH . "/images/subject/" . $arr['icon'])) { if (!empty($arr['icon'])) { $last_post_icon = '<img src="' . XOOPS_URL . '/images/subject/' . htmlspecialchars($arr['icon']) . '" alt="" />'; } else { $last_post_icon = '<img src="' . XOOPS_URL . '/images/subject/icon1.gif" alt="" />'; } //$topic['jump_post'] = "<a href='" . XOOPS_URL . "/modules/xforum/viewtopic.php?post_id=" . $arr['post_id'] ."#forumpost" . $arr['post_id'] . "'>" . $last_post_icon . "</a>"; $topic['forum_id'] = $arr['forum_id']; $topic['forum_name'] = $myts->htmlSpecialChars($arr['forum_name']); //$topic['id'] = $arr['topic_id']; $title = $myts->htmlSpecialChars($arr['subject']); if($options[0]!="text" && !empty($options[5])) { $title = xoops_substr($title, 0, $options[5]); } $topic['title'] = $title; $topic['post_id'] = $arr['post_id']; $topic['time'] = forum_formatTimestamp($arr['post_time']); if (!empty($author_name[$arr['uid']])) { $topic_poster = $author_name[$arr['uid']]; } else { $topic_poster = $myts->htmlSpecialChars( ($arr['poster_name'])?$arr['poster_name']:$GLOBALS["xoopsConfig"]["anonymous"] ); } $topic['topic_poster'] = $topic_poster; if($options[0]=="text"){ $post_text = $myts->displayTarea($arr['post_text'],$arr['dohtml'],$arr['dosmiley'],$arr['doxcode'],1,$arr['dobr']); if(!empty($options[5])){ $post_text = xoops_substr(forum_html2text($post_text), 0, $options[5]); } $topic['post_text'] = $post_text; } $block['topics'][] = $topic; unset($topic); } $block['indexNav'] = intval($options[4]); return $block; }
function transfer_dokuwiki(&$data) { global $xoopsModule, $xoopsConfig, $xoopsUser, $xoopsModuleConfig; global $xoopsLogger, $xoopsOption, $xoopsTpl, $xoopsblock; $_config = require(dirname(__FILE__)."/config.php"); $hiddens["id"] = $_config["namespace"].":".$_config["prefix"].$data["id"]; $content = MyTextSanitizer::nl2Br($data["content"]); // Comment open: we need a lite html2wiki convertor $content = str_replace("<br />", "\\\\ ", $content); $content = str_replace("<br>", "\\\\ ", $content); $content = preg_replace_callback("/<a[\s]+href=(['\"]?)([^\"'<>]*)\\1[^>]*>([^<]*)<\/a>/imu", "transfer_parse_html_to_wiki", $content); $content = preg_replace_callback("/<img[\s]+src=(['\"]?)([^\"'<>]*)\\1[\s]+(alt=(['\"]?)([^\"'<>]*)\\3)?[^>]*>/imu", "transfer_parse_img_to_wiki", $content); $content = forum_html2text($content); // Comment close; $hiddens["wikitext"] = "=====".$data["title"]."===== \n". $content . "\\\\ \\\\ [[".$data["url"]."|".$data["title"].": "._MORE."]]"; $hiddens["summary"] = $data["title"]; $hiddens["do"] = "preview"; include XOOPS_ROOT_PATH."/header.php"; require_once(XOOPS_ROOT_PATH . "/class/xoopsformloader.php"); $form_dokuwiki = new XoopsThemeForm(_MD_TRANSFER_DOKUWIKI, "formdokuwiki", XOOPS_URL."/modules/".$_config["module"]."/doku.php"); foreach(array_keys($hiddens) as $key){ $form_dokuwiki->addElement(new XoopsFormHidden($key, str_replace("'", "'",$hiddens[$key]))); } $namespace_option_tray = new XoopsFormElementTray(_MD_TRANSFER_DOKUWIKI_NAMESPACE, "<br />"); require XOOPS_ROOT_PATH."/modules/".$_config["module"]."/inc/init.php"; $dir_array =& transfer_getDirListAsArray($conf["datadir"], $_config["namespace_skip"]); $dir_array = array_merge(array(0=>_NONE), $dir_array); $namespace_select = new XoopsFormSelect(_SELECT, "namespace_sel", "transfer"); $namespace_select->addOptionArray($dir_array); $namespace_option_tray->addElement($namespace_select); $namespace_option_tray->addElement(new XoopsFormText(_ADD, "namespace_new", 50, 100)); $form_dokuwiki->addElement($namespace_option_tray); $form_dokuwiki->addElement(new XoopsFormText(_MD_TRANSFER_DOKUWIKI_NAME, "name", 50, 255, $_config["prefix"].$data["id"])); $submit_button = new XoopsFormButton("", "ok", _SUBMIT, "button"); $submit_button->setExtra('onclick=" var namespace = escape(\''.$_config["namespace"].'\'); var name = escape(\''.$_config["prefix"].$data["id"].'\'); var changed = 0; if(window.document.formdokuwiki.name.value.length>0){ name = window.document.formdokuwiki.name.value; changed = 1; } if(window.document.formdokuwiki.namespace_new.value.length>0){ namespace = window.document.formdokuwiki.namespace_new.value; changed = 1; }else{ var namespace_sel = window.document.formdokuwiki.namespace_sel.options[window.document.formdokuwiki.namespace_sel.selectedIndex].value; if(namespace_sel != namespace){ namespace = namespace_sel; changed = 1; } } if(changed ==1){ window.document.formdokuwiki.id.value = null; if(namespace !=0) window.document.formdokuwiki.id.value = namespace+\':\'; window.document.formdokuwiki.id.value += name; } window.document.formdokuwiki.submit(); "'); $cancel_button = new XoopsFormButton('', 'cancel', _CANCEL, 'button'); $button_tray = new XoopsFormElementTray(""); $button_tray->addElement($submit_button); $button_tray->addElement($cancel_button); $form_dokuwiki->addElement($button_tray); $form_dokuwiki->display(); $GLOBALS["xoopsOption"]['output_type'] = "plain"; include XOOPS_ROOT_PATH."/footer.php"; exit(); }