Viewing Paste 432

Formated Paste

  1. <?php
  2. // SETTINGS
  3. // Simple Desk Tables.
  4. $sd_tables = array('tickets', 'ticket_replies', 'log_action', 'log_read', 'attachments');
  5.  
  6. // SMF Tables we need to clean up after.
  7. $smf_tables = array('log_mark_read', 'log_notify', 'log_actions', 'log_activity', );
  8.  
  9. // My settings brings all the coders to the yard...
  10. $reset_settings = array(
  11. 'shd_staff_badge' => 'nobadge',
  12. 'shd_display_avatar' => 0,
  13. 'shd_disable_action_log' => 0,
  14. 'shd_ticketnav_style' => 'sd',
  15. 'shd_allow_ticket_bbc' => 1,
  16. 'shd_allow_ticket_smileys' => 1,
  17. 'shd_enabled_bbc' => 1,
  18. 'shd_helpdesk_only' => 0,
  19. 'shd_attachments_mode' => 'ticket',
  20. 'shd_disable_pm' => 0,
  21. 'shd_disable_mlist' => 0,
  22. 'shd_bbc' => implode(',', $bbc_tags),
  23. 'shd_staff_ticket_self' => 1,
  24. 'shd_privacy_display' => 'smart',
  25. 'settings_updated' => time(),
  26. );
  27.  
  28. // The default topic title.
  29. $topic = 'Welcome to the SimpleDesk Demo';
  30.  
  31. // The default topic body.
  32. $message = 'Welcome to the SimpleDesk Demo.[br]
  33. We have provided this demo forum as a means to allow you to demo our software.[br]
  34. [br]
  35. SimpleDesk Administrator login: Admin / admin[br]
  36. SimpleDesk Staff user login: Staff / staff[br]
  37. SimpleDesk Regular user login: User / user[br]';
  38.  
  39. // Join us, SMF.
  40. require_once('SSI.php');
  41.  
  42. // Clean the tables.
  43. foreach ($sd_tables as $table)
  44. $smcFunc['db_query']('', 'TRUNCATE {db_prefix}helpdesk_{raw:table}', array('table' => $table));
  45.  
  46. // Collect bbc.
  47. $bbc_tags = array();
  48. foreach (parse_bbc(false) AS $tag)
  49. $bbc_tags[] = $tag['tag'];
  50.  
  51. // Update the Settings table.
  52. updateSettings($reset_settings);
  53.  
  54. // Clean the SMF topics and messages, leaving only default. This is done because posts are allowed for move to topic/ticket feature
  55. $smcFunc['db_query']('', 'DELETE FROM {db_prefix}topics WHERE id_topic > 1', array());
  56. $smcFunc['db_query']('', 'DELETE FROM {db_prefix}messages WHERE id_msg > 1', array());
  57.  
  58. // Reset the auto-increment count.
  59. $smcFunc['db_query']('', 'ALTER TABLE {db_prefix}topics AUTO_INCREMENT = 1', array());
  60. $smcFunc['db_query']('', 'ALTER TABLE {db_prefix}messages AUTO_INCREMENT = 1', array());
  61.  
  62. // Clean any SMF logs such as read log pretaining to topics and messages caused by SD actions.
  63. foreach ($smf_tables as $table)
  64. $smcFunc['db_query']('', 'TRUNCATE {db_prefix}{raw:table}', array('table' => $table));
  65.  
  66. // Do the actual change to message table.
  67. $smcFunc['db_query']('', '
  68. UPDATE {db_prefix}messages
  69. SET
  70. subject = {string:topic},
  71. body = {string:message},
  72. id_msg_modified = 1,
  73. poster_name = {string:name},
  74. poster_email = {string:email},
  75. poster_ip = {string:ip},
  76. smileys_enabled = 1,
  77. modified_time = 0,
  78. modified_name = {string:empty},
  79. icon = {string:xx},
  80. approved = 1,
  81. id_member = 0,
  82. poster_time = {int:time}
  83. WHERE id_msg = 1',
  84. 'topic' => $topic,
  85. 'message' => $message,
  86. 'name' => 'SimpleDesk Team',
  87. 'email' => 'void@simpledesk.net',
  88. 'ip' => '127.0.0.1',
  89. 'empty' => '',
  90. 'xx' => 'xx',
  91. 'time' => (int) strtotime('Janurary 1st, 2010'),
  92. )
  93. );
  94.  
  95. // Now topics table.
  96. $smcFunc['db_query']('', '
  97. UPDATE {db_prefix}topics
  98. SET
  99. is_sticky = 0,
  100. id_first_msg = 1,
  101. id_last_msg = 1,
  102. id_member_started = 0,
  103. id_member_updated = 0,
  104. id_poll = 0,
  105. id_previous_board = 0,
  106. id_previous_topic = 0,
  107. num_replies = 0,
  108. num_views = 0,
  109. locked = 0,
  110. unapproved_posts = 0,
  111. approved = 1
  112. WHERE id_topic = 1', array());
  113.  
  114. // TODO: Fail checks, email webmaster@simpledesk.net on errors and return false for error handler to show a message (Need to setup that email address first [HA!])
  115.  
  116. // For now this just redirects.
  117. redirectexit();
  118.  
  119. return true; exit;
  120. ?>
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