Advertisement
ziggy471

Untitled

Apr 20th, 2011
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.82 KB | None | 0 0
  1. diff -Nur a/comments.php b/comments.php
  2. --- a/comments.php  2010-06-28 08:07:32.000000000 -0400
  3. +++ b/comments.php  2011-04-20 13:37:35.000499013 -0400
  4. @@ -106,6 +106,21 @@
  5.            
  6.             }
  7.            
  8. +           // Fix the date/time to the original date/time from Wordpress
  9. +           // Shouldn't effect the auto-sync, but fixes date/time for older
  10. +           // messages exported
  11. +           smf_db_query('', '
  12. +               UPDATE {db_prefix}messages
  13. +               SET poster_time = {int:post_time}
  14. +               WHERE id_msg = {int:id_msg}',
  15. +               array(
  16. +                   'post_time' => strtotime($queried_comment -> comment_date_gmt),
  17. +                   'id_msg' => $msgOptions['id'],
  18. +               )
  19. +           );
  20. +
  21. +
  22. +          
  23.         }
  24.    
  25.     }
  26. diff -Nur a/index.php b/index.php
  27. --- a/index.php 2010-06-28 08:07:32.000000000 -0400
  28. +++ b/index.php 2011-04-20 13:39:58.830499013 -0400
  29. @@ -51,6 +51,10 @@
  30.      $smf_link_text = $_POST['smf_link_text'];  
  31.      update_option('smf_link_text', $smf_link_text);
  32.      
  33. +    // Add Forum URL
  34. +    $smf_url = $_POST['smf_url'];  
  35. +    update_option('smf_url', $smf_url);
  36. +    
  37.      $smf_charset = $_POST['smf_charset'];  
  38.      update_option('smf_charset', $smf_charset);  
  39.      
  40. @@ -95,6 +99,8 @@
  41.      //Normal page display  
  42.      $smf_path = get_option('smf_path');  
  43.      $smf_link_text = get_option('smf_link_text');  
  44. +    // Add forum URL
  45. +    $smf_url = get_option('smf_url');  
  46.      
  47.      if ($smf_link_text == ''){
  48.         $smf_link_text = 'Follow on our <a>forum</a>';
  49. @@ -176,6 +182,15 @@
  50.                              </tr>
  51.                              <tr>
  52.                                 <th>
  53. +                                   <label for="smf_url">SMF URL</label>
  54. +                               </th>
  55. +                               <td>
  56. +                                   <input type="text" class="regular-text" name="smf_url" value="<?php echo $smf_url; ?>" size="20">
  57. +                                   <span class="description"> example: http://forums.mydomain.com text
  58. +                               </td>
  59. +                            </tr>
  60. +                            <tr>
  61. +                               <th>
  62.                                     <label for="smf_charset">SMF Charset</label>
  63.                                 </th>
  64.                                 <td>
  65. @@ -326,10 +341,16 @@
  66.         $topic = get_post_meta($post_id, 'smf_topic_id', true);
  67.         $smf_path = get_option('smf_path');
  68.         $smf_link_text = get_option('smf_link_text');
  69. +       // Add forum URL
  70. +       $smf_url = get_option('smf_url');
  71.        
  72.         $domain = parse_url($_SERVER['HTTP_HOST']);
  73.        
  74. -       $smf_link = "<a href=\"http://".$domain['path']."$smf_path/index.php?topic=$topic.0\">";
  75. +       // If smf_url is set, use it, otherwise, build it the original way
  76. +       if(!empty($smf_url))
  77. +           $smf_link = "<a href=\"$smf_url/index.php?topic=$topic.0\">";
  78. +       else
  79. +           $smf_link = "<a href=\"http://".$domain['path']."$smf_path/index.php?topic=$topic.0\">";
  80.        
  81.         $smf_link_text = str_replace ('<a>',$smf_link,$smf_link_text);
  82.  
  83. diff -Nur a/posts.php b/posts.php
  84. --- a/posts.php 2010-06-28 08:07:32.000000000 -0400
  85. +++ b/posts.php 2011-04-20 13:40:50.290499012 -0400
  86. @@ -87,11 +87,40 @@
  87.  
  88.             } else {//OR CREATE A NEW ONE?
  89.  
  90. -             $sucess = createPost($msgOptions, $topicOptions, $posterOptions);
  91. -             add_post_meta($post_id, 'smf_topic_id', $topicOptions['id']);
  92. -             add_post_meta($post_id, 'smf_msg_id', $msgOptions['id']);
  93. +               $sucess = createPost($msgOptions, $topicOptions, $posterOptions);
  94. +            
  95. +               add_post_meta($post_id, 'smf_topic_id', $topicOptions['id']);
  96. +               add_post_meta($post_id, 'smf_msg_id', $msgOptions['id']);
  97.            
  98.             }
  99. +
  100. +           // Fix the date/time to the original date/time from Wordpress
  101. +           // Shouldn't effect the auto-sync, but fixes date/time for older
  102. +           // messages exported
  103. +           smf_db_query('', '
  104. +               UPDATE {db_prefix}messages
  105. +               SET poster_time = {int:post_time}
  106. +               WHERE id_msg = {int:id_msg}',
  107. +               array(
  108. +                   'post_time' => strtotime($queried_post -> post_date_gmt),
  109. +                   'id_msg' => $msgOptions['id'],
  110. +               )
  111. +           );
  112. +
  113. +           // If the modified date/time is later than original, add the modified info
  114. +           if(strtotime($queried_post -> post_modified_gmt) > strtotime($queried_post -> post_date_gmt))
  115. +           {
  116. +               smf_db_query('', '
  117. +                   UPDATE {db_prefix}messages
  118. +                   SET modified_time = {int:mod_time}, modified_name = {string:name}
  119. +                   WHERE id_msg = {int:id_msg}',
  120. +                   array(
  121. +                       'mod_time' => strtotime($queried_post -> post_modified_gmt),
  122. +                       'name' => $user_info -> display_name,
  123. +                       'id_msg' => $msgOptions['id'],
  124. +                   )
  125. +               );
  126. +           }
  127.            
  128.         }
  129.    
  130. --- a/MessageIndex.php  2011-04-20 12:48:48.410499012 -0400
  131. +++ b/MessageIndex.php  2011-01-31 09:01:48.000000000 -0500
  132. @@ -296,14 +296,14 @@
  133.         'replies' => 't.num_replies',
  134.         'views' => 't.num_views',
  135.         'first_post' => 't.id_topic',
  136. -       'last_post' => 't.id_last_msg'
  137. +       'last_post' => 'mf.poster_time'
  138.     );
  139.  
  140.     // They didn't pick one, default to by last post descending.
  141.     if (!isset($_REQUEST['sort']) || !isset($sort_methods[$_REQUEST['sort']]))
  142.     {
  143.         $context['sort_by'] = 'last_post';
  144. -       $_REQUEST['sort'] = 'id_last_msg';
  145. +       $_REQUEST['sort'] = 'mf.poster_time';
  146.         $ascending = isset($_REQUEST['asc']);
  147.     }
  148.     // Otherwise default to ascending.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement