- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
<?php
include_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
module_load_include('inc', 'node', 'node.pages');
$queryPopQueue = "select * from custom_contact_insert where drupal_node_id is null limit 50";
$queryResult = db_query($queryPopQueue);
while ($data = db_fetch_object($queryResult)){
$node->type = 'contact';
node_object_prepare($node);
$node->uid = 1;
$node->title = $data->field_contact_first_name_value . ' ' . $data->field_contact_last_name_value;
$node->body = "";
$node->teaser = "";
$node->filter = variable_get('filter_default_format', 1);
$node->format = FILTER_FORMAT_DEFAULT;
$node->language = '';
$node->revision = 0;
$node->promote = 0;
$node->created = time();
$node->comment= 0;
$node->taxonomy = array('tags' => array('11' => ($data->categories)));
$node->field_contact_first_name[0]['value'] = $data->field_contact_first_name_value;
$node->field_contact_last_name[0]['value'] = $data->field_contact_last_name_value;
$node->field_contact_job_title[0]['value'] = $data->field_contact_job_title_value;
$node->field_contact_organization[0]['value'] = $data->field_contact_organization_value;
$node->field_contact_organization_r['nid']['nid'] = '463'; //this is a sample hard coded value
$node->field_contact_account_sfid[0]['value'] = $data->field_contact_account_sfid_value;
$node->field_contact_sfid[0]['value'] = $data->field_contact_sfid_value;
$node->field_contact_email_optout[0]['value'] = 'false';
$node->field_contact_phone_optout[0]['value'] = 'false';
$node->field_contact_add1_city[0]['value'] = $data->field_contact_add1_city_value;
$node->field_contact_add1_country[0]['value'] = $data->field_contact_add1_country_value;
$node->field_contact_add1_zipcode[0]['value'] = $data->field_contact_add1_zipcode_value;
$node->field_contact_add1_state[0]['value'] = $data->field_contact_add1_state_value;
$node->field_contact_add1_street[0]['value'] = $data->field_contact_add1_street_value;
$node->field_contact_add1_type[0]['value'] = 'Work';
$node->field_contact_add2_city[0]['value'] = $data->field_contact_add2_city_value;
$node->field_contact_add2_country[0]['value'] = $data->field_contact_add2_country_value;
$node->field_contact_add2_zipcode[0]['value'] = $data->field_contact_add2_zipcode_value;
$node->field_contact_add2_state[0]['value'] = $data->field_contact_add2_state_value;
$node->field_contact_add2_street[0]['value'] = $data->field_contact_add2_street_value;
$node->field_contact_add2_type[0]['value'] = 'Home';
$node->field_contact_mobile_phone[0]['value'] = $data->field_contact_mobile_phone_value;
$node->field_contact_home_phone[0]['value'] = $data->field_contact_home_phone_value;
$node->field_contact_work_phone[0]['value'] = $data->field_contact_work_phone_value;
$node->field_contact_asst_phone[0]['value'] = $data->field_contact_asst_phone_value;
$node->field_contact_email1[0]['value'] = $data->field_contact_email1_email;
$node->field_contact_email2[0]['value'] = $data->field_contact_email2_email;
$node->field_contact_email_asst[0]['value'] = $data->field_contact_email_asst_email;
$node->field_contact_assistant[0]['value'] = $data->field_contact_assistant_value;
$node->field_contact_notes[0]['value'] = $data->notes;
node_save($node);
$nid = $node->nid;
unset($node);
//update status and drupalid in the queue
$queryUpdate = "update custom_contact_insert set drupal_node_id = '$nid', status = '1' where id = '" . $data->id . "'";
db_query($queryUpdate);
}
?>
вот вам высер. не мой на этот раз :)
mindfreakthemon 15.01.2011 00:07 # +2
http://i.imgur.com/BziyX.jpg
Lure Of Chaos 15.01.2011 00:16 # 0
DanxilLs 15.01.2011 06:59 # 0
7ion 15.01.2011 11:49 # 0
This is a sample full ultra hard shit code
Uchkuma 15.01.2011 13:25 # +1
Анонимус 16.01.2011 09:20 # 0
Vasiliy 16.01.2011 09:46 # −1
и конечно жеж node
brainstorm 16.01.2011 12:45 # 0
warider 26.01.2011 12:30 # +2
друпалид блеать!!!
brainstorm 26.01.2011 12:51 # 0
печально то что среднестатистический друпалист как правило пишет код не для того чтобы нормальные люди его юзали(да хуле сам он поди это жрать не будет) а чисса чтобы в CV вписать. опенсорс блять
bugmenot 26.01.2011 21:00 # +1
а чо, идея устроить набег и бойлерплейтов им в кодебазу
brainstorm 26.01.2011 22:43 # 0