[geeklog-cvs] geeklog-1.3/public_html lib-common.php,1.398,1.399 submit.php,1.76,1.77
dhaun at iowaoutdoors.org
dhaun at iowaoutdoors.org
Sun Nov 14 09:06:15 EST 2004
Update of /var/cvs/geeklog-1.3/public_html
In directory www:/tmp/cvs-serv11840/public_html
Modified Files:
lib-common.php submit.php
Log Message:
Make links in plain text stories "clickable" when the story is saved. Also fixes bug #308 (messing up image URLs).
Index: submit.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/submit.php,v
retrieving revision 1.76
retrieving revision 1.77
diff -C2 -d -r1.76 -r1.77
*** submit.php 30 Oct 2004 17:13:23 -0000 1.76
--- submit.php 14 Nov 2004 14:06:13 -0000 1.77
***************
*** 214,218 ****
$retval .= $eventform->finish($eventform->get_var('theform'));
$retval .= COM_endBlock();
!
return $retval;
}
--- 214,218 ----
$retval .= $eventform->finish($eventform->get_var('theform'));
$retval .= COM_endBlock();
!
return $retval;
}
***************
*** 231,235 ****
$linkform->set_file('linkform', 'submitlink.thtml');
$linkform->set_var('site_url', $_CONF['site_url']);
! $linkform->set_var('lang_title', $LANG12[10]);
$linkform->set_var('lang_link', $LANG12[11]);
$linkform->set_var('lang_category', $LANG12[17]);
--- 231,235 ----
$linkform->set_file('linkform', 'submitlink.thtml');
$linkform->set_var('site_url', $_CONF['site_url']);
! $linkform->set_var('lang_title', $LANG12[10]);
$linkform->set_var('lang_link', $LANG12[11]);
$linkform->set_var('lang_category', $LANG12[17]);
***************
*** 300,310 ****
$A['show_topic_icon'] = 1;
$A['hits'] = 0;
! $res = DB_query("SELECT username, fullname, photo FROM {$_TABLES['users']} WHERE uid = {$A['uid']}");
! $A += DB_fetchArray($res);
! $res = DB_query("SELECT topic, imageurl FROM {$_TABLES['topics']} WHERE tid = '{$A['tid']}'");
! $A += DB_fetchArray($res);
$retval .= COM_startBlock($LANG12[32])
! . STORY_renderArticle ($A, 'n')
! . COM_endBlock();
}
--- 300,313 ----
$A['show_topic_icon'] = 1;
$A['hits'] = 0;
! $res = DB_query("SELECT username, fullname, photo FROM {$_TABLES['users']} WHERE uid = {$A['uid']}");
! $A += DB_fetchArray($res);
! $res = DB_query("SELECT topic, imageurl FROM {$_TABLES['topics']} WHERE tid = '{$A['tid']}'");
! $A += DB_fetchArray($res);
! if ($A['postmode'] == 'plaintext') {
! $A['introtext'] = COM_makeClickableLinks ($A['introtext']);
! }
$retval .= COM_startBlock($LANG12[32])
! . STORY_renderArticle ($A, 'n')
! . COM_endBlock();
}
***************
*** 333,337 ****
$storyform->set_var('lang_title', $LANG12[10]);
! $storyform->set_var('story_title', htmlspecialchars ($title));
$storyform->set_var('lang_topic', $LANG12[28]);
if (empty ($A['tid']) && !empty ($topic)) {
--- 336,340 ----
$storyform->set_var('lang_title', $LANG12[10]);
! $storyform->set_var('story_title', htmlspecialchars ($title));
$storyform->set_var('lang_topic', $LANG12[28]);
if (empty ($A['tid']) && !empty ($topic)) {
***************
*** 662,666 ****
if (!PLG_saveSubmission($type, $A)) {
COM_errorLog("Could not save your submission. Bad type: $type");
! }
// plugin should include its own redirect - but in case handle
// it here and redirect to the main page
--- 665,669 ----
if (!PLG_saveSubmission($type, $A)) {
COM_errorLog("Could not save your submission. Bad type: $type");
! }
// plugin should include its own redirect - but in case handle
// it here and redirect to the main page
***************
*** 675,679 ****
$A['introtext'] = addslashes(COM_checkHTML(COM_checkWords($A['introtext'])));
} else {
! $A['introtext'] = addslashes(htmlspecialchars(COM_checkWords($A['introtext'])));
}
$A['sid'] = COM_makeSid();
--- 678,682 ----
$A['introtext'] = addslashes(COM_checkHTML(COM_checkWords($A['introtext'])));
} else {
! $A['introtext'] = addslashes (COM_makeClickableLinks (htmlspecialchars (COM_checkWords ($A['introtext']))));
}
$A['sid'] = COM_makeSid();
***************
*** 682,686 ****
} else {
$A['uid'] = 1;
! }
COM_updateSpeedlimit ('submit');
if (($_CONF['storysubmission'] == 1) && !SEC_hasRights('story.submit')) {
--- 685,689 ----
} else {
$A['uid'] = 1;
! }
COM_updateSpeedlimit ('submit');
if (($_CONF['storysubmission'] == 1) && !SEC_hasRights('story.submit')) {
Index: lib-common.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/lib-common.php,v
retrieving revision 1.398
retrieving revision 1.399
diff -C2 -d -r1.398 -r1.399
*** lib-common.php 13 Nov 2004 21:41:59 -0000 1.398
--- lib-common.php 14 Nov 2004 14:06:13 -0000 1.399
***************
*** 5731,5734 ****
--- 5731,5749 ----
/**
+ * Undo the conversion of URLs to clickable links (in plain text posts),
+ * e.g. so that we can present the user with the post as they entered them.
+ *
+ * @param string $txt story text
+ * @param string story text without links
+ *
+ */
+ function COM_undoClickableLinks( $text )
+ {
+ $text = preg_replace( '/<a href="[^"]*">([^<]*)<\/a>/', '\1', $text );
+
+ return $text;
+ }
+
+ /**
* Highlight the words from a search query in a given text string.
*
More information about the geeklog-cvs
mailing list