Exemplo n.º 1
0
function zen_copy_faqs_attributes($faqs_id_from, $faqs_id_to)
{
    global $db;
    global $messageStack;
    global $copy_attributes_delete_first, $copy_attributes_duplicates_skipped, $copy_attributes_duplicates_overwrite, $copy_attributes_include_downloads, $copy_attributes_include_filename;
    // Check for errors in copy request
    if (!zen_has_faq_attributes($faqs_id_from, 'false') or !zen_faqs_id_valid($faqs_id_to) or $faqs_id_to == $faqs_id_from) {
        if ($faqs_id_to == $faqs_id_from) {
            // same faqs_id
            $messageStack->add_session('<b>WARNING: Cannot copy from Product ID #' . $faqs_id_from . ' to Product ID # ' . $faqs_id_to . ' ... No copy was made' . '</b>', 'caution');
        } else {
            if (!zen_has_faq_attributes($faqs_id_from, 'false')) {
                // no attributes found to copy
                $messageStack->add_session('<b>WARNING: No Attributes to copy from Product ID #' . $faqs_id_from . ' for: ' . zen_get_faqs_name($faqs_id_from) . ' ... No copy was made' . '</b>', 'caution');
            } else {
                // invalid faqs_id
                $messageStack->add_session('<b>WARNING: There is no Product ID #' . $faqs_id_to . ' ... No copy was made' . '</b>', 'caution');
            }
        }
    } else {
        // FIX HERE - remove once working
        // get attributes to copy from
        // die('UPDATE/IGNORE - Checking Copying from ' . $faqs_id_from . ' to ' . $faqs_id_to . ' Do I delete first? ' . ($copy_attributes_delete_first == '1' ? 'Yes' : 'No') . ' Do I add? ' . ($add_attribute == true ? 'Yes' : 'No') . ' Do I Update? ' . ($update_attribute == true ? 'Yes' : 'No') . ' Do I skip it? ' . ($copy_attributes_duplicates_skipped=='1' ? 'Yes' : 'No') . ' Found attributes in From: ' . $check_duplicate->RecordCount());
        if ($copy_attributes_duplicates_skipped == '1' and $check_duplicate->RecordCount() != 0) {
            // skip it
            $messageStack->add_session(TEXT_ATTRIBUTE_COPY_SKIPPING . $faqs_copy_from->fields['faqs_attributes_id'] . ' for Products ID#' . $faqs_id_to, 'caution');
        } else {
            if ($add_attribute == true) {
            }
            if ($update_attribute == true) {
                $messageStack->add_session(TEXT_ATTRIBUTE_COPY_UPDATING . $faqs_copy_from->fields['faqs_attributes_id'] . ' for Products ID#' . $faqs_id_to, 'caution');
            }
            $faqs_copy_from->MoveNext();
        }
        // end of faqs attributes while loop
    }
    // end of no attributes or other errors
}
Exemplo n.º 2
0
// | license@zen-cart.com so we can mail you a copy immediately.          |
// +----------------------------------------------------------------------+
// $Id: faq_manager.php 001 2005-03-27 dave@open-operations.com
//
if (isset($_GET['faqs_id'])) {
    $_GET['faqs_id'] = ereg_replace('[^0-9a-f:]', '', $_GET['faqs_id']);
}
if (isset($_GET['fcPath'])) {
    $_GET['fcPath'] = ereg_replace('[^0-9_]', '', $_GET['fcPath']);
}
while (list($key, $value) = each($_GET)) {
    $_GET[$key] = ereg_replace('[<>]', '', $value);
}
// validate faqs_id for search engines and bookmarks, etc.
if (isset($_GET['faqs_id']) and $_SESSION['check_valid'] != 'false') {
    $check_valid = zen_faqs_id_valid($_GET['faqs_id']);
    if (!$check_valid) {
        $_GET['main_page'] = zen_get_info_faq_page($_GET['faqs_id']);
        // do not recheck redirect
        $_SESSION['check_valid'] = 'false';
        zen_redirect(zen_href_link($_GET['main_page'], 'faqs_id=' . $_GET['faqs_id']));
    }
} else {
    $_SESSION['check_valid'] = 'true';
}
// calculate faq_category path
if (isset($_GET['fcPath'])) {
    $fcPath = $_GET['fcPath'];
} elseif (isset($_GET['faqs_id']) && !zen_check_url_get_terms()) {
    $fcPath = zen_get_faq_path($_GET['faqs_id']);
} else {