function fo_local_log_add($operation, $op_status, $op_message = false) { global $customer_id; global $REMOTE_ADDR; if ($op_message !== false) { $op_message = trim($op_message); } $message = sprintf("customer_id: %s\nIP: %s\nOperation: %s\nOperation status: %s%s", $customer_id, $REMOTE_ADDR, $operation, $op_status ? 'success' : 'failure', !empty($op_message) ? "\n" . $op_message : ""); cw_log_flag('log_file_operations', 'FILES', $message); }
function text_decrypt($s, $key = false) { global $blowfish; if (strlen($s) == 0) { return $s; } # Parse crypted data $type = cw_get_crypt_type($s); if ($type === false) { $type = "N"; $crc32 = false; } elseif (substr($s, 1, 1) == '-') { $crc32 = true; $s = substr($s, 2); } else { $crc32 = substr($s, 1, 8); $s = substr($s, 9); } # Blowfish if ($type == 'B' || $type == 'C') { if ($key === false) { $key = cw_get_crypt_key($type); } if (!$blowfish) { cw_log_flag("log_decrypt_errors", "DECRYPT", "The Blowfish service object is missing", true); return false; } elseif (empty($key)) { cw_log_flag("log_decrypt_errors", "DECRYPT", "The key for the selected type ('" . $type . "') of encryption is missing", true); return false; } $result = trim(cw_bf_decrypt($s, $key)); } elseif ($type == 'N') { # Non-encrypted $result = $s; } # CRC32 check if ($crc32 === true) { # Inner CRC32 $crc32 = substr($result, -8); $result = substr($result, 0, -8); if (cw_crc32(md5($result)) != $crc32) { $result = NULL; } } elseif ($crc32 !== false) { # Outer CRC32 if (cw_crc32($result) != $crc32) { $result = NULL; } } return $result; }
$source_file = "uploaded"; if ($_POST['local_file']) { if ($fd = cw_fopen($sqldump_file, "r", true)) { $source_file = "local"; } } if ($source_file == "uploaded") { $userfile = cw_move_uploaded_file("userfile"); } else { $userfile = $sqldump_file; } $fp = cw_fopen($userfile, "rb", true); if ($fp === false) { $top_message['content'] = cw_get_langvar_by_name("msg_adm_err_sql_file_not_found"); $top_message['type'] = "E"; cw_log_flag('log_database', 'DATABASE', $log_prefix . cw_get_langvar_by_name("msg_adm_err_sql_file_not_found", false, false, true)); cw_header_location("index.php?target=db_backup"); } $command = ""; echo cw_get_langvar_by_name("lbl_please_wait", false, false, true) . "<br />\n"; $cmdcnt = 0; while (!feof($fp)) { $c = fgets($fp, 1500000); $c = chop($c); $c = ereg_replace("^[ \t]*(#|-- |---*).*", "", $c); $command .= $c; if (ereg(";\$", $command)) { $command = ereg_replace(";\$", "", $command); /* $flg = false; foreach($deprecated_tables as $k) {
function cw_user_get_current_ccinfo($customer_id) { global $tables; $cc_info = cw_query_first("select * from {$tables['customers_ccinfo']} where customer_id='{$customer_id}'"); if ($cc_info) { $cc_info['card_number'] = text_decrypt($cc_info['card_number']); if (is_null($cc_info['card_number'])) { cw_log_flag("log_decrypt_errors", "DECRYPT", " Could not decrypt the field 'Card number' for the user " . $userinfo['customer_id'], true); } $cc_info['card_cvv2'] = text_decrypt($cc_info['card_cvv2']); if (is_null($cc_info['card_cvv2'])) { cw_log_flag("log_decrypt_errors", "DECRYPT", " Could not decrypt the field 'Card CVV2' for the user " . $userinfo['customer_id'], true); } } return $cc_info; }
cw_header_location('index.php?target=categories&mode=products&cat=' . $cat); } else { cw_header_location("index.php?target={$target}&mode=search" . (intval($navpage) > 1 ? "&page={$navpage}" : "")); } } if ($action == "delete" && AREA_TYPE == 'A') { $products_to_delete =& cw_session_register("products_to_delete"); if ($confirmed == "Y") { cw_load('product'); if (is_array($products_to_delete['products'])) { foreach ($products_to_delete['products'] as $k => $v) { cw_call('cw_delete_product', array('product_id' => $k, 'update_categories' => true)); } $force_return = $products_to_delete['search_return']; $top_message = array('content' => cw_get_langvar_by_name('msg_adm_products_del'), 'type' => 'I'); cw_log_flag('log_products_delete', 'PRODUCTS', "customer_id: {$customer_id}\nIP: {$REMOTE_ADDR}\nOperation: delete products (" . implode(',', array_keys($products_to_delete['products'])) . ")", true); } else { $top_message = array('content' => cw_get_langvar_by_name('msg_adm_warn_products_del'), 'type' => 'W'); } } elseif (is_array($product_ids) || $product_id) { if ($product_id) { $products_to_delete['products'][$product_id] = 'on'; } else { $products_to_delete['products'] = $product_ids; } $products_to_delete['navpage'] = $navpage; $products_to_delete['section'] = @$section; if ($REQUEST_METHOD == 'POST') { $products_to_delete['search_return'] = $HTTP_REFERER; } $products_to_delete['cat'] = @$cat;