$importPlugin =& get_import_plugin($import_cache_r['plugin_name']); if ($importPlugin !== NULL) { $inFile = import_cache_fetch_file($HTTP_VARS['ic_sequence_number']); if ($inFile) { $fileHandler = new WrapperFileHandler($inFile); // we want to display all items - no pagination. $HTTP_VARS['items_per_page'] = ''; $listingObject = new HTML_Listing($PHP_SELF, $HTTP_VARS); $listingObject->setNoRowsMessage(get_opendb_lang_var('no_items_found')); $cfg_include_header_row = strcmp($HTTP_VARS['include_header_row'], 'Y') === 0 ? TRUE : FALSE; $cfg_ignore_duplicate_title = strcmp($HTTP_VARS['ignore_duplicate_title'], 'Y') === 0 ? TRUE : FALSE; $cfg_is_trial_run = strcmp($HTTP_VARS['trial_run'], 'Y') === 0 ? TRUE : FALSE; $cfg_override_status_type = strcmp($HTTP_VARS['override_status_type'], 'Y') === 0 ? TRUE : FALSE; // force disable of duplicate titles. set_opendb_config_ovrd_var('item_input', 'duplicate_title_support', $cfg_ignore_duplicate_title); set_opendb_config_ovrd_var('listings', 'show_item_image', FALSE); //set_opendb_config_ovrd_var('item_input', 'confirm_duplicate_insert', TRUE); if (is_valid_s_status_type($HTTP_VARS['s_status_type'])) { $cfg_default_status_type_r = fetch_status_type_r($HTTP_VARS['s_status_type']); } else { $cfg_default_status_type_r = fetch_status_type_r(fetch_default_status_type()); } $itemImportHandler = new ItemImportHandler($HTTP_VARS['owner_id'], $cfg_is_trial_run, $cfg_ignore_duplicate_title, $cfg_override_status_type, $cfg_default_status_type_r, $listingObject); if (strcmp($HTTP_VARS['owner_id'], get_opendb_session_var('user_id')) === 0) { $page_title = get_opendb_lang_var('type_import', array('description' => $importPlugin->get_display_name())); } else { $page_title = get_opendb_lang_var('type_import_items_for_name', array('description' => $importPlugin->get_display_name(), 'fullname' => fetch_user_name($HTTP_VARS['owner_id']), 'user_id' => $HTTP_VARS['owner_id'])); } echo _theme_header($page_title); echo "<h2>" . $page_title . "</h2>\n"; echo get_import_choices_table($importPlugin, $cfg_include_header_row, $cfg_ignore_duplicate_title, $cfg_is_trial_run, $cfg_override_status_type, $cfg_default_status_type_r);
function perform_site_process(&$item_r, &$status_type_r, &$HTTP_VARS, &$footer_links_r) { $sitePlugin =& get_site_plugin_instance($HTTP_VARS['site_type']); if ($sitePlugin !== FALSE) { if ($HTTP_VARS['op'] == 'site-search') { $return_val = handle_site_search($sitePlugin, $HTTP_VARS, $errors, $footer_links_r); if ($return_val === "__EXACT_TITLE_MATCH__") { // do nothing - we have an exact match, so shall fall down // to do site / refresh operation instead. } else { if ($return_val !== FALSE) { // display search page and break out. do_op_title($item_r, $status_type_r, 'site-search'); echo $return_val; if (get_opendb_config_var('item_input.site', 'debug') === TRUE) { echo $sitePlugin->getDebugItemDataAsHtml(); } return; } else { // $return_val === FALSE) do_op_title($item_r, $status_type_r, 'site-search'); echo format_error_block($errors); if (get_opendb_config_var('item_input.site', 'debug') === TRUE) { echo $sitePlugin->getDebugItemDataAsHtml(); } return; } } } else { //if($HTTP_VARS['op'] == 'site-search') if ($sitePlugin->_queryItem($HTTP_VARS) !== TRUE) { // display error do_op_title($item_r, $status_type_r, 'new'); $errors = $sitePlugin->getErrors(); // we need to provide at least some indication of why there was a problem. if ($errors === FALSE) { $errors = get_opendb_lang_var('undefined_error'); } echo format_error_block($errors); if (get_opendb_config_var('item_input.site', 'debug') === TRUE) { echo $sitePlugin->getDebugItemDataAsHtml(); } return; } } // at this point we have an exact match! $site_item_attributes_r = $sitePlugin->getItemData($item_r['s_item_type']); if (is_not_empty_array($site_item_attributes_r)) { $HTTP_VARS = array_merge($HTTP_VARS, $site_item_attributes_r); if (is_exists_item($item_r['item_id'])) { $HTTP_VARS['op'] = 'refresh'; $titleArticlesConfig = $sitePlugin->getConfigValue('item_input.title_articles'); if (is_not_empty_array($titleArticlesConfig)) { set_opendb_config_ovrd_var('item_input', 'title_articles', $titleArticlesConfig); } if (get_opendb_config_var('item_input', 'auto_site_update') === TRUE) { // expand $HTTP_VARS to bypass edit form. $HTTP_VARS = get_site_item_input_data($HTTP_VARS['op'], $item_r, $HTTP_VARS); perform_update_process($item_r, $status_type_r, $HTTP_VARS, $footer_links_r); } else { perform_edit_process($item_r, $status_type_r, $HTTP_VARS, $footer_links_r); } } else { //if(is_exists_item($item_r['item_id'])) $HTTP_VARS['op'] = 'site'; if (get_opendb_config_var('item_input', 'auto_site_insert') === TRUE) { $item_r['s_status_type'] = fetch_default_status_type(); // expand $HTTP_VARS to bypass edit form. $HTTP_VARS = get_site_item_input_data($HTTP_VARS['op'], $item_r, $HTTP_VARS); perform_insert_process($item_r, $status_type_r, $HTTP_VARS, $footer_links_r); } else { perform_new_process($item_r, $status_type_r, $HTTP_VARS, $footer_links_r); } } if (get_opendb_config_var('item_input.site', 'debug') === TRUE) { echo $sitePlugin->getDebugItemDataAsHtml(); } } else { // no info found - drop down to new operation. $HTTP_VARS['op'] = 'new'; perform_new_process($item_r, $status_type_r, $HTTP_VARS, $footer_links_r); } } else { //if($sitePlugin !== FALSE) do_op_title($item_r, $status_type_r, $HTTP_VARS['op']); echo format_error_block(get_opendb_lang_var('undefined_error')); opendb_logger(OPENDB_LOG_ERROR, __FILE__, __FUNCTION__, 'Site plugin class not found', $HTTP_VARS); } }