function print_entry($row) { global $page, $system_courses, $forum_info; static $counter; $counter++; ?> <script type="text/javascript"> /* // script to control popin reply/edit boxs, disabled for now due to ID conflicts jQuery(document).ready( function () { $("a#reply-<?php echo $row['post_id']; ?> ").click(function() { $("div#reply-<?php echo $row['post_id']; ?> ").toggle('slow'); return false; }); $("a#reply-<?php echo $row['post_id']; ?> ").keypress(function(e) { var code = e.keyCode || e.which; if(code == 13 || code == 32) { $("div#reply-<?php echo $row['post_id']; ?> ").toggle('slow'); $("div#reply-<?php echo $row['post_id']; ?> #subject" ).focus(); return false; } }); $("a#edit-<?php echo $row['post_id']; ?> ").click(function() { $("div#edit-<?php echo $row['post_id']; ?> ").toggle('slow'); return false; }); $("a#edit-<?php echo $row['post_id']; ?> ").keypress(function(e) { var code = e.keyCode || e.which; if(code == 13 || code == 32) { $("div#edit-<?php echo $row['post_id']; ?> ").toggle('slow'); $("div#edit-<?php echo $row['post_id']; ?> #subject" ).focus(); return false; } }); }); */ </script> <?php $reply_link = '<a href="#" id="reply-' . $row['post_id'] . '">'; $reply_link = '<a href="mods/_standard/forums/forum/view.php?fid=' . $row['forum_id'] . SEP . 'pid='; if ($row['parent_id'] == 0) { $reply_link .= $row['post_id']; } else { $reply_link .= $row['parent_id']; } //$reply_link .= SEP.'reply='.$row['post_id'].SEP.'page='.$page.'#post" >'; $reply_link .= '#post" onClick="javascript:document.getElementById(\'subject\').value = \'Re: ' . $row['subject'] . '\'; " >'; $reply_link .= '<img src="images/forum/forum_reply.png" alt="' . _AT('reply') . '" title="' . _AT('reply') . '"/></a>'; ?> <li class="<?php if ($counter % 2) { echo 'odd'; } else { echo 'even'; } ?> "> <a name="<?php echo $row['post_id']; ?> "></a> <div class="forum-post-author"> <a href="profile.php?id=<?php echo $row['member_id']; ?> " class="title"><?php echo htmlspecialchars(get_display_name($row['member_id'])); ?> </a><br /> <?php print_profile_img($row['member_id']); ?> </div> <div class="forum-post-content"> <h3><?php echo AT_print($row['subject'], 'forums_threads.subject'); ?> </h3> <div> <div class="forum-post-ctrl"> <?php if (authenticate(AT_PRIV_FORUMS, AT_PRIV_RETURN)) { ?> <?php echo $reply_link; ?> <a href="mods/_standard/forums/edit_post.php?fid=<?php echo $row['forum_id'] . SEP . 'pid=' . $row['post_id']; ?> "><img src="images/forum/forum_edit.png" alt="<?php echo _AT('edit'); ?> " title="<?php echo _AT('edit'); ?> "/></a> <a href="mods/_standard/forums/forum/delete_thread.php?fid=<?php echo $row['forum_id'] . SEP . 'pid=' . $row['post_id'] . SEP . 'ppid=' . $row['parent_id'] . SEP; ?> nest=1"><img src="images/forum/forum_delete.png" alt="<?php echo _AT('delete'); ?> " title="<?php echo _AT('delete'); ?> "/></a> <!-- <?php echo $reply_link; ?> <a href="#" id="edit-<?php echo $row['post_id']; ?> "><img src="images/forum/forum_edit.png" alt="<?php echo _AT('edit'); ?> " title="<?php echo _AT('edit'); ?> "/></a> <a href="mods/_standard/forums/forum/delete_thread.php?fid=<?php echo $row['forum_id'] . SEP . 'pid=' . $row['post_id'] . SEP . 'ppid=' . $row['parent_id'] . SEP; ?> nest=1"><img src="images/forum/forum_delete.png" alt="<?php echo _AT('delete'); ?> " title="<?php echo _AT('delete'); ?> "/></a> --> <?php } elseif ($row['member_id'] == $_SESSION['member_id'] && $row['udate'] + $forum_info['mins_to_edit'] * 60 > time()) { ?> <?php echo $reply_link; ?> <a href="mods/_standard/forums/edit_post.php?fid=<?php echo $row['forum_id'] . SEP . 'pid=' . $row['post_id']; ?> "><img src="images/forum/forum_edit.png" alt="<?php echo _AT('edit'); ?> " title="<?php echo _AT('edit'); ?> "></a> <span>(<?php echo _AT('edit_for_minutes', round(($row['udate'] + $forum_info['mins_to_edit'] * 60 - time()) / 60)); ?> )</span> <!-- <?php echo $reply_link; ?> <a href="#" id="edit-<?php echo $row['post_id']; ?> "><img src="images/forum/forum_edit.png" alt="<?php echo _AT('edit'); ?> " title="<?php echo _AT('edit'); ?> "></a> <span>(<?php echo _AT('edit_for_minutes', round(($row['udate'] + $forum_info['mins_to_edit'] * 60 - time()) / 60)); ?> )</span> --> <?php } elseif ($_SESSION['valid_user'] == true) { ?> <?php echo $reply_link; ?> <?php } ?> </div> <p class="date"> <?php echo AT_date(_AT('forum_date_format'), $row['date'], AT_DATE_MYSQL_DATETIME); ?> </p> </div> <div class="body"> <p><?php echo apply_customized_format(AT_print($row['body'], 'forums_threads.body')); ?> </p> </div> </div> <?php // popin edit/reply forms / disabled until ID conflict issue can be resolved //echo '<div class="forum_reply" id="reply-'.$row['post_id'].'">'; //require(AT_INCLUDE_PATH.'../mods/_standard/forums/html/new_thread.inc.php'); //echo '</div>'; //echo '<div class="forum_edit" id="edit-'.$row['post_id'].'">'; //require(AT_INCLUDE_PATH.'../mods/_standard/forums/edit_post.php'); //echo '</div>'; ?> </li> <?php }
function format_content($input, $html = 0, $glossary, $simple = false) { global $_base_path, $_config; if (!$html) { $input = str_replace('<', '<', $input); $input = str_replace('<?php', '<?php', $input); // for bug #2087 } elseif ($html==2) { $output = '<iframe width="100%" frameborder="0" id="content_frame" marginheight="0" marginwidth="0" src="'.$input.'"></iframe>'; $output .= '<script type="text/javascript"> function resizeIframe() { var height = document.documentElement.clientHeight; // not sure how to get this dynamically height -= 20; /* whatever you set your body bottom margin/padding to be */ document.getElementById(\'content_frame\').style.height = height +"px"; }; document.getElementById(\'content_frame\').onload = resizeIframe; window.onresize = resizeIframe; </script>'; return $output; } /* do the glossary search and replace: */ if (is_array($glossary)) { foreach ($glossary as $k => $v) { $k = urldecode($k); $v = str_replace("\n", '<br />', $v); $v = str_replace("\r", '', $v); $k = str_replace('<', '<', $k); $original_term = str_replace('/', '\/', $k);; $term = $k; if (!$html) { $term = str_replace('<', '<', $term); } /* escape special characters */ $term = preg_quote($term, "/"); $term = '(\s*'.$term.'\s*)'; $term = str_replace(' ','((<br \/>)*\s*)', $term); // Uncomment the line below and comment the following line // when the jquery UI tooltip supports the html display. //$def = htmlspecialchars($v, ENT_QUOTES, 'UTF-8'); $def = htmlspecialchars(strip_tags($v), ENT_QUOTES, 'UTF-8'); if ($simple) { $input = preg_replace ("/(\[\?\])$term(\[\/\?\])/i", '<a href="'.$simple.'glossary.html#'.urlencode($original_term).'" target="body" class="at-term">\\2</a>', $input); } else { $input = preg_replace ("/(\[\?\])".$term."(\[\/\?\])/i", '<a class="tooltip" href="'.$_base_path.'mods/_core/glossary/index.php?g_cid='.$_SESSION['s_cid'].htmlentities(SEP).'w='.urlencode($original_term).'#term" title="'.htmlentities_utf8($original_term).': '.$def.'">\\2</a>',$input); } } } else if (!$user_glossary) { $input = str_replace(array('[?]','[/?]'), '', $input); } $input = str_replace('CONTENT_DIR', '', $input); if (isset($_config['latex_server']) && $_config['latex_server']) { $input = preg_replace('/\[tex\](.*?)\[\/tex\]/sie', "'<img src=\"'.\$_config['latex_server'].rawurlencode('$1').'\" align=\"middle\" alt=\"'.'$1'.'\" title=\"'.'$1'.'\">'", $input); } if ($html) { $x = apply_customized_format(format_final_output($input, false)); return $x; } // the following has been taken out for this: // http://atutor.ca/atutor/mantis/view.php?id=4593 // @date Oct 18, 2010 // $output = apply_customized_format(format_final_output($input)); $output = $input; $output = '<p>'.$output.'</p>'; return $output; }