Guest User

Untitled

a guest
Aug 6th, 2013
137
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. /**
  4.  * Implementation of Social Engine converter.
  5.  */
  6. class SocialEngine extends BBP_Converter_Base {
  7.  
  8.     function __construct() {
  9.         parent::__construct();
  10.         $this->setup_globals();
  11.     }
  12.  
  13.     public function setup_globals() {
  14.         /** Forum Section ***************************************************** */
  15.         // Forum id. Stored in postmeta.
  16.         $this->field_map[] = array(
  17.             'from_tablename' => 'se_forums',
  18.             'from_fieldname' => 'forum_id',
  19.             'to_type' => 'forum',
  20.             'to_fieldname' =>
  21.             '_bbp_forum_id'
  22.         );
  23.  
  24.         // Forum parent id.  If no parent, than 0. Stored in postmeta.
  25.         $this->field_map[] = array(
  26.             'from_tablename' => 'se_forumtopics',
  27.             'from_fieldname' => 'forumtopic_forum_id',
  28.             'to_type' => 'forum',
  29.             'to_fieldname' => '_bbp_parent_id'
  30.         );
  31.  
  32.         // Forum title.
  33.         $this->field_map[] = array(
  34.             'from_tablename' => 'se_forums',
  35.             'from_fieldname' => 'forum_title',
  36.             'join_tablename' => 'se_languagevars',
  37.             'join_type' => 'INNER',
  38.             'join_expression' => 'USING(languagevar_id)',
  39.             'to_type' => 'forum',
  40.             'to_fieldname' => 'post_title'
  41.         );
  42.  
  43.         // Forum slug. Clean name.
  44.         $this->field_map[] = array(
  45.             'from_tablename' => 'forum',
  46.             'from_fieldname' => 'title_clean',
  47.             'to_type' => 'forum',
  48.             'to_fieldname' => 'post_name',
  49.             'callback_method' => 'callback_slug'
  50.         );
  51.  
  52.         // Forum description.
  53.         $this->field_map[] = array(
  54.             'from_tablename' => 'se_forums',
  55.             'from_fieldname' => 'forum_desc',
  56.             'join_tablename' => 'se_languagevars',
  57.             'join_type' => 'INNER',
  58.             'join_expression' => 'USING(languagevar_id)',
  59.             'to_type' => 'forum', 'to_fieldname' => 'post_content',
  60.             'callback_method' => 'callback_null'
  61.         );
  62.  
  63.         // Forum display order.  Starts from 1.
  64.         $this->field_map[] = array(
  65.             'from_tablename' => 'se_forums',
  66.             'from_fieldname' => 'forum_order',
  67.             'to_type' => 'forum',
  68.             'to_fieldname' => 'menu_order'
  69.         );
  70.        
  71.         // Forum date update.
  72.         $this->field_map[] = array(
  73.             'to_type' => 'forum',
  74.             'to_fieldname' => 'post_date',
  75.             'default' => date('Y-m-d H:i:s')
  76.         );
  77.  
  78.         /** Topic Section ***************************************************** */
  79.         // Topic id. Stored in postmeta.
  80.         $this->field_map[] = array(
  81.             'from_tablename' => 'se_forumtopics',
  82.             'from_fieldname' => 'forumtopic_id',
  83.             'to_type' => 'topic',
  84.             'to_fieldname' => '_bbp_topic_id'
  85.         );
  86.  
  87.         // Forum id. Stored in postmeta.
  88.         $this->field_map[] = array(
  89.             'from_tablename' => 'se_forumtopics',
  90.             'from_fieldname' => 'forumtopic_forum_id',
  91.             'to_type' => 'topic',
  92.             'to_fieldname' => '_bbp_forum_id',
  93.             'callback_method' => 'callback_forumid'
  94.         );
  95.  
  96.         // Topic author.
  97.         $this->field_map[] = array(
  98.             'from_tablename' => 'se_forumposts',
  99.             'from_fieldname' => 'forumpost_authoruser_id',
  100.             'to_type' => 'topic',
  101.             'to_fieldname' => 'post_author',
  102.             'callback_method' => 'callback_userid'
  103.         );
  104.  
  105.         // Topic title.
  106.         $this->field_map[] = array(
  107.             'from_tablename' => 'se_forumtopis',
  108.             'from_fieldname' => 'forumtopic_subject',
  109.             'to_type' => 'topic',
  110.             'to_fieldname' => 'post_title'
  111.         );
  112.  
  113.         // Forum id.  If no parent, than 0.
  114.         $this->field_map[] = array(
  115.             'from_tablename' => 'thread',
  116.             'from_fieldname' => 'forumid',
  117.             'to_type' => 'topic',
  118.             'to_fieldname' => 'post_parent',
  119.             'callback_method' => 'callback_forumid'
  120.         );
  121.  
  122.         /** Post Section ***************************************************** */
  123.         // Post id. Stores in postmeta.
  124.         $this->field_map[] = array(
  125.             'from_tablename' => 'se_forumposts',
  126.             'from_fieldname' => 'forumpost_id',
  127.             'to_type' => 'reply',
  128.             'to_fieldname' => '_bbp_post_id'
  129.         );
  130.  
  131.         // Topic id. Stores in postmeta.
  132.         $this->field_map[] = array(
  133.             'from_tablename' => 'se_forumposts',
  134.             'from_fieldname' => 'forumpost_forumtopic_id',
  135.             'to_type' => 'reply',
  136.             'to_fieldname' => '_bbp_topic_id',
  137.             'callback_method' => 'callback_topicid'
  138.         );
  139.  
  140.         // Author ip.
  141.         $this->field_map[] = array(
  142.             'from_tablename' => 'se_users',
  143.             'from_fieldname' => 'user_ip_lastactive',
  144.             'to_type' => 'reply',
  145.             'to_fieldname' => '__bbp_author_ip'
  146.         );
  147.  
  148.         // Post author.
  149.         $this->field_map[] = array(
  150.             'from_tablename' => 'se_forumposts',
  151.             'from_fieldname' => 'forumpost_authoruser_id',
  152.             'to_type' => 'reply',
  153.             'to_fieldname' => 'post_author',
  154.             'callback_method' => 'callback_userid'
  155.         );
  156.  
  157.         // Post content.
  158.         $this->field_map[] = array(
  159.             'from_tablename' => 'se_forumposts',
  160.             'from_fieldname' => 'forumpost_body',
  161.             'to_type' => 'reply',
  162.             'to_fieldname' => 'post_content',
  163.             'callback_method' => 'callback_html'
  164.         );
  165.  
  166.        
  167.     }
  168.  
  169.     /**
  170.      * This method allows us to indicates what is or is not converted for each
  171.      * converter.
  172.      */
  173.     public function info() {
  174.         return '';
  175.     }
  176.  
  177.     /**
  178.      * This method is to save the salt and password together.  That
  179.      * way when we authenticate it we can get it out of the database
  180.      * as one value. Array values are auto sanitized by WordPress.
  181.      */
  182.     public function callback_savepass($field, $row) {
  183.         return false;
  184.     }
  185.  
  186.     /**
  187.      * This method is to take the pass out of the database and compare
  188.      * to a pass the user has typed in.
  189.      */
  190.     public function authenticate_pass($password, $serialized_pass) {
  191.         return false;
  192.     }
  193.  
  194. }
RAW Paste Data