Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -Nur a/comments.php b/comments.php
- --- a/comments.php 2010-06-28 08:07:32.000000000 -0400
- +++ b/comments.php 2011-04-20 13:37:35.000499013 -0400
- @@ -106,6 +106,21 @@
- }
- + // Fix the date/time to the original date/time from Wordpress
- + // Shouldn't effect the auto-sync, but fixes date/time for older
- + // messages exported
- + smf_db_query('', '
- + UPDATE {db_prefix}messages
- + SET poster_time = {int:post_time}
- + WHERE id_msg = {int:id_msg}',
- + array(
- + 'post_time' => strtotime($queried_comment -> comment_date_gmt),
- + 'id_msg' => $msgOptions['id'],
- + )
- + );
- +
- +
- +
- }
- }
- diff -Nur a/index.php b/index.php
- --- a/index.php 2010-06-28 08:07:32.000000000 -0400
- +++ b/index.php 2011-04-20 13:39:58.830499013 -0400
- @@ -51,6 +51,10 @@
- $smf_link_text = $_POST['smf_link_text'];
- update_option('smf_link_text', $smf_link_text);
- + // Add Forum URL
- + $smf_url = $_POST['smf_url'];
- + update_option('smf_url', $smf_url);
- +
- $smf_charset = $_POST['smf_charset'];
- update_option('smf_charset', $smf_charset);
- @@ -95,6 +99,8 @@
- //Normal page display
- $smf_path = get_option('smf_path');
- $smf_link_text = get_option('smf_link_text');
- + // Add forum URL
- + $smf_url = get_option('smf_url');
- if ($smf_link_text == ''){
- $smf_link_text = 'Follow on our <a>forum</a>';
- @@ -176,6 +182,15 @@
- </tr>
- <tr>
- <th>
- + <label for="smf_url">SMF URL</label>
- + </th>
- + <td>
- + <input type="text" class="regular-text" name="smf_url" value="<?php echo $smf_url; ?>" size="20">
- + <span class="description"> example: http://forums.mydomain.com text
- + </td>
- + </tr>
- + <tr>
- + <th>
- <label for="smf_charset">SMF Charset</label>
- </th>
- <td>
- @@ -326,10 +341,16 @@
- $topic = get_post_meta($post_id, 'smf_topic_id', true);
- $smf_path = get_option('smf_path');
- $smf_link_text = get_option('smf_link_text');
- + // Add forum URL
- + $smf_url = get_option('smf_url');
- $domain = parse_url($_SERVER['HTTP_HOST']);
- - $smf_link = "<a href=\"http://".$domain['path']."$smf_path/index.php?topic=$topic.0\">";
- + // If smf_url is set, use it, otherwise, build it the original way
- + if(!empty($smf_url))
- + $smf_link = "<a href=\"$smf_url/index.php?topic=$topic.0\">";
- + else
- + $smf_link = "<a href=\"http://".$domain['path']."$smf_path/index.php?topic=$topic.0\">";
- $smf_link_text = str_replace ('<a>',$smf_link,$smf_link_text);
- diff -Nur a/posts.php b/posts.php
- --- a/posts.php 2010-06-28 08:07:32.000000000 -0400
- +++ b/posts.php 2011-04-20 13:40:50.290499012 -0400
- @@ -87,11 +87,40 @@
- } else {//OR CREATE A NEW ONE?
- - $sucess = createPost($msgOptions, $topicOptions, $posterOptions);
- - add_post_meta($post_id, 'smf_topic_id', $topicOptions['id']);
- - add_post_meta($post_id, 'smf_msg_id', $msgOptions['id']);
- + $sucess = createPost($msgOptions, $topicOptions, $posterOptions);
- +
- + add_post_meta($post_id, 'smf_topic_id', $topicOptions['id']);
- + add_post_meta($post_id, 'smf_msg_id', $msgOptions['id']);
- }
- +
- + // Fix the date/time to the original date/time from Wordpress
- + // Shouldn't effect the auto-sync, but fixes date/time for older
- + // messages exported
- + smf_db_query('', '
- + UPDATE {db_prefix}messages
- + SET poster_time = {int:post_time}
- + WHERE id_msg = {int:id_msg}',
- + array(
- + 'post_time' => strtotime($queried_post -> post_date_gmt),
- + 'id_msg' => $msgOptions['id'],
- + )
- + );
- +
- + // If the modified date/time is later than original, add the modified info
- + if(strtotime($queried_post -> post_modified_gmt) > strtotime($queried_post -> post_date_gmt))
- + {
- + smf_db_query('', '
- + UPDATE {db_prefix}messages
- + SET modified_time = {int:mod_time}, modified_name = {string:name}
- + WHERE id_msg = {int:id_msg}',
- + array(
- + 'mod_time' => strtotime($queried_post -> post_modified_gmt),
- + 'name' => $user_info -> display_name,
- + 'id_msg' => $msgOptions['id'],
- + )
- + );
- + }
- }
- --- a/MessageIndex.php 2011-04-20 12:48:48.410499012 -0400
- +++ b/MessageIndex.php 2011-01-31 09:01:48.000000000 -0500
- @@ -296,14 +296,14 @@
- 'replies' => 't.num_replies',
- 'views' => 't.num_views',
- 'first_post' => 't.id_topic',
- - 'last_post' => 't.id_last_msg'
- + 'last_post' => 'mf.poster_time'
- );
- // They didn't pick one, default to by last post descending.
- if (!isset($_REQUEST['sort']) || !isset($sort_methods[$_REQUEST['sort']]))
- {
- $context['sort_by'] = 'last_post';
- - $_REQUEST['sort'] = 'id_last_msg';
- + $_REQUEST['sort'] = 'mf.poster_time';
- $ascending = isset($_REQUEST['asc']);
- }
- // Otherwise default to ascending.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement