# HG changeset patch
# User Dan
# Date 1183324362 14400
# Node ID 7267c2a67a93ecb3834f4c64fe7b456666160211
# Parent 425261984266bd58aaedd07818304ba048cc86fd
More image tag parser fixes
diff -r 425261984266 -r 7267c2a67a93 includes/pageprocess.php
--- a/includes/pageprocess.php Sun Jul 01 15:00:32 2007 -0400
+++ b/includes/pageprocess.php Sun Jul 01 17:12:42 2007 -0400
@@ -723,13 +723,13 @@
if ( !empty($userdata['user_aim']) )
{
$class = ( $class == 'row1' ) ? 'row3' : 'row1';
- echo '
AIM: ' . htmlspecialchars($userdata['user_aim']) . ' |
';
+ echo 'AIM: ' . $userdata['user_aim'] . ' |
';
}
if ( !empty($userdata['user_yahoo']) )
{
$class = ( $class == 'row1' ) ? 'row3' : 'row1';
- echo 'Yahoo! IM: ' . htmlspecialchars($userdata['user_yahoo']) . ' |
';
+ echo 'Yahoo! IM: ' . $userdata['user_yahoo'] . ' |
';
}
if ( !empty($userdata['user_msn']) )
@@ -753,19 +753,19 @@
if ( !empty($userdata['user_location']) )
{
$class = ( $class == 'row1' ) ? 'row3' : 'row1';
- echo 'Location: ' . htmlspecialchars($userdata['user_location']) . ' |
';
+ echo 'Location: ' . $userdata['user_location'] . ' |
';
}
if ( !empty($userdata['user_job']) )
{
$class = ( $class == 'row1' ) ? 'row3' : 'row1';
- echo 'Job/occupation: ' . htmlspecialchars($userdata['user_job']) . ' |
';
+ echo 'Job/occupation: ' . $userdata['user_job'] . ' |
';
}
if ( !empty($userdata['user_hobbies']) )
{
$class = ( $class == 'row1' ) ? 'row3' : 'row1';
- echo 'Enjoys: ' . htmlspecialchars($userdata['user_hobbies']) . ' |
';
+ echo 'Enjoys: ' . $userdata['user_hobbies'] . ' |
';
}
if ( empty($userdata['user_location']) && empty($userdata['user_job']) && empty($userdata['user_hobbies']) )
diff -r 425261984266 -r 7267c2a67a93 includes/render.php
--- a/includes/render.php Sun Jul 01 15:00:32 2007 -0400
+++ b/includes/render.php Sun Jul 01 17:12:42 2007 -0400
@@ -243,7 +243,7 @@
if ( !$plaintext )
{
// Process images
- $text = RenderMan::process_image_tags($text);
+ $text = RenderMan::process_image_tags($text, $taglist);
}
if($do_params)
@@ -272,6 +272,11 @@
$result = $wiki->transform($text, 'Xhtml');
}
+ if ( !$plaintext )
+ {
+ $result = RenderMan::process_imgtags_stage2($result, $taglist);
+ }
+
// Reinsert sections
for($i=0;$i<$nw;$i++)
{
@@ -747,13 +752,18 @@
/**
* Changes wikitext image tags to HTML.
* @param string The wikitext to process
+ * @param array Will be overwritten with the list of HTML tags (the system uses tokens for TextWiki compatibility)
* @return string
*/
- function process_image_tags($text)
+ function process_image_tags($text, &$taglist)
{
global $db, $session, $paths, $template, $plugins; // Common objects
+ $s_delim = "\xFF";
+ $f_delim = "\xFF";
+ $taglist = array();
+
// Wicked huh?
$regex = '/\[\[:' . $paths->nslist['File'] . '([\w\s0-9_\(\)!@%\^\+\|\.-]+?)((\|thumb)|(\|([0-9]+)x([0-9]+)))?(\|left|\|right)?(\|(.+))?\]\]/i';
@@ -801,11 +811,6 @@
$img_tag .= 'width="' . $r_width . '" height="' . $r_height . '" ';
}
- if ( empty($clear) && $scale_type == '|thumb' )
- {
- $clear = 'right';
- }
-
$img_tag .= 'style="border-width: 0px; background-color: white;" ';
$img_tag .= '/>';
@@ -820,7 +825,7 @@
{
$side = ( $clear == '|left' ) ? 'left' : 'right';
$opposite = ( $clear == '|left' ) ? 'right' : 'left';
- $clear_text .= "clear: $side; float: $side; margin-$opposite: 20px;";
+ $clear_text .= "float: $side; margin-$opposite: 20px;";
$complete_tag .= 'style="' . $clear_text . '" ';
}
$complete_tag .= '>';
@@ -846,9 +851,10 @@
$complete_tag .= '';
}
- $complete_tag = "$complete_tag\n\n";
+ $complete_tag .= "\n\n";
+ $taglist[$i] = $complete_tag;
- $pos = strpos($text, $full_tag) - 3;
+ $pos = strpos($text, $full_tag);
while(true)
{
@@ -862,7 +868,8 @@
$pos--;
}
- $text = substr($text, 0, $pos) . $complete_tag . substr($text, $pos + 1);
+ $repl = "{$s_delim}e_img_{$i}{$f_delim}";
+ $text = substr($text, 0, $pos) . $repl . substr($text, $pos);
$text = str_replace($full_tag, '', $text);
@@ -873,6 +880,24 @@
return $text;
}
+ /**
+ * Finalizes processing of image tags.
+ * @param string The preprocessed text
+ * @param array The list of image tags created by RenderMan::process_image_tags()
+ */
+
+ function process_imgtags_stage2($text, $taglist)
+ {
+ $s_delim = "\xFF";
+ $f_delim = "\xFF";
+ foreach ( $taglist as $i => $tag )
+ {
+ $repl = "{$s_delim}e_img_{$i}{$f_delim}";
+ $text = str_replace($repl, $tag, $text);
+ }
+ return $text;
+ }
+
}
?>
diff -r 425261984266 -r 7267c2a67a93 plugins/SpecialAdmin.php
--- a/plugins/SpecialAdmin.php Sun Jul 01 15:00:32 2007 -0400
+++ b/plugins/SpecialAdmin.php Sun Jul 01 17:12:42 2007 -0400
@@ -49,7 +49,6 @@
return;
}
-
// Basic information
echo RenderMan::render(
'== Welcome to Runt, the Enano administration panel. ==
diff -r 425261984266 -r 7267c2a67a93 themes/stpatty/css/shamrock.css
--- a/themes/stpatty/css/shamrock.css Sun Jul 01 15:00:32 2007 -0400
+++ b/themes/stpatty/css/shamrock.css Sun Jul 01 17:12:42 2007 -0400
@@ -79,6 +79,7 @@
div#maincontent {
padding: 10px;
padding-right: 150px;
+ clear: left;
}
img#ajaxloadicon {
margin-top: 10px;
@@ -118,6 +119,7 @@
/* Sidebar */
div#sidebar, div.dbx-box {
float: right;
+ clear: right;
width: 135px;
}
div#sidebar h4, div.dbx-handle {