function showStr($str) { $auto_arr = array("/\\[img\\](.+?)\\[\\/img\\]/is", "/\\[video\\](.+?)\\[\\/video\\]/is"); $auto_url = array('<img border="0" src="\\1" onError="this.src=\'./images/img_error.gif\'" />', '视频:\\1'); $str = preg_replace($auto_arr, $auto_url, " " . filterHTML($str)); $str = nl2br($str); return $str; }
public function getForum($N = 5) { global $DB, $table_forum; $forumArr = array(); $Query = $DB->query("SELECT `fid`,`name`,`synopsis` FROM `" . $table_forum . "` WHERE `commend` > 0 ORDER BY `commend` DESC LIMIT " . $N); while ($Re = $DB->fetch_array($Query)) { $forumArr[] = array("fid" => $Re['fid'], "name" => stripslashes($Re['name']), "synopsis" => filterHTML($Re['synopsis'])); } return $forumArr; }
function dofreePDF($kunena_db) { global $aro_group; $app =& JFactory::getApplication(); $kunena_acl =& JFactory::getACL(); $kunena_my =& JFactory::getUser(); $fbConfig =& CKunenaConfig::getInstance(); require_once KUNENA_PATH_LIB . DS . 'kunena.authentication.php'; $is_Mod = 0; $catid = JRequest::getInt('catid', 2); if (!$is_admin) { $kunena_db->setQuery("SELECT userid FROM #__fb_moderation WHERE catid='{$catid}' AND userid='{$kunena_my->id}'"); if ($kunena_db->loadResult()) { $is_Mod = 1; } } else { $is_Mod = 1; } //superadmins always are if (!$is_Mod) { //get all the info on this forum: $kunena_db->setQuery("SELECT id, pub_access, pub_recurse, admin_access, admin_recurse FROM #__fb_categories WHERE id='{$catid}'"); $row = $kunena_db->loadObjectList(); check_dberror("Unable to load category detail."); $allow_forum = explode(',', CKunenaTools::getAllowedForums($kunena_my->id, $aro_group->id, $kunena_acl)); } if ($is_Mod || in_array($catid, $allow_forum)) { $id = JRequest::getInt('id', 1); $catid = JRequest::getInt('catid', 2); //first get the thread id for the current post to later on determine the parent post $kunena_db->setQuery("SELECT thread FROM #__fb_messages WHERE id='{$id}' AND catid='{$catid}'"); $threadid = $kunena_db->loadResult(); //load topic post and details $kunena_db->setQuery("SELECT a.*, b.* FROM #__fb_messages AS a, #__fb_messages_text AS b WHERE a.thread='{$threadid}' AND a.catid='{$catid}' AND a.parent='0' AND a.id=b.mesid"); $row = $kunena_db->loadObjectList(); check_dberror("Unable to load message details."); if (file_exists(KUNENA_ROOT_PATH . DS . 'includes/class.ezpdf.php')) { include KUNENA_ROOT_PATH . DS . 'includes/class.ezpdf.php'; $pdf = new Cezpdf('a4', 'P'); //A4 Portrait } elseif (class_exists('JDocument')) { $pdf = new fbpdfwrapper(); } else { echo 'No supported pdf class found!'; exit; } if (empty($row)) { //if the messages doesn't exist don't need to continue //Doesn't work Fatal error: Call to undefined method CKunenaLink::GetKunenaURL() //$app->redirect ( CKunenaLink::GetKunenaURL(true), _KUNENA_PDF_NOT_GENERATED_MESSAGE_DELETED ); } else { $mes_text = $row[0]->message; filterHTML($mes_text); $pdf->ezSetCmMargins(2, 1.5, 1, 1); $pdf->selectFont('./fonts/Helvetica.afm'); //choose font $all = $pdf->openObject(); $pdf->saveState(); $pdf->setStrokeColor(0, 0, 0, 1); // footer $pdf->line(10, 40, 578, 40); $pdf->line(10, 822, 578, 822); $pdf->addText(30, 34, 6, $fbConfig->board_title . ' - ' . $app->getCfg('sitename')); $strtmp = _KUNENA_PDF_VERSION; $strtmp = str_replace('%version%', "NEW VERSION GOES HERE", $strtmp); // TODO: fxstein - Need to change version handling $pdf->addText(250, 34, 6, $strtmp); $strtmp = _KUNENA_PDF_DATE; $strtmp = str_replace('%date%', date('j F, Y, H:i', CKunenaTools::fbGetShowTime()), $strtmp); $pdf->addText(450, 34, 6, $strtmp); $pdf->restoreState(); $pdf->closeObject(); $pdf->addObject($all, 'all'); $pdf->ezSetDy(30); $txt0 = $row[0]->subject; $pdf->ezText($txt0, 14); $pdf->ezText(_VIEW_POSTED . " " . $row[0]->name . " - " . date(_DATETIME, $row[0]->time), 8); $pdf->ezText("_____________________________________", 8); //$pdf->line( 10, 780, 578, 780 ); $txt3 = "\n"; $txt3 .= stripslashes($mes_text); $pdf->ezText($txt3, 10); $pdf->ezText("\n============================================================================\n\n", 8); //now let's try to see if there's more... $kunena_db->setQuery("SELECT a.*, b.* FROM #__fb_messages AS a, #__fb_messages_text AS b WHERE a.catid='{$catid}' AND a.thread='{$threadid}' AND a.id=b.mesid AND a.parent!='0' ORDER BY a.time ASC"); $replies = $kunena_db->loadObjectList(); check_dberror("Unable to load messages & detail."); $countReplies = count($replies); if ($countReplies > 0) { foreach ($replies as $reply) { $mes_text = $reply->message; filterHTML($mes_text); $txt0 = $reply->subject; $pdf->ezText($txt0, 14); $pdf->ezText(_VIEW_POSTED . " " . $reply->name . " - " . date(_DATETIME, $reply->time), 8); $pdf->ezText("_____________________________________", 8); $txt3 = "\n"; $txt3 .= stripslashes($mes_text); $pdf->ezText($txt3, 10); $pdf->ezText("\n============================================================================\n\n", 8); } } $pdf->ezStream(); } } else { echo "You don't have access to this resource."; } }
function dofreePDF() { $kunena_app =& JFactory::getApplication(); $kunena_db =& JFactory::getDBO(); $kunena_acl =& JFactory::getACL(); $kunena_my =& JFactory::getUser(); $kunena_config = KunenaFactory::getConfig(); $catid = JRequest::getInt('catid', 0); $id = JRequest::getInt('id', 0); $limit = JRequest::getInt('limit', 0); $limitstart = JRequest::getInt('limitstart', 0); if ($limit < 1) { $limit = $kunena_config->messages_per_page - 1; } require_once KUNENA_PATH_LIB . '/kunena.timeformat.class.php'; $kunena_session = KunenaFactory::getSession(true); $kunena_session->updateAllowedForums(); $allow_forum = $kunena_session->allowed != '' ? explode(',', $kunena_session->allowed) : array(); if (in_array($catid, $allow_forum) && $id) { //first get the thread id for the current post to later on determine the parent post $kunena_db->setQuery("SELECT thread FROM #__kunena_messages WHERE id={$kunena_db->Quote($id)} AND catid={$kunena_db->Quote($catid)}"); $threadid = $kunena_db->loadResult(); if (KunenaError::checkDatabaseError()) { return; } //load topic post and details $kunena_db->setQuery("SELECT a.*, b.* FROM #__kunena_messages AS a, #__kunena_messages_text AS b WHERE a.thread={$kunena_db->Quote($threadid)} AND a.catid={$kunena_db->Quote($catid)} AND a.parent='0' AND a.id=b.mesid"); $row = $kunena_db->loadObjectList(); if (KunenaError::checkDatabaseError()) { return; } if (file_exists(KUNENA_ROOT_PATH . '/includes/class.ezpdf.php')) { include KUNENA_ROOT_PATH . '/includes/class.ezpdf.php'; $pdf = new Cezpdf('a4', 'P'); //A4 Portrait } elseif (class_exists('JDocument')) { $pdf = new fbpdfwrapper(); } else { echo 'No supported pdf class found!'; exit; } if (empty($row)) { //if the messages doesn't exist don't need to continue echo '<br /><br /><div align="center">' . JText::_('COM_KUNENA_PDF_NOT_GENERATED_MESSAGE_DELETED') . '</div><br /><br />'; echo CKunenaLink::GetAutoRedirectHTML(KunenaRoute::_(KUNENA_LIVEURLREL . '&func=showcat&catid=' . $catid), 3500); } else { $mes_text = $row[0]->message; filterHTML($mes_text); $pdf->ezSetCmMargins(2, 1.5, 1, 1); $pdf->selectFont('./fonts/Helvetica.afm'); //choose font $all = $pdf->openObject(); $pdf->saveState(); $pdf->setStrokeColor(0, 0, 0, 1); // footer $pdf->line(10, 40, 578, 40); $pdf->line(10, 822, 578, 822); $pdf->addText(30, 34, 6, $kunena_config->board_title . ' - ' . $kunena_app->getCfg('sitename')); $strtmp = JText::_('COM_KUNENA_PDF_VERSION'); $strtmp = str_replace('%version%', "NEW VERSION GOES HERE", $strtmp); // TODO: fxstein - Need to change version handling $pdf->addText(250, 34, 6, $strtmp); $strtmp = JText::_('COM_KUNENA_PDF_DATE'); $strtmp = str_replace('%date%', date('j F, Y, H:i', CKunenaTimeformat::internalTime()), $strtmp); $pdf->addText(450, 34, 6, $strtmp); $pdf->restoreState(); $pdf->closeObject(); $pdf->addObject($all, 'all'); $pdf->ezSetDy(30); $txt0 = $row[0]->subject; $pdf->ezText($txt0, 14); $pdf->ezText(JText::_('COM_KUNENA_VIEW_POSTED') . " " . $row[0]->name . " - " . CKunenaTimeformat::showDate($row[0]->time), 8); $pdf->ezText("_____________________________________", 8); //$pdf->line( 10, 780, 578, 780 ); $txt3 = "\n"; $txt3 .= $mes_text; $pdf->ezText($txt3, 10); $pdf->ezText("\n============================================================================\n\n", 8); //now let's try to see if there's more... $query = "SELECT a.*, b.* FROM #__kunena_messages AS a, #__kunena_messages_text AS b WHERE a.catid={$kunena_db->Quote($catid)} AND a.thread={$kunena_db->Quote($threadid)} AND a.id=b.mesid AND a.parent!='0' ORDER BY a.time ASC"; $kunena_db->setQuery($query, $limitstart, $limit); $replies = $kunena_db->loadObjectList(); if (KunenaError::checkDatabaseError()) { return; } $countReplies = count($replies); if ($countReplies > 0) { foreach ($replies as $reply) { $mes_text = $reply->message; filterHTML($mes_text); $txt0 = $reply->subject; $pdf->ezText($txt0, 14); $pdf->ezText(JText::_('COM_KUNENA_VIEW_POSTED') . " " . $reply->name . " - " . CKunenaTimeformat::showDate($reply->time), 8); $pdf->ezText("_____________________________________", 8); $txt3 = "\n"; $txt3 .= $mes_text; $pdf->ezText($txt3, 10); $pdf->ezText("\n============================================================================\n\n", 8); } } $pdf->ezStream(); } } else { echo "You don't have access to this resource."; } }
function getTopic($where, $page, $num) { global $DB, $table_topic; $TopicArr = array(); $Tsql = "SELECT COUNT(`tid`) FROM `" . $table_topic . "` " . $where; $TotalTopic = $DB->fetch_one($Tsql); if ($TotalTopic > 0) { $RSql = "SELECT * FROM `" . $table_topic . "` " . $where . " ORDER BY `tid` DESC LIMIT " . ($page - 1) * $num . "," . $num; $Result = $DB->query($RSql); while ($Re = $DB->fetch_array($Result)) { $TopicArr[] = array("tid" => $Re['tid'], "fid" => $Re['fid'], "author" => stripslashes($Re['author']), "authorid" => $Re['authorid'], "authorico" => $Re['authorico'], "title" => filterHTML($Re['subject']), "subject" => Truncate(filterHTML($Re['subject']), 84), "dateline" => $Re['dateline'], "lasttime" => getCountDown($Re['lasttime']), "lastauthor" => stripslashes($Re['lastauthor']), "lastauthorid" => $Re['lastauthorid'], "lastauthorico" => $Re['lastauthorico'], "views" => $Re['views'], "replies" => $Re['replies'], "stick" => $Re['stick'], "digest" => $Re['digest'], "lockout" => $Re['lockout']); } } $return['Total'] = $TotalTopic; $return['Topic'] = $TopicArr; $return['Page'] = $this->Pagination($TotalTopic, $num, $page); return $return; }
$forumArr['dateline'] = time(); $forumArr['ipaddress'] = $userIP; if ($DB->query($DB->insert_sql("`" . $table_temp . "`", $forumArr))) { echo "2 该吧已成功创建,请耐心等待管理员的审核!"; } else { echo "0 数据库繁忙,请稍候再试!"; } } } $DB->close(); } } } } else { if (isset($_GET['name']) && !empty($_GET['name'])) { $searchWord = trim(filterHTML($_GET['name'], false)); } else { $searchWord = ""; } $DB->connect($mysql_host, $mysql_user, $mysql_pass, $mysql_dbname); $category = MainAction::getCategory(); $DB->close(); unset($DB, $TB); $tmp = template("create.html"); $tmp->assign('codeName', $code_name); $tmp->assign('codeVersion', $code_version); $tmp->assign('siteName', $site_name); $tmp->assign('siteDomain', $site_domain); $tmp->assign('siteCatalog', $site_catalog); $tmp->assign('siteIcp', $site_icp); $tmp->assign('createAllow', $create_allow);
// If the user submitted some text, we want to show the output screen (this is specific to this demo page..) // if (isset($_POST['content'])) { // // Get the background color for the document from obedit (if present, otherwise, default to white). // $bgColor = (isset($_POST['bgColor']) && preg_match("#[0-9A-F]{3,6}#i", $_POST['bgColor'])) ? trim($_POST['bgColor']) : "FFFFFF"; // // Filter the HTML and store it in a variable (for use in the output below). // You can of course simply echo the output of the filterHTML() function directly to the browser. // $filteredHTML = ""; $filteredHTML = filterHTML($_POST['content']); ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>obedit v3.0 / Output Filter Test</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> <!-- /*********************************** Page Background Color comes from obedit ************************************/
} else { if (!empty($keyword) && $_GET['tb'] == 3) { $DB->connect($mysql_host, $mysql_user, $mysql_pass, $mysql_dbname); $userId = $DB->fetch_one("SELECT `uid` FROM `" . $table_member . "` WHERE lower(`name`)='" . strtolower($keyword) . "'"); $DB->close(); header("location:./search.php?wd=" . urlencode(filterHTML($keyword, false)) . "&tb=4&id=" . $userId); } else { if (!empty($keyword) && $_GET['tb'] == 2) { $searchWord = filterHTML($keyword, false); $searchType = 2; $DB->connect($mysql_host, $mysql_user, $mysql_pass, $mysql_dbname); $searchArr = $TB->searchTopic("`subject` LIKE '%" . $keyword . "%'", $page, $per_topic_num); $DB->close(); } else { if (!empty($keyword) && $_GET['tb'] == 4 && isset($_GET['id'])) { $searchWord = filterHTML($keyword, false); $searchType = 3; if (is_numeric($_GET['id']) && $_GET['id'] >= 1) { $DB->connect($mysql_host, $mysql_user, $mysql_pass, $mysql_dbname); $searchArr = $TB->searchTopic("`authorid` = '" . $_GET['id'] . "'", $page, $per_topic_num); $DB->close(); } else { $searchArr = array("TopicNum" => 0, "Topic" => array(), "Page" => array()); } } } } } $endTime = microtime(true); $searchTime = round($endTime - $startTime, 3); if (isset($searchArr)) {
function getPostInfo($pid) { global $DB, $table_post; $Re = $DB->fetch_one_array("SELECT * FROM `" . $table_post . "` WHERE `pid` = " . $pid); $replyInfo = array("pid" => $Re['pid'], "fid" => $Re['fid'], "tid" => $Re['tid'], "replyfloor" => $Re['replyfloor'], "author" => stripslashes($Re['author']), "authorid" => $Re['authorid'], "authorico" => $Re['authorico'], "guestname" => $Re['guestname'], "subject" => filterHTML($Re['subject']), "dateline" => date('Y.m.d H:i:s', $Re['dateline']), "postip" => $Re['postip'], "up" => $Re['up'], "down" => $Re['down'], "wave" => $Re['wave']); return $replyInfo; }