<td> <div class="comm_name"><?php echo $comment->name; ?> <span>on: <a href="<?php echo $comment->url; ?> "><?php echo $comment->title; ?> </a> <?php echo get_date('m/d/Y \\a\\t g:i a', $comment->time); ?> </span></div> <div class="comm_text"><?php echo replace_smilies($comment->comment); ?> </div> </td> <td class="action" id="<?php echo $comment->ID; ?> "><a href="<?php echo $comment->url; ?> " class="view">View</a><a href="index.php?page=admin&option=comments&edit=<?php echo $comment->ID; ?> " class="edit">Edit</a><a href="#" class="delete">Delete</a></td> </tr>
} elseif (preg_match('@^/(\\w+)/?(?:(\\d{1,5})/?)?@', $_PATH, $cat_ID)) { $category = safe_text(strtolower($cat_ID[1])); $cat = (int) $scdb->get_var("SELECT `ID` FROM `{$scdb->categories}` WHERE `nicename` = '{$category}' LIMIT 1"); if ($scdb->num_rows == 1) { $comic->cat = $cat; $ID = (int) (isset($cat_ID[2]) && is_numeric($cat_ID[2])) ? $cat_ID[2] : 0; $comic->get_comic($ID); } else { die; } } else { die; } if ($ID != $comic->ID) { die; } $comments->post_comment($_POST); if ($comments->post->error === false) { $json = array('time' => get_date('F jS, Y @ g:i a', NOW), 'comment' => replace_smilies($comments->post->comment), 'name' => $comments->post->name, 'website' => $comments->post->website, 'ID' => $comments->post->ID, 'message' => $comments->message, 'error' => null); echo json_encode($json); } else { echo json_encode(array('error' => $comments->message)); } } elseif (isset($_GET['form']) && ($_GET['form'] = 'search' && isset($_GET['s']))) { $comic->search($_GET['s'], 1, 5); if ($comic->search->num_results > 0) { echo json_encode($comic->search->results); } else { echo json_encode(array('error' => 'Sorry, No Results.')); } }
/** * Given plain text, makes it into HTML as nicely as possible. * May contain HTML tags already * * @uses $CFG * @param string $text The string to convert. * @param boolean $smiley Convert any smiley characters to smiley images? * @param boolean $para If true then the returned string will be wrapped in paragraph tags * @param boolean $newlines If true then lines newline breaks will be converted to HTML newline breaks. * @return string */ function text_to_html($text, $smiley = true, $para = true, $newlines = true) { /// global $CFG; /// Remove any whitespace that may be between HTML tags $text = eregi_replace(">([[:space:]]+)<", "><", $text); /// Remove any returns that precede or follow HTML tags $text = eregi_replace("([\n\r])<", " <", $text); $text = eregi_replace(">([\n\r])", "> ", $text); convert_urls_into_links($text); /// Make returns into HTML newlines. if ($newlines) { $text = nl2br($text); } /// Turn smileys into images. if ($smiley) { replace_smilies($text); } /// Wrap the whole thing in a paragraph tag if required if ($para) { return '<p>' . $text . '</p>'; } else { return $text; } }
function replace_ubbcode($str, $stdlang = false, $rootpath) { // code $code_ids = array(); while ($ereg = preg_match("/\\[code(=(.+?))*\\](.+?)\\[\\/code\\]/s", $str, $reg)) { $code_id = 0; do { $code_id = mt_rand(100, 10000); } while (array_key_exists($code_id, $code_ids)); $lang = $reg[2]; $str2 = $reg[3]; if ($lang === null || $lang == "") { if ($stdlang) { $lang = $stdlang; } else { $lang = 'c'; } } $humanreadable_lang = lang_name($lang); if ($humanreadable_lang == " (unknown language)") { $humanreadable_lang = $lang . $humanreadable_lang; } $str2 = stripslashes($str2); $str2 = geshi_highlight($str2, $lang, null, true); $str2 = eregi_replace("\\\\([ntr])", '\\\\\\\\1', $str2); $str2 = eregi_replace("<br />", "", $str2); $str2 = preg_replace("/\n<\\/span><\\/code>\$/", '</span></code>', $str2); $code_ids[$code_id] = "</p>\n<pre class=\"code\">\n{$str2}\n</pre>\n<p>"; $str = preg_replace("/\\[code(=({$lang}))*\\](.+?)\\[\\/code\\]/s", "[code_id={$code_id}/]", $str, 1); } $str = htmlspecialchars($str); $str = nl2br($str); $str = eregi_replace("\\\\\\\\", "\\", $str); $str = eregi_replace("\\\\"", """, $str); # $str = "<p>".$str."</p>"; # $str = eregi_replace("\n.\n", "</p><p>", $str); # $str = eregi_replace("\n", "<br />\n", $str); # $str = eregi_replace("</p><p>", "</p>\n<p>", $str); $str = eregi_replace("=== ([^=]+) ===(<br />)?", "</p>\n<h4>\\1</h4>\n<p>", $str); $str = eregi_replace("== ([^=]+) ==(<br />)?", "</p>\n<h3>\\1</h3>\n<p>", $str); # $str = eregi_replace("_{([^}]+)}", "<sub>\\1</sub>", $str); # $str = eregi_replace("\^{([^}]+)}", "<sup>\\1</sup>", $str); // formatting $str = eregi_replace("\\[b]([^\\[]*)\\[/b\\]", "<strong>\\1</strong>", $str); // bold|strong $str = eregi_replace("\\[i]([^\\[]*)\\[/i\\]", "<i>\\1</i>", $str); // kursiv $str = eregi_replace("\\[u]([^\\[]*)\\[/u\\]", "<u>\\1</u>", $str); // underline $str = preg_replace('/\\[bq]([^\\[]*)\\[\\/bq\\]/i', "</p><blockquote><p>\\1</p></blockquote><p>", $str); $str = eregi_replace("\\[s]([^\\[]*)\\[/s\\]", "<s>\\1</s>", $str); // strike $str = eregi_replace("\\[color=([^\\[]*)\\]([^\\[]*)\\[/color\\]", "<span style=\"color:\\1;\">\\2</span>", $str); // color // flash $str = eregi_replace("\\[flash]([^\\[]*)\\[/flash\\]", "<object data=\"\\1\" type=\"application/x-shockwave-flash\" style=\"width: 425px; height: 355px\">\n <param name=\"movie\" value=\"\\1\" />\n <param name=\"wmode\" value=\"transparent\" />\n</object>", $str); // pic $str = eregi_replace("\\[img(=([^\\[]*))*\\]([^\\[]*)\\[/img\\]", "<a href=\"\\3\" rel=\"facebox\"><img src=\"\\3\" alt=\"\\3\" /></a>", $str); // bild $str = eregi_replace("\\[img(=([^\\[]*))*\\]([^\\[]*)\\[/img,([0-9]+),([0-9]+)\\]", "<a href=\"\\3\" rel=\"facebox\"><img src=\"\\3\" style=\"width:\\4px;height:\\5px\" alt=\"\\3\" /></a>", $str); // bild mit größe // links $str = preg_replace("/\\[\\[(.+?)\\|(.+?)\\]\\]/", "<a href=\"\\1\">\\2</a>", $str); // link with title $str = preg_replace("/\\[\\[(.+)\\]\\]/", "<a href=\"\\1\">\\1</a>", $str); // link without title // $str = eregi_replace("\[\[(.+?)\|(.+?)\]\]", "<a href=\"\\1\">\\2</a>", $str); // link with title // $str = eregi_replace("\[\[(.+)\]\]", "<a href=\"\\1\">\\1</a>", $str); // link without title $str = eregi_replace("\\[center]([^\\[]*)\\[/center\\]", "</p>\n<p style=\"text-align:center\">\\1</p>\n<p>", $str); $str = eregi_replace("\\[left]([^\\[]*)\\[/left\\]", "</p>\n<p style=\"text-align:left\">\\1</p>\n<p>", $str); $str = eregi_replace("\\[right]([^\\[]*)\\[/right\\]", "</p>\n<p style=\"text-align:right\">\\1</p>\n<p>", $str); $str = replace_smilies($str, $rootpath); $preg = array('/(?<!\\\\)(?:\\s*<br\\s*\\/?>\\s*)?\\[\\*(?::\\w+)?\\](.*?)(?=(?:\\s*<br\\s*\\/?>\\s*)?\\[\\*|(?:\\s*<br\\s*\\/?>\\s*)?\\[\\/?list)/si' => "\n<li class=\"bb-listitem\">\\1</li>", '/(?<!\\\\)(?:\\s*<br\\s*\\/?>\\s*)?\\[\\/list(:(?!u|o)\\w+)?\\](?:<br\\s*\\/?>)?/si' => "\n</ul>", '/(?<!\\\\)(?:\\s*<br\\s*\\/?>\\s*)?\\[\\/list:u(:\\w+)?\\](?:<br\\s*\\/?>)?/si' => "\n</ul>", '/(?<!\\\\)(?:\\s*<br\\s*\\/?>\\s*)?\\[\\/list:o(:\\w+)?\\](?:<br\\s*\\/?>)?/si' => "\n</ol>", '/(?<!\\\\)(?:\\s*<br\\s*\\/?>\\s*)?\\[list(:(?!u|o)\\w+)?\\]\\s*(?:<br\\s*\\/?>)?/si' => "\n<ul class=\"bb-list-unordered\">", '/(?<!\\\\)(?:\\s*<br\\s*\\/?>\\s*)?\\[list:u(:\\w+)?\\]\\s*(?:<br\\s*\\/?>)?/si' => "\n<ul class=\"bb-list-unordered\">", '/(?<!\\\\)(?:\\s*<br\\s*\\/?>\\s*)?\\[list:o(:\\w+)?\\]\\s*(?:<br\\s*\\/?>)?/si' => "\n<ol class=\"bb-list-ordered\">", '/(?<!\\\\)(?:\\s*<br\\s*\\/?>\\s*)?\\[list(?::o)?(:\\w+)?=1\\]\\s*(?:<br\\s*\\/?>)?/si' => "\n<ol class=\"bb-list-ordered bb-list-ordered-d\">", '/(?<!\\\\)(?:\\s*<br\\s*\\/?>\\s*)?\\[list(?::o)?(:\\w+)?=i\\]\\s*(?:<br\\s*\\/?>)?/s' => "\n<ol class=\"bb-list-ordered bb-list-ordered-lr\">", '/(?<!\\\\)(?:\\s*<br\\s*\\/?>\\s*)?\\[list(?::o)?(:\\w+)?=I\\]\\s*(?:<br\\s*\\/?>)?/s' => "\n<ol class=\"bb-list-ordered bb-list-ordered-ur\">", '/(?<!\\\\)(?:\\s*<br\\s*\\/?>\\s*)?\\[list(?::o)?(:\\w+)?=a\\]\\s*(?:<br\\s*\\/?>)?/s' => "\n<ol class=\"bb-list-ordered bb-list-ordered-la\">", '/(?<!\\\\)(?:\\s*<br\\s*\\/?>\\s*)?\\[list(?::o)?(:\\w+)?=A\\]\\s*(?:<br\\s*\\/?>)?/s' => "\n<ol class=\"bb-list-ordered bb-list-ordered-ua\">", '/(?<!\\\\)\\[url(?::\\w+)?\\]www\\.(.*?)\\[\\/url(?::\\w+)?\\]/si' => "<a href=\"http://www.\\1\">www.\\1</a>", '/(?<!\\\\)\\[url(?::\\w+)?\\](.*?)\\[\\/url(?::\\w+)?\\]/si' => "<a href=\"\\1\">\\1</a>", '/(?<!\\\\)\\[url(?::\\w+)?=(.*?)?\\](.*?)\\[\\/url(?::\\w+)?\\]/si' => "<a href=\"\\1\">\\2</a>"); $str = preg_replace(array_keys($preg), array_values($preg), $str); // code /*$i=0; while(($ereg= preg_match("/\[code(=(.+?))*\](.+?)\[\/code\]/s", $str,$reg)) && $i < 10) { $i++; $lang = $reg[2]; $str2 = $reg[3]; if($lang === null || $lang == "") { if($stdlang) $lang = $stdlang; else $lang = 'c'; } $humanreadable_lang = lang_name($lang); if($humanreadable_lang == " (unknown language)") $humanreadable_lang = $lang.$humanreadable_lang; $str2 = eregi_replace(""", "\"", $str2); $str2 = eregi_replace(">", ">", $str2); $str2 = eregi_replace("<", "<", $str2); $str2 = eregi_replace("<br />", "", $str2); $str2 = geshi_highlight($str2, $lang, null, true); $str2 = eregi_replace("\\\\n", '\\\\\\n', $str2); $str2 = eregi_replace("<br />", "", $str2); $str2 = preg_replace("/\n<\/span><\/code>$/", '</span></code>', $str2); $str = preg_replace("/\[code(=({$lang}))*\](.+?)\[\/code\]/s", "</p>\n<pre class=\"code\">\n{$str2}\n</pre>\n<p>", $str, 1); }*/ #var_dump($code_ids); foreach ($code_ids as $c_id => $code_str) { $out = 0; $str = preg_replace("/\\[code_id={$c_id}\\/\\]/", $code_str, $str, 1, $out); } return $str; }
function gbook_content() { global $p; $result = db_result("SELECT * FROM " . DB_PREFIX . "guestbook ORDER BY date DESC LIMIT " . @$p * 10 . ",10"); $text = "<a name=\"content\" ></a>\r\n"; $o = 1; while ($row = mysql_fetch_object($result)) { $text .= "<div class=\"gb_content\">\r\n\t<div class=\"gb_content_info\">\r\n\t\t<span class=\"gb_content_info_name\">"; if ($row->mail != "") { $text .= "<a href=\"mailto:" . $row->mail . "\">" . $row->name . "</a>"; } else { $text .= $row->name; } $text .= "</span>\r\n"; if ($row->icq != '') { $text .= "\t\t<span class=\"gb_content_info_icq\">\r\n\t\t\t<a href=\"http://wwp.icq.com/scripts/search.dll?to=" . $row->icq . "\" target=\"_blank\">\r\n\t\t\t\t<img width=\"18\" height=\"18\" class=\"gb_content_info_icq\" src=\"http://status.icq.com/online.gif?icq=" . $row->icq . "&img=5\" alt=\"ICQ-Status\"/>\r\n\t\t\t</a>\r\n\t\t</span>\r\n"; } if ($row->homepage != '') { $text .= "\t\t<span class=\"gb_content_info_homepage\">\r\n\t\t\t<a href=\"http://" . $row->homepage . "\">Homepage</a>\r\n\t\t</span>\r\n"; } $text .= "\t</div>\r\n"; $time = date('H:i:s', $row->date); if ($time == '00:00:00') { $time = ''; } $text .= "\t<div class=\"gb_content_text\">" . replace_smilies(nl2br(htmlspecialchars($row->message))) . "\r\n\t\t<div class=\"gb_content_date\">" . date('d.m.Y', $row->date) . " " . $time . "</div>\r\n\t</div>\r\n</div>\r\n\r\n"; $o++; } return $text; }
echo $item->name; ?> on "<?php echo $item->title; ?> "</title> <link><?php echo $url; ?> </link> <dc:creator><?php echo $item->name; ?> </dc:creator> <description><![CDATA[<?php echo nl2br(replace_smilies($item->comment)); ?> ]]></description> <pubDate><?php echo get_date('D, d M Y H:i:s O', $item->time); ?> </pubDate> <guid isPermaLink="true"><?php echo $url; ?> </guid> </item> <?php } }
function wiki_print_edit_smileis(&$WS) { global $CFG; $smileis = array(':-)', ':-D', ';-)', ':-/', 'V-.', ':-P', 'B-)', '^-)', '8-)', '8-o', ':-(', '8-.', ':-I', ':-X', ':o)', 'P-|', '8-[', 'xx-P', '|-.', '}-]'); //import javascript $prop = null; $prop->href = '#'; if (isset($WS->dfcourse)) { $prop->class = 'wiki_folding_co'; } else { $prop->class = 'wiki_folding'; } $button = wiki_a('', $prop, true); $prop = null; $prop->class = 'wiki_listme'; $prop->classli = 'wiki_listme'; wiki_start_ul($prop); $prop = null; $prop->src = $CFG->wwwroot . '/mod/wiki/editor/images/ed_smiley1.gif'; if (isset($WS->dfcourse)) { $prop->class = 'icsme_co'; } else { $prop->class = 'icsme'; } wiki_img($prop); echo $button; $prop = null; $prop->class = 'wiki_listme'; $prop->style = 'margin:auto auto auto 5px;display:none'; $prop->classli = 'wiki_listme'; wiki_start_ul($prop); //generate tree content. $put = 1; foreach ($smileis as $smiley) { //image url: http://147.83.59.184/moodle15/file.php/#courseid/ $img = $smiley; replace_smilies($img); $prop = null; $prop->href = 'javascript:insertTags(\'' . $smiley . '\',\'\',\'\')'; wiki_a($img, $prop); //only 10 emoticons per line if ($put > 4) { wiki_br(); $put = 0; } $put++; } wiki_end_ul(); wiki_end_ul(); }
<ol id='commentlist'> <?php $alt = 'odd'; if ($comments->num === 0) { echo "<center>No one has commented on this comic yet, be the first!</center><br /><br />"; } else { foreach ($comments->return_comments() as $comment) { $date = get_date('F jS, Y @ g:i a', $comment->time); if ($comment->website == '') { $name = $comment->name; } else { $name = "<a href='" . $comment->website . "' rel='nofollow' class='author' target='_blank'>" . $comment->name . "</a>"; } $alt = $alt == 'odd' ? 'even' : 'odd'; echo "<li id='comment-", $comment->ID, "' class='bubble'><blockquote class='", $alt, "'><p>", replace_smilies(nl2br($comment->comment)), "</p></blockquote><div class='author_line_", $alt, "'><span>", $name, "</span> on <a href='#comment-", $comment->ID, "' title='Permalink to Comment'>", $date, "</a></div></li>\n\r"; } } ?> </ol> <div id="ajax-loader"></div> </div> <br /><br /> <div id="hideme"> <font color="#CC6600" size="+1">What Do You Have to Say?</font> <form action="#comments" method="post" name="commentform" id="commentform"> <input type="text" name="name" id="name" maxlength="30" value="<?php if (isset($_COOKIE['name'])) { echo $_COOKIE['name']; } elseif (isset($_POST['name'])) {