$dir) { // remove everything except color _directories_ if(strstr($dir, "admin") != false || strstr($dir, "img") != false || !is_dir($dir)) { // we use strstr because the various ../ / etc will get in the way of a == unset($allcolors[$key]); } else { // strip it down to only the word of the color $allcolors[$key] = str_replace(".", "", $allcolors[$key]); $allcolors[$key] = str_replace("/", "", $allcolors[$key]); } } $allcolors = array_values($allcolors); // and reform the array to reorganize the keys function print_post($title, $body, $time, $author, $id, $indie = false) { // in this function, $author is the author of the post that will be displayed, NOT $color // $color is what it always is; the current color of the blog being viewed, or "" on homepage global $root, $color; // implemented for White: // $author is the name of the author, e.g. "White"; // $authcol is the coloring to use, e.g. "Gray" if($author == "White") $authcol = "Gray"; else $authcol = $author; print("
" . $comment['body'] . ""); } print("
Comment on this post
\n"); print(""); } } function preparse($string) { // use this function to parse text for entrance into the database $string = addslashes($string); return $string; } function postparse($string) { global $allcolors; // use this function to parse text for display $string = stripslashes($string); $string = nl2br($string); // start bbcode if(is_array($allcolors)) // tbh i have NO idea why this IF works, but if it's not here we get an invalid implode() error all over the place $allcolors2 = !empty($allcolors) ? implode('|', $allcolors) : 'Red'; // make sure allcolors always has a value $replace = array('~\[url=(https?://.*?/)(' . $allcolors2 . ')(/.*?)\](.*?)\[/url\]~si' => '\\4'); $string = preg_replace(array_keys($replace), array_values($replace), $string); $preg_find[] = '/\[url\=(.*?)\](.*?)\[\/url\]/is'; $preg_replace[] = '$2'; // removed because of conflictions //$preg_find[] = '/\[url\](.*?)\[\/url\]/is'; //$preg_replace[] = '$1'; $preg_find[] = '/\[b\](.*?)\[\/b\]/is'; $preg_replace[] = '$1'; $preg_find[] = '/\[i\](.*?)\[\/i\]/is'; $preg_replace[] = '$1'; $preg_find[] = '/\[u\](.*?)\[\/u\]/is'; $preg_replace[] = '$1'; $preg_find[] = '/\[img\](.*?)\[\/img\]/is'; $preg_replace[] = '$1'; $string = preg_replace($preg_find, $preg_replace, $string); // end bbcode return $string; }