} else { $codename = 'py??' . $row['type'] . '??'; } } } } } $r .= $codename; foreach ($args as $field => $value) { $r .= "\n"; $r .= $field; $r .= '='; if (substr($field, 0, 6) == 'solver' || substr($field, 0, 6) == 'answer' || substr($field, 0, 5) == 'right' || substr($field, 0, 5) == 'wrong') { $r .= "REDACTED"; } else { $r .= embed_atfile_links(quote_it(htmlspecialchars($value, ENT_NOQUOTES))); } } $r .= "\n]\n"; $r .= htmlspecialchars($row['content'], ENT_NOQUOTES); $r .= "\n[/{$codename}]"; $page_src_url = UPAGESOURCE . '?' . http_build_query(array("page" => $row['postid'])); $content = get_post($row['postid'])->post_content; $found = preg_match("_\\[authorship.*info=\\s*(.*)/(authorship)?\\]_s", $content, $match); if ($found > 0) { $authorshipmsg = 'The <a href="' . $page_src_url . '">containing page source</a> has authorship info: <i>' . $match[1] . '</i>'; } else { $authorshipmsg = 'See also the <a href="' . $page_src_url . '">containing page source</a>.'; } ?> <html>
/** * @usage Quote all elements in an array * @param $values * @return mixed */ function quote_all_array($values) { foreach ($values as $key => $value) { if (is_array($value)) { $values[$key] = quote_all_array($value); } else { $values[$key] = quote_it($value); } } return $values; }
/** * Formats a PHP date for insertion into a SQL statement. * * @param $date Date to format. * @return Formatted date. */ function sql_date($date) { return quote_it(date('Y-m-d H:i:s', $date)); }