コード例 #1
0
ファイル: wowbb.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_calendar($db, $table_prefix, $file_base)
 {
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'calendar');
     foreach ($rows as $row) {
         if (import_check_if_imported('event', strval($row['event_id']))) {
             continue;
         }
         $submitter = import_id_remap_get('member', strval($row['user_id']), true);
         if (is_null($submitter)) {
             $submitter = $GLOBALS['OCF_DRIVER']->get_guest_id();
         }
         $recurrence = 'none';
         $recurrences = NULL;
         if ($row['event_recurrence'] == 1) {
             $bits = explode('|', $row['event_recurrence_settings']);
             // $num_units, $every, $days_of_week (e.g. 1,2,5 (sunday is 0)), $which_week, $recurrence_ends
             if ($bits[3] == 'd' || $bits[3] == 'l') {
                 $bits[3] = '1';
             }
             $recurrence_part = str_repeat('0', intval($bits[3]) - 1) . '1';
             switch ($bits[1]) {
                 case 'd':
                     $recurrence = 'daily';
                     if ($bits[4] != '') {
                         $recurrences = (strtotime($bits[4]) - strtotime($row['event_start'])) / (60 * 60 * 24 * $bits[0] * (is_numeric($bits[3]) ? intval($bits[3]) : 1));
                     }
                     break;
                 case 'w':
                     if ($bits[2] == '') {
                         $recurrence = 'weekly';
                     } else {
                         $days = explode(',', $bits[2]);
                         $string = '0000000';
                         foreach ($days as $day) {
                             $string[$day] = '1';
                         }
                         $recurrence = 'weekly';
                         $recurrence_part = str_repeat('0000000', intval($bits[3]) - 1) . $string;
                     }
                     if ($bits[4] != '') {
                         $recurrences = (strtotime($bits[4]) - strtotime($row['event_start'])) / (60 * 60 * 24 * 7 * $bits[0] * (is_numeric($bits[3]) ? intval($bits[3]) : 1));
                     }
                     break;
                 case 'm':
                     $recurrence = 'monthly';
                     if ($bits[4] != '') {
                         $recurrences = (strtotime($bits[4]) - strtotime($row['event_start'])) / (60 * 60 * 24 * 32 * $bits[0] * (is_numeric($bits[3]) ? intval($bits[3]) : 1));
                     }
                     break;
                 case 'y':
                     $recurrence = 'yearly';
                     if ($bits[4] != '') {
                         $recurrences = (strtotime($bits[4]) - strtotime($row['event_start'])) / (60 * 60 * 24 * 365 * $bits[0] * (is_numeric($bits[3]) ? intval($bits[3]) : 1));
                     }
                     break;
             }
             $string = str_pad('', strlen($recurrence_part) * intval($bits[0]));
             for ($i = 0; $i < strlen($string); $i++) {
                 $string[$i] = $recurrence_part[$i / intval($bits[0])];
             }
             $recurrence .= ' ' . $string;
         }
         list($start_year, $start_month, $start_day, $start_hour, $start_minute) = explode('-', date('Y-m-d-h-i', strtotime($row['event_start'])));
         list($end_year, $end_month, $end_day, $end_hour, $end_minute) = explode('-', date('Y-m-d-h-i', strtotime($row['event_end'])));
         $id_new = add_calendar_event(db_get_first_id() + 1, $recurrence, intval(floor($recurrences)), 0, $row['event_title'], $row['event_note'], 3, $row['event_public'], $start_year, $start_month, $start_day, $start_hour, $start_minute, $end_year, $end_month, $end_day, $end_hour, $end_minute, NULL, 1, $submitter, 0, strtotime($row['event_start']));
         import_id_remap_put('event', strval($row['event_id']), $id_new);
     }
 }
コード例 #2
0
ファイル: aef.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_notifications($db, $table_prefix, $file_base)
 {
     require_code('notifications');
     $row_start = 0;
     $rows = array();
     do {
         $rows = $db->query('SELECT * FROM ' . $table_prefix . 'notify_topic', 200, $row_start);
         foreach ($rows as $row) {
             if (import_check_if_imported('topic_notification', strval($row['notify_tid']) . '-' . strval($row['notify_mid']))) {
                 continue;
             }
             $member_id = import_id_remap_get('member', strval($row['notify_mid']), true);
             if (is_null($member_id)) {
                 continue;
             }
             $topic_id = import_id_remap_get('topic', strval($row['notify_tid']), true);
             if (is_null($topic_id)) {
                 continue;
             }
             enable_notifications('ocf_topic', strval($topic_id), $member_id);
             import_id_remap_put('topic_notification', strval($row['notify_tid']) . '-' . strval($row['notify_mid']), 1);
         }
         $row_start += 200;
     } while (count($rows) > 0);
 }
コード例 #3
0
ファイル: vb3.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_points_gifts_and_charges($db, $table_prefix, $file_base)
 {
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'reputation');
     foreach ($rows as $row) {
         if (import_check_if_imported('points', strval($row['reputationid']))) {
             continue;
         }
         $time = $row['dateline'];
         $amount = $row['reputation'];
         $viewer_member = import_id_remap_get('member', strval($row['whoadded']), true);
         $member = import_id_remap_get('member', strval($row['userid']), true);
         $reason = $row['reason'];
         $anonymous = 0;
         $GLOBALS['SITE_DB']->query_insert('gifts', array('date_and_time' => $time, 'amount' => $amount, 'gift_from' => $viewer_member, 'gift_to' => $member, 'reason' => insert_lang_comcode($reason, 4), 'anonymous' => $anonymous));
         import_id_remap_put('points', strval($row['reputationid']), -1);
     }
 }
コード例 #4
0
ファイル: ocp_merge.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_menu_items($db, $table_prefix, $file_base)
 {
     $parent_rows = $db->query('SELECT * FROM ' . $table_prefix . 'menu_items');
     if (is_null($parent_rows)) {
         return;
     }
     foreach ($parent_rows as $row) {
         $id_old = strval($row['id']);
         unset($row['id']);
         $row['i_parent'] = is_null($row['i_parent']) ? NULL : -$row['i_parent'];
         $row['i_caption'] = $this->get_lang_string($db, $row['i_caption']);
         $row['i_caption_long'] = $this->get_lang_string($db, $row['i_caption_long']);
         $id_new = $GLOBALS['SITE_DB']->query_insert('menu_items', $row, true);
         import_id_remap_put('menu_item', $id_old, $id_new);
     }
     $child_rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'menu_items WHERE i_parent<0');
     foreach ($child_rows as $row) {
         $row['i_parent'] = import_id_remap_get('menu_item', strval(-$row['i_parent']), true);
         $GLOBALS['SITE_DB']->query_update('menu_items', $row, array('id' => $row['id']), '', 1);
     }
 }
コード例 #5
0
ファイル: smf2.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_calendar($db, $table_prefix, $file_base)
 {
     require_code('calendar2');
     $rows = $db->query_select('calendar');
     foreach ($rows as $row) {
         if (import_check_if_imported('event', strval($row['id_event']))) {
             continue;
         }
         $submitter = import_id_remap_get('member', strval($row['id_member']), true);
         if (is_null($submitter)) {
             $submitter = $GLOBALS['OCF_DRIVER']->get_guest_id();
         }
         $recurrence = 'none';
         $recurrences = NULL;
         $days = intval(floor((strtotime($row['end_date']) - strtotime($row['start_date'])) / (60 * 60 * 24)));
         //Max 7 days in SMF
         if ($days == 0) {
             $recurrence = 'none';
         } else {
             $recurrence = 'daily ';
             for ($i = 1; $i <= $days; $i++) {
                 $recurrence .= '1';
             }
         }
         list($start_year, $start_month, $start_day, $start_hour, $start_minute) = array_map('intval', explode('-', date('Y-m-d-h-i', strtotime($row['start_date']))));
         list($end_year, $end_month, $end_day, $end_hour, $end_minute) = array_map('intval', explode('-', date('Y-m-d-h-i', strtotime($row['end_date']))));
         $description = '';
         if ($row['id_topic'] != 0) {
             $atts = $db->query('SELECT * FROM ' . $table_prefix . 'attachments WHERE id_msg=' . strval($row['id_topic']) . ' ORDER BY id_msg ASC');
             $attid = isset($atts[0]['id_attach']) ? $atts[0]['id_attach'] : 0;
             $att_imported = $attid > 0 && import_check_if_imported('post_files', strval($attid)) ? true : false;
             $messages = $db->query('SELECT * FROM ' . $table_prefix . 'messages WHERE id_topic=' . strval($row['id_topic']) . ' ORDER BY id_topic ASC');
             $description = isset($messages[0]['body']) && $messages[0]['body'] != '' ? str_replace(array('[html]', '[/html]'), array('', ''), html_to_comcode($messages[0]['body'])) : '';
         }
         if ($att_imported) {
             $attid_new = import_id_remap_get('post_files', strval($attid), true);
             $description .= "\n\n" . '[attachment]' . strval($attid_new) . '[/attachment]';
         }
         $id_new = add_calendar_event(db_get_first_id() + 1, $recurrence, $recurrences, 0, $row['title'], $description, 3, 1, $start_year, $start_month, $start_day, $start_hour, $start_minute, $end_year, $end_month, $end_day, $end_hour, $end_minute, NULL, 1, 1, 1, 1, 1, '', $submitter);
         if ($att_imported) {
             $GLOBALS['SITE_DB']->query_insert('attachment_refs', array('r_referer_type' => 'calendar', 'r_referer_id' => strval($id_new), 'a_id' => $attid_new));
         }
         import_id_remap_put('event', strval($row['id_event']), $id_new);
     }
     $rows = array();
     $rows = $db->query_select('calendar_holidays');
     foreach ($rows as $row) {
         if (import_check_if_imported('event_holiday', strval($row['id_holiday']))) {
             continue;
         }
         $submitter = $GLOBALS['OCF_DRIVER']->get_guest_id();
         $recurrence = 'none';
         $recurrences = NULL;
         list($start_year, $start_month, $start_day, $start_hour, $start_minute) = array_map('intval', explode('-', date('Y-m-d-h-i', strtotime($row['event_date']))));
         list($end_year, $end_month, $end_day, $end_hour, $end_minute) = array_map('intval', explode('-', date('Y-m-d-h-i', strtotime($row['event_date']))));
         $id_new = add_calendar_event(db_get_first_id() + 1, $recurrence, $recurrences, 0, $row['title'], $row['title'], 3, 1, $start_year, $start_month, $start_day, $start_hour, $start_minute, $end_year, $end_month, $end_day, $end_hour, $end_minute, NULL, 1, 1, 1, 1, 1, '', $submitter);
         import_id_remap_put('event_holiday', strval($row['id_holiday']), $id_new);
     }
 }
コード例 #6
0
ファイル: joomla.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_banners($db, $table_prefix, $old_base_dir)
 {
     require_code('banners2');
     $categories = $db->query("SELECT title,id FROM " . $table_prefix . "categories WHERE section='com_banner'");
     foreach ($categories as $category) {
         $cat_title = $category['title'];
         $category_exist = $GLOBALS['SITE_DB']->query_value_null_ok('banner_types', 'id', array('id' => $category['title']));
         if (is_null($category_exist)) {
             add_banner_type($cat_title, 1, 160, 600, 70, 1);
         }
         $rows = $db->query("SELECT b.publish_down ,b.bid,c.title,b.name, b.clickurl, b.imageurl,b.date,bc.contact,bc.extrainfo,bc.email,b.showBanner,b.clicks,b.impmade FROM " . $table_prefix . "banner b INNER JOIN " . $table_prefix . "bannerclient bc ON b.cid=bc.cid INNER JOIN " . $table_prefix . "categories c ON b.catid=c.id AND c.title='" . db_escape_string($cat_title) . "' AND c.title <> ''");
         foreach ($rows as $row) {
             $name = $row['name'] . strval($row['bid']);
             $test = $GLOBALS['SITE_DB']->query_value_null_ok('banners', 'name', array('name' => $name));
             if (is_null($test)) {
                 if ($row['imageurl'] != '') {
                     $newimagepath = get_custom_file_base() . '/uploads/banners/' . rawurldecode($row['imageurl']);
                     $newimage = $row['imageurl'];
                     $oldimagepath = $old_base_dir . "/images/banners/" . rawurldecode($row['imageurl']);
                     @copy($oldimagepath, $newimagepath);
                 } else {
                     $newimage = '';
                 }
                 $type = 0;
                 // Permanent
                 $campaignremaining = 0;
                 // Irrelevant
                 $caption = $row['name'];
                 $end_date = $this->mysql_time_to_timestamp($row['publish_down']);
                 if ($end_date === false) {
                     $end_date = NULL;
                 }
                 $url = $row['clickurl'];
                 $image_url = $newimage;
                 $member = $GLOBALS['FORUM_DRIVER']->get_member_from_username($row['contact']);
                 if (is_null($member)) {
                     $member = get_member();
                 }
                 $desc = $row['email'] . chr(10) . $row['extrainfo'];
                 $desc = html_to_comcode($desc);
                 add_banner($name, $image_url, '', $caption, $campaignremaining, $url, 10, $desc, $type, $end_date, $member, 1, $cat_title, NULL, 0, 0, $row['clicks'], 0, $row['impmade']);
             }
         }
     }
     $row_start = 0;
     $rows = array();
     do {
         $rows = $db->query("SELECT u.id, u.username, u.password, u.email, u.id, u.registerDate, u.lastvisitDate, u.sendEmail FROM " . $table_prefix . "bannerclient AS b INNER JOIN " . $table_prefix . "users AS u ON b.contact=u.name", 200, $row_start);
         foreach ($rows as $row) {
             if (import_check_if_imported('member', strval($row['id']))) {
                 continue;
             }
             $test = $GLOBALS['OCF_DRIVER']->get_member_from_username($row['username']);
             if (!is_null($test)) {
                 import_id_remap_put('member', strval($row['id']), $test);
                 continue;
             }
             $primary_group = get_first_default_group();
             $custom_fields = array();
             $datetimearr = explode(' ', $row['registerDate']);
             $datearr = explode('-', $datetimearr[0]);
             $timearr = explode(':', $datetimearr[1]);
             $date = $datearr[2];
             $month = $datearr[1];
             $year = $datearr[0];
             $hour = $timearr[0];
             $min = $timearr[1];
             $sec = $timearr[2];
             $register_date = mktime($hour, $min, $sec, $month, $date, $year);
             $datetimearr = explode(' ', $row['lastvisitDate']);
             $datearr = explode('-', $datetimearr[0]);
             $timearr = explode(':', $datetimearr[1]);
             $date = $datearr[2];
             $month = $datearr[1];
             $year = $datearr[0];
             $hour = $timearr[0];
             $min = $timearr[1];
             $sec = $timearr[2];
             $last_visit_date = mktime($hour, $min, $sec, $month, $date, $year);
             $id = get_param_integer('keep_preserve_ids', 0) == 0 ? NULL : $row['id'];
             $id_new = ocf_make_member($row['username'], $row['password'], $row['email'], NULL, NULL, NULL, NULL, $custom_fields, NULL, $primary_group, 1, $register_date, $last_visit_date, '', NULL, '', 0, 0, 1, $row['name'], '', '', 1, 1, NULL, $row['sendEmail'], $row['sendEmail'], '', NULL, '', FALSE, NULL, '', 1, $last_visit_date, $id, 0, '*', '');
             import_id_remap_put('member', strval($row['id']), $id_new);
         }
         $row_start += 200;
     } while (count($rows) > 0);
 }
コード例 #7
0
ファイル: ipb1.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_ocf_personal_topics($db, $table_prefix, $old_base_dir)
 {
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'messages WHERE vid<>\'sent\' ORDER BY msg_date');
     // Group them up into what will become topics
     $groups = array();
     foreach ($rows as $row) {
         if ($row['from_id'] > $row['recipient_id']) {
             $a = $row['recipient_id'];
             $b = $row['from_id'];
         } else {
             $a = $row['from_id'];
             $b = $row['recipient_id'];
         }
         $title = str_replace('Re: ', '', $row['title']);
         $title = str_replace('RE: ', '', $title);
         $title = str_replace('Re:', '', $title);
         $title = str_replace('RE:', '', $title);
         $groups[strval($a) . ':' . strval($b) . ':' . @html_entity_decode($title, ENT_QUOTES, get_charset())][] = $row;
     }
     // Import topics
     foreach ($groups as $group) {
         $row = $group[0];
         if (import_check_if_imported('pt', strval($row['msg_id']))) {
             continue;
         }
         // Create topic
         $from_id = import_id_remap_get('member', strval($row['from_id']), true);
         if (is_null($from_id)) {
             $from_id = $GLOBALS['OCF_DRIVER']->get_guest_id();
         }
         $to_id = import_id_remap_get('member', strval($row['recipient_id']), true);
         if (is_null($to_id)) {
             $to_id = $GLOBALS['OCF_DRIVER']->get_guest_id();
         }
         $topic_id = ocf_make_topic(NULL, '', '', 1, 1, 0, 0, 0, $from_id, $to_id, false);
         $first_post = true;
         foreach ($group as $_postdetails) {
             if ($first_post) {
                 $title = @html_entity_decode($row['title'], ENT_QUOTES, get_charset());
             } else {
                 $title = '';
             }
             $post = $this->clean_ipb_post($_postdetails['message']);
             $validated = 1;
             $from_id = import_id_remap_get('member', strval($_postdetails['from_id']), true);
             if (is_null($from_id)) {
                 $from_id = $GLOBALS['OCF_DRIVER']->get_guest_id();
             }
             $poster_name_if_guest = $GLOBALS['OCF_DRIVER']->get_member_row_field($from_id, 'm_username');
             $ip_address = $GLOBALS['OCF_DRIVER']->get_member_row_field($from_id, 'm_ip_address');
             $time = $_postdetails['msg_date'];
             $poster = $from_id;
             $last_edit_time = NULL;
             $last_edit_by = NULL;
             ocf_make_post($topic_id, $title, $post, 0, $first_post, $validated, 0, $poster_name_if_guest, $ip_address, $time, $poster, NULL, $last_edit_time, $last_edit_by, false, false, NULL, false);
             $first_post = false;
         }
         import_id_remap_put('pt', strval($row['msg_id']), $topic_id);
     }
 }
コード例 #8
0
ファイル: mkportal.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_images_and_galleries($db, $table_prefix, $old_base_dir)
 {
     require_code('galleries2');
     //check is the comment forum configured in ocPortal
     $this->test_for_comments_forum();
     $ocp_path = get_custom_file_base();
     //copy watermark image
     $save_filename = $old_base_dir . 'mkportal/modules/gallery/wt.png';
     //NOTE: this is the default watermark image in MKPortal, if customer needs to use another image, he/she needs to overwite it
     $watermark_image = '';
     if (file_exists($save_filename)) {
         $copy_destination = $ocp_path . '/uploads/watermarks/wt.png';
         @copy($save_filename, $copy_destination);
         fix_permissions($copy_destination);
         sync_file($copy_destination);
         $watermark_image = get_custom_base_url() . '/uploads/watermarks/wt.png';
     }
     //now we need to get MKPortal settings for the watermark images
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'config WHERE ' . db_string_equal_to('chiave', 'watermark_pos') . ' OR ' . db_string_equal_to('chiave', 'watermark_enable'));
     $watermark_pos = '2';
     //Possible values: 0 - Top-right; 1 - Center; 2 - Bottom-right (default for MKPortal)
     $watermark_enable = '0';
     //by default it is disabled
     foreach ($rows as $row) {
         if ($row['chiave'] == 'watermark_pos') {
             $watermark_pos = $row['valore'];
             if ($watermark_pos == '1') {
                 $watermark_pos = '2';
                 //ocPortal doesn't have watermark center position, so we will use the mkPortal default position: Bottom-right
             }
             continue;
         }
         if ($row['chiave'] == 'watermark_enable') {
             $watermark_enable = $row['valore'];
             continue;
         }
     }
     //add galleries first
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'gallery_events');
     //for some strange reason the gallery categories are called events
     foreach ($rows as $row) {
         $test = $GLOBALS['SITE_DB']->query_value_null_ok('galleries', 'name', array('name' => $row['evento']));
         if (is_null($test)) {
             $rep_image = '';
             $add_date = $db->query_value_null_ok('gallery', 'MIN(data)', array('evento' => $row['id']));
             $add_date = !is_null($add_date) ? $add_date : time();
             //set default values for the watermark positions
             $watermark_top_left = '';
             $watermark_top_right = '';
             $watermark_bottom_left = '';
             $watermark_bottom_right = '';
             if ($watermark_enable == '1' && strlen($watermark_image) > 0 && file_exists($watermark_image)) {
                 //$watermark_pos - Possible values: 0 - Top-right; 1 - Center; 2 - Bottom-right (default for MKPortal)
                 if ($watermark_pos == '2') {
                     $watermark_top_right = $watermark_image;
                 } else {
                     $watermark_bottom_right = $watermark_image;
                 }
             }
             $row['evento'] = @html_entity_decode($row['evento'], ENT_QUOTES, get_charset());
             //find is there already a personal category container
             $pcc_gallery = $GLOBALS['SITE_DB']->query_select('galleries', NULL, array('name' => 'gallery_' . strval($row['father'])));
             $main_gallery = $GLOBALS['SITE_DB']->query_select('galleries', NULL, array('parent_id' => ''));
             $root_gallery = isset($pcc_gallery[0]['name']) && strlen($pcc_gallery[0]['name']) > 0 ? $pcc_gallery[0]['name'] : isset($main_gallery[0]['name']) && strlen($main_gallery[0]['name']) > 0 ? $main_gallery[0]['name'] : 'root';
             $check_gallery_imported = $GLOBALS['SITE_DB']->query_select('galleries', NULL, array('name' => 'gallery_' . strval($row['id'])));
             if (!array_key_exists(0, $check_gallery_imported)) {
                 add_gallery('gallery_' . strval($row['id']), $row['evento'], '', '', '', $root_gallery, 1, 0, 0, 0, $rep_image, $watermark_top_left, $watermark_top_right, $watermark_bottom_left, $watermark_bottom_right, 1, 1, false, $add_date);
             }
         }
     }
     //get comments forum
     $forum_name = get_option('comments_forum_name');
     ocf_over_msn();
     //used to fixed the correct forum prefix
     $forum_id = $GLOBALS['FORUM_DRIVER']->forum_id_from_name($forum_name);
     ocf_over_local();
     //used to fixed the correct forum prefix
     //now we need to import the images
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'gallery ORDER BY id');
     // NB: In MKPortal "gallery" is the images table, and "gallery_events" is the galleries table
     foreach ($rows as $row) {
         if (import_check_if_imported('image', strval($row['id']))) {
             continue;
         }
         $submitter = $row['idauth'];
         //import_id_remap_get('member',$GLOBALS['FORUM_DRIVER']->get_member_from_username($row['autore']),true);
         if (is_null($submitter)) {
             $submitter = $GLOBALS['FORUM_DRIVER']->get_guest_id();
         }
         $id = get_param_integer('keep_preserve_ids', 0) == 0 ? NULL : $row['id'];
         ocf_over_msn();
         $comment_text = html_to_comcode($row['titolo'] . ' ' . $row['descrizione']);
         ocf_over_local();
         //copy image and thumbnail and apply urls
         $url = '';
         $thumb_url = '';
         //image source and destination
         $save_filename = $old_base_dir . '/mkportal/modules/gallery/album/' . $row['file'];
         $copy_destination = $ocp_path . '/uploads/galleries/' . $row['file'];
         //image thumbnail source and destination
         $save_tfilename = $old_base_dir . '/mkportal/modules/gallery/album/t_' . $row['file'];
         $copy_tdestination = $ocp_path . '/uploads/galleries_thumbs/' . $row['file'];
         if (@copy($save_filename, $copy_destination) !== false) {
             fix_permissions($copy_destination);
             sync_file($copy_destination);
         }
         if (@copy($save_tfilename, $copy_tdestination) !== false) {
             fix_permissions($copy_tdestination);
             sync_file($copy_tdestination);
         }
         $url = get_custom_base_url() . '/uploads/galleries/' . $row['file'];
         $thumb_url = get_custom_base_url() . '/uploads/galleries_thumbs/' . $row['file'];
         $id_new = add_image('', 'gallery_' . strval($row['evento']), $comment_text, $url, $url, $row['validate'], 1, 1, 1, '', $submitter, $row['data'], NULL, $row['click'], $id);
         import_id_remap_put('image', strval($row['id']), $id_new);
         //import comments for image
         $comments = $db->query('SELECT * FROM ' . $table_prefix . 'gallery_comments WHERE identry=' . strval($row['id']) . ' ORDER BY data');
         if (!is_null($forum_id)) {
             foreach ($comments as $comment) {
                 $member = $GLOBALS['FORUM_DRIVER']->get_member_from_username($comment['autore']);
                 if (is_null($member)) {
                     $member = $GLOBALS['FORUM_DRIVER']->get_guest_id();
                 }
                 $title = '';
                 $post = $comment['testo'];
                 $content_url = build_url(array('page' => 'galleries', 'id' => $id_new, 'type' => 'view'), get_module_zone('galleries'));
                 ocf_over_msn();
                 //used to fixed the correct forum prefix
                 $GLOBALS['FORUM_DRIVER']->make_post_forum_topic($forum_name, 'galleries_' . strval($id_new), $member, $title, html_to_comcode($post), $row['titolo'], do_lang('COMMENT'), $content_url->evaluate());
                 ocf_over_local();
                 //used to fixed the correct forum prefix
             }
         }
         //import gallery rating too
         $this->_import_ratings($db, 'galleries', $row['id'], $id_new, $row['rate'], $table_prefix);
     }
 }
コード例 #9
0
ファイル: ipb.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_ocf_warnings($db, $table_prefix, $file_base)
 {
     $select = '*';
     if (either_param('importer') == 'ipb2') {
         $select = 'wlog_id AS id,wlog_mid,wlog_notes,wlog_date,wlog_addedby,wlog_contact_content';
     }
     $rows = $db->query('SELECT ' . $select . ' FROM ' . $table_prefix . 'warn_logs');
     foreach ($rows as $row) {
         if (import_check_if_imported('warning', strval($row['id']))) {
             continue;
         }
         $member_id = import_id_remap_get('member', strval($row['wlog_mid']), true);
         if (is_null($member_id)) {
             continue;
         }
         $by = import_id_remap_get('member', strval($row['wlog_addedby']));
         $id_new = ocf_make_warning($member_id, @html_entity_decode($row['wlog_contact_content'], ENT_QUOTES, get_charset()), $by, $row['wlog_date']);
         import_id_remap_put('warning', strval($row['id']), $id_new);
     }
 }
コード例 #10
0
ファイル: smf.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_calendar($db, $table_prefix, $file_base)
 {
     require_code('calendar2');
     $rows = $db->query_select('calendar');
     foreach ($rows as $row) {
         if (import_check_if_imported('event', strval($row['ID_EVENT']))) {
             continue;
         }
         $submitter = import_id_remap_get('member', strval($row['ID_MEMBER']), true);
         if (is_null($submitter)) {
             $submitter = $GLOBALS['OCF_DRIVER']->get_guest_id();
         }
         $recurrence = 'none';
         $recurrences = NULL;
         $days = intval(floor((strtotime($row['endDate']) - strtotime($row['startDate'])) / (60 * 60 * 24)));
         //Max 7 days in SMF
         if ($days == 0) {
             $recurrence = 'daily 1';
         } else {
             $recurrence = 'daily ';
             for ($i = 1; $i <= $days; $i++) {
                 $recurrence .= '1';
             }
         }
         $start_hour = 0;
         $start_minute = 0;
         list($start_year, $start_month, $start_day) = array_map('intval', explode('-', $row['eventDate']));
         list($end_year, $end_month, $end_day, $end_hour, $end_minute) = array($start_year, $start_month, $start_day, $start_hour, $start_minute);
         $description = '';
         if ($row['ID_TOPIC'] != 0) {
             $messages = $db->query('SELECT * FROM ' . $table_prefix . 'messages WHERE ID_TOPIC=' . strval($row['ID_TOPIC']) . ' ORDER BY ID_TOPIC ASC');
             ocf_over_msn();
             $description = isset($messages[0]['body']) && $messages[0]['body'] != '' ? html_to_comcode($messages[0]['body']) : '';
             ocf_over_local();
         }
         ocf_over_msn();
         $id_new = add_calendar_event(db_get_first_id() + 1, $recurrence, $recurrences, 0, $row['title'], $description, 3, 1, $start_year, $start_month, $start_day, $start_hour, $start_minute, $end_year, $end_month, $end_day, $end_hour, $end_minute, NULL, 1, 1, 1, 1, 1, '', $submitter);
         ocf_over_local();
         import_id_remap_put('event', strval($row['ID_EVENT']), $id_new);
     }
     $rows = array();
     $rows = $db->query_select('calendar_holidays');
     foreach ($rows as $row) {
         if (import_check_if_imported('event', strval($row['ID_HOLIDAY']))) {
             continue;
         }
         $submitter = $GLOBALS['OCF_DRIVER']->get_guest_id();
         $recurrence = 'none';
         $recurrences = NULL;
         list($start_year, $start_month, $start_day, $start_hour, $start_minute) = array_map('intval', explode('-', date('Y-m-d-h-i', strtotime($row['eventDate']))));
         list($end_year, $end_month, $end_day, $end_hour, $end_minute) = array_map('intval', explode('-', date('Y-m-d-h-i', strtotime($row['eventDate']))));
         ocf_over_msn();
         $id_new = add_calendar_event(db_get_first_id() + 1, $recurrence, $recurrences, 0, $row['title'], $row['title'], 3, 1, $start_year, $start_month, $start_day, $start_hour, $start_minute, $end_year, $end_month, $end_day, $end_hour, $end_minute, NULL, 1, 1, 1, 1, 1, '', $submitter);
         ocf_over_local();
         import_id_remap_put('event', strval($row['ID_HOLIDAY']), $id_new);
     }
 }
コード例 #11
0
ファイル: phpbb3.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_ocf_custom_profile_fields($db, $table_prefix, $file_base)
 {
     $rows = $db->query('SELECT f.*,lang_explain FROM ' . $table_prefix . 'profile_fields f LEFT JOIN ' . $table_prefix . 'profile_lang l ON l.field_id=f.field_id');
     foreach ($rows as $row) {
         if (import_check_if_imported('cpf', $row['field_ident'])) {
             continue;
         }
         $name = $row['field_name'];
         $id_new = $GLOBALS['FORUM_DB']->query_value_null_ok('f_custom_fields f LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON f.cf_name=t.id', 'f.id', array('text_original' => $name));
         if (is_null($id_new)) {
             $default = $row['field_default_value'];
             $type = 'short_text';
             switch ($row['field_type']) {
                 case FIELD_INT:
                     $type = 'integer';
                     break;
                 case FIELD_TEXT:
                     $type = 'long_text';
                     break;
                 case FIELD_BOOL:
                     $type = 'tick';
                     break;
                 case FIELD_DROPDOWN:
                     $type = 'list';
                     $values = collapse_1d_complexity('lang_default_value', $db->query('SELECT lang_default_value FROM ' . $table_prefix . 'profile_lang WHERE field_id=' . strval($row['field_id'])));
                     $_default = $default;
                     foreach ($values as $value) {
                         if ($value != $default) {
                             if ($_default == '') {
                                 $_default .= '|';
                             }
                             $_default .= $value;
                         }
                     }
                     $default = $_default;
                     break;
                     /*case FIELD_DATE: Unsupported
                     		$type='integer';
                     		break;*/
             }
             $id_new = ocf_make_custom_field($name, 0, is_null($row['lang_explain']) ? '' : $row['lang_explain'], $default, 1 - $row['field_hide'], 1 - $row['field_no_view'], 1 - $row['field_no_view'], 0, $type, $row['field_show_on_reg'], 0, 0, $row['field_order']);
         }
         import_id_remap_put('cpf', $row['field_ident'], $id_new);
     }
 }
コード例 #12
0
ファイル: mybb.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_calendar($db, $table_prefix, $file_base)
 {
     require_code('calendar2');
     $rows = $db->query_select('events');
     foreach ($rows as $row) {
         if (import_check_if_imported('event', strval($row['eid']))) {
             continue;
         }
         $submitter = import_id_remap_get('member', strval($row['uid']), true);
         if (is_null($submitter)) {
             $submitter = $GLOBALS['OCF_DRIVER']->get_guest_id();
         }
         $recurrence = 'none';
         $recurrences = NULL;
         $event_repeat_data = unserialize($row['repeats']);
         $event_repeats = isset($event_repeat_data['repeats']) && $event_repeat_data['repeats'] != 0 ? $event_repeat_data['repeats'] : 0;
         switch ($event_repeats) {
             case 1:
                 $week_array = array(0, 0, 0, 0, 0, 0, 0);
                 $start_day_num = intval(date('w', $row['starttime']));
                 $every_days = $event_repeat_data['days'];
                 $week_array[$start_day_num] = 1;
                 $next_day = $start_day_num;
                 for ($i = 1; $i < 7; $i++) {
                     $next_day += $every_days;
                     if ($next_day > 6) {
                         $next_day -= 6;
                     }
                     $week_array[$next_day] = 1;
                 }
                 $recurrence = 'daily ' . implode('', $week_array);
                 break;
             case 2:
                 $recurrence = 'daily 1111100';
                 break;
             case 3:
                 $week_array = array(0, 0, 0, 0, 0, 0, 0);
                 $week_array[0] = isset($event_repeat_data['days'][0]) && $event_repeat_data['days'][0] != '' ? 1 : 0;
                 $week_array[1] = isset($event_repeat_data['days'][1]) && $event_repeat_data['days'][1] != '' ? 1 : 0;
                 $week_array[2] = isset($event_repeat_data['days'][2]) && $event_repeat_data['days'][2] != '' ? 1 : 0;
                 $week_array[3] = isset($event_repeat_data['days'][3]) && $event_repeat_data['days'][3] != '' ? 1 : 0;
                 $week_array[4] = isset($event_repeat_data['days'][4]) && $event_repeat_data['days'][4] != '' ? 1 : 0;
                 $week_array[5] = isset($event_repeat_data['days'][5]) && $event_repeat_data['days'][5] != '' ? 1 : 0;
                 $week_array[6] = isset($event_repeat_data['days'][6]) && $event_repeat_data['days'][6] != '' ? 1 : 0;
                 $recurrence = 'daily ' . implode('', $week_array);
                 break;
             case 4:
                 $pattern = '1';
                 $repeat_every_n_years = $event_repeat_data['months'];
                 for ($i = 1; $i < $repeat_every_n_years; $i++) {
                     $pattern .= '0';
                 }
                 $recurrence = 'monthly ' . $pattern;
                 break;
             case 5:
                 $pattern = '1';
                 $repeat_every_n_years = $event_repeat_data['years'];
                 for ($i = 1; $i < $repeat_every_n_years; $i++) {
                     $pattern .= '0';
                 }
                 $recurrence = 'yearly ' . $pattern;
                 break;
         }
         list($start_year, $start_month, $start_day, $start_hour, $start_minute) = explode('-', date('Y-m-d-h-i', strtotime($row['starttime'])));
         list($end_year, $end_month, $end_day, $end_hour, $end_minute) = explode('-', date('Y-m-d-h-i', strtotime($row['endtime'])));
         ocf_over_msn();
         $id_new = add_calendar_event(db_get_first_id() + 1, $recurrence, $recurrences, 0, $row['name'], $row['description'], 3, $row['visible'], $start_year, $start_month, $start_day, $start_hour, $start_minute, $end_year, $end_month, $end_day, $end_hour, $end_minute, NULL, 1, $submitter, 0, $row['dateline']);
         ocf_over_local();
         import_id_remap_put('event', strval($row['eid']), $id_new);
     }
 }