Viewing Paste 413

Formated Paste

  1. <?php
  2.  
  3. ini_set('display_errors', '1');
  4.  
  5. require("SSI.php");
  6. require("Sources/Subs-Post.php");
  7. require("Sources/Subs-Boards.php");
  8.  
  9. $copy = array(
  10. array('from' => 5, 'to' => 117),
  11. array('from' => 29, 'child' => 119),
  12. array('from' => 30, 'child' => 119),
  13. array('from' => 31, 'child' => 119),
  14. array('from' => 32, 'child' => 119),
  15. array('from' => 33, 'child' => 119),
  16. array('from' => 16, 'child' => 117),
  17. array('from' => 17, 'child' => 117),
  18. array('from' => 18, 'child' => 117),
  19. array('from' => 19, 'child' => 117),
  20. array('from' => 20, 'child' => 117),
  21. array('from' => 21, 'child' => 117),
  22. array('from' => 22, 'child' => 117),
  23. array('from' => 23, 'child' => 117),
  24. array('from' => 6, 'to' => 118),
  25. );
  26.  
  27. $created = array();
  28.  
  29. foreach($copy as $item)
  30. {
  31. // 'from' required.
  32. if(isset($item['from']))
  33. {
  34. if (isset($item['child']) && !in_array($item['child'], $created))
  35. {
  36. // We need to make this board, baby!
  37. $request = $smcFunc['db_query']('', '
  38. SELECT name, description, id_board, id_cat
  39. FROM {db_prefix}boards
  40. WHERE id_board = {int:id_board}
  41. LIMIT 1',
  42. 'id_board' => $item['from'],
  43. )
  44. );
  45.  
  46. if ($smcFunc['db_num_rows']($request))
  47. {
  48. while ($row = $smcFunc['db_fetch_assoc']($request))
  49. {
  50. $board = array(
  51. 'target_board' => $item['child'],
  52. 'board_name' => $row['name'],
  53. 'target_category' => $row['id_cat'],
  54. 'description' => $row['description'],
  55. 'move_to' => 'child',
  56. );
  57. }
  58. $new_id = createBoard($board);
  59. $item['to'] = $new_id;
  60. $created[] = $item['child'];
  61. }
  62. }
  63.  
  64. $topics = ssi_recentTopics(5, null, $item['from'], 'array');
  65.  
  66. foreach($topics as $topic)
  67. {
  68. $msgOptions = array(
  69. 'body' => $topic['preview'],
  70. 'subject' => $topic['subject'],
  71. );
  72.  
  73. $topicOptions = array(
  74. 'board' => $item['to'],
  75. 'mark_as_read' => false,
  76. );
  77.  
  78. $posterOptions = array(
  79. 'name' => 'SMF Doc Team',
  80. 'email' => 'docs@simplemachines.org',
  81. 'id' => 1,
  82. );
  83. createPost($msgOptions, $topicOptions, $posterOptions);
  84. }
  85. }
  86. }
  87.  
  88. ?>
Name:
Email:
Code/text to paste:
  • Enable code highlighting
  • Code Language:
  • A duck, cat and a goose walk into a bar. How many animals walked into a bar?:
Highslide for Wordpress Plugin