本文整理汇总了PHP中cw_load函数的典型用法代码示例。如果您正苦于以下问题:PHP cw_load函数的具体用法?PHP cw_load怎么用?PHP cw_load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cw_load函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cw_fbauth_user_login
function cw_fbauth_user_login($user)
{
global $tables, $current_area;
cw_load('crypt', 'user', 'mail');
$user_data = cw_query_first("SELECT customer_id, email, password\n\t\t\t\t\t\t\t\t\tFROM {$tables['customers']} \n\t\t\t\t\t\t\t\t\tWHERE oauth_uid='" . $user['id'] . "' AND oauth_type='F' \n\t\t\t\t\t\t\t\t\t\tAND usertype='" . $current_area . "' \n\t\t\t\t\t\t\t\t\t\tAND status='Y'");
if (!empty($user_data)) {
// login user
global $email, $password, $action;
$email = $user_data['email'];
$password = text_decrypt($user_data['password']);
$action = 'login';
cw_include('include/login.php');
} else {
// create user
$register = array();
$register['email'] = $user['email'];
if (strpos($user['email'], "proxymail.facebook.com") !== FALSE) {
cw_header_location("index.php?target=fb_auth_get_email", TRUE);
}
$register['password'] = $register['password2'] = md5(uniqid('cw_', TRUE), TRUE);
$register['usertype'] = $current_area;
$partner_membership =& cw_session_register('partner_membership');
$register['membership_id'] = $partner_membership;
$customer_id = cw_user_create_profile($register);
$identifiers =& cw_session_register('identifiers', array());
$identifiers[$current_area] = array('customer_id' => $customer_id);
$customer = array('oauth_uid' => $user['id']);
cw_array2update('customers', $customer, "customer_id='{$customer_id}'");
$address = array('main' => 1, 'firstname' => $user['first_name'], 'lastname' => $user['last_name']);
$additional_info = array('sex' => $user['gender'] == 'male' ? 1 : 0);
$userinfo = array('addresses' => $address, 'additional_info' => $additional_info);
cw_user_update($userinfo, $customer_id, $customer_id);
cw_user_send_modification_mail($customer_id, TRUE);
}
}
示例2: cw_import_chipstation_login
function cw_import_chipstation_login()
{
global $config;
cw_load('http');
$post = array('op=login', 'name=Your_Account', 'username=' . $config['import_chipstation']['chipstation_login'], 'password=' . $config['import_chipstation']['chipstation_password'], 'ricorda=0');
$result = cw_http_post_request('www.chipstation.it', '/modules.php', implode('&', $post), array());
return $result[2];
}
示例3: cw_import_cosmos_el_login
function cw_import_cosmos_el_login()
{
global $config;
cw_load('http');
$post = array('user=' . $config['import_cosmos_el']['cosmos_el_login'], 'pwd=' . $config['import_cosmos_el']['cosmos_el_password'], 'master=0', 'submit= Login');
$result = cw_http_post_request('www.cosmosel.it', '/Portale/Cosmos/B2B/it/do-login', implode('&', $post), array());
return $result[2];
}
示例4: cw_import_esprinet_login
function cw_import_esprinet_login()
{
global $config;
cw_load('http');
$post = array('VarHttps=NO', 'Codice=' . $config['import_esprinet']['esprinet_customer'], 'utente=' . $config['import_esprinet']['esprinet_login'], 'pwd=' . $config['import_esprinet']['esprinet_password'], 'B2=Effettua il Login');
$result = cw_http_post_request('it.esprinet.com', '/dealer/check_dealer.asp', implode('&', $post), array());
return $result[2];
}
示例5: smarty_function_select_category
function smarty_function_select_category($params, &$smarty)
{
extract($params);
if (empty($assign)) {
$smarty->trigger_error("assign: missing 'assign' parameter");
return;
}
cw_load('category');
$smarty->assign($assign, cw_func_call('cw_category_get', array('cat' => $category_id)));
}
示例6: smarty_function_select_user_title
function smarty_function_select_user_title($params, &$smarty)
{
extract($params);
if (empty($assign)) {
$smarty->trigger_error("assign: missing 'assign' parameter");
return;
}
cw_load('user');
$smarty->assign($assign, cw_user_get_titles());
}
示例7: smarty_function_select_tnt_services
function smarty_function_select_tnt_services($params, &$smarty)
{
extract($params);
if (empty($assign)) {
$smarty->trigger_error("assign: missing 'assign' parameter");
return;
}
cw_load('tnt');
$smarty->assign($assign, cw_tnt_get_services($country));
}
示例8: smarty_function_select_bestsellers
function smarty_function_select_bestsellers($params, &$smarty)
{
extract($params);
if (empty($assign)) {
$smarty->trigger_error("assign: missing 'assign' parameter");
return;
}
cw_load('bestseller');
$smarty->assign($assign, cw_bestseller_get_menu($category_id));
}
示例9: smarty_function_select_country
function smarty_function_select_country($params, &$smarty)
{
extract($params);
if (empty($assign)) {
$smarty->trigger_error("assign: missing 'assign' parameter");
return;
}
cw_load('map');
$smarty->assign($assign, cw_call('cw_map_get_countries'));
}
示例10: on_add_cart
function on_add_cart(&$cart, $added_product)
{
global $smarty;
cw_load('ajax', 'product');
$product_id = $cart['products'][$added_product['productindex']]['product_id'];
$product = cw_func_call('cw_product_get', array('id' => $product_id, 'info_type' => 0 | 128));
$product = cw_array_merge($product, $added_product);
$smarty->assign('product', $product);
cw_add_ajax_block(array('id' => 'add2cart_popup', 'action' => 'update', 'template' => 'addons/ajax_add2cart/add2cart_popup.tpl'), 'add2cart_popup');
cw_add_ajax_block(array('id' => 'script', 'content' => 'sm("add2cart_popup",add2cart_popup_width,add2cart_popup_height, true, "' . $added_product['added_amount'] . ($added_product['added_amount'] > 1 ? ' items' : ' item') . ' added to cart")'), 'add2cart_popup_script');
}
示例11: cw_log_add
function cw_log_add($label, $message, $add_backtrace = true, $stack_skip = 0, $email_addresses = false, $email_only = false)
{
global $var_dirs;
global $PHP_SELF;
global $config;
$filename = sprintf("%s/%s-%s.php", $var_dirs['log'], strtolower($label), date('ymd'));
if ($label == 'SQL') {
$type = 'error';
} elseif ($label == 'INI' || $label == 'SHIPPING') {
$type = 'warning';
} else {
$type = 'message';
}
$uri = $PHP_SELF;
if (!empty($_SERVER['QUERY_STRING'])) {
$uri .= '?' . $_SERVER['QUERY_STRING'];
}
if ($add_backtrace) {
$stack = cw_get_backtrace(1 + $stack_skip);
$backtrace = "Backtrace:\n" . implode("\n", $stack) . "\n";
} else {
$backtrace = '';
}
if (is_array($message) || is_object($message)) {
ob_start();
print_r($message);
$message = ob_get_contents();
ob_end_clean();
} else {
$message = trim($message);
}
$local_time = "";
if (!empty($config)) {
$local_time = '(local: ' . date('d-M-Y H:i:s', cw_core_get_time()) . ')';
}
$message = str_replace("\n", "\n ", "\n" . $message);
$message = str_replace("\t", " ", $message);
$data = sprintf("[%s] %s %s %s:%s\nRequest URI: %s\n%s-------------------------------------------------\n", date('d-M-Y H:i:s'), $local_time, $label, $type, $message, $uri, $backtrace);
cw_event('on_log_add', array($label, $data, $filename));
if (!$email_only && cw_log_check_file($filename) !== false) {
$fmode = $label == 'bench_exec' ? 'w' : 'a+';
$fp = @fopen($filename, $fmode);
if ($fp !== false) {
fwrite($fp, $data);
fclose($fp);
}
}
if (!empty($email_addresses) && is_array($email_addresses)) {
cw_load('mail');
foreach ($email_addresses as $k => $email) {
cw_send_simple_mail($config['Company']['site_administrator'], $email, $config['Company']['company_name'] . ": {$label} {$type} notification", $data);
}
}
}
示例12: cw_ps_products_in_cart_pre
function cw_ps_products_in_cart_pre($cart, $user_info)
{
$special_offers_apply =& cw_session_register("special_offers_apply");
# Delete all free added products
if (is_array($cart['products'])) {
foreach ($cart['products'] as $kk => $vv) {
if ($vv["promotion_suite"]["free_product"] == 'Y') {
cw_call('cw_delete_from_cart', array(&$cart, $vv['cartid']));
}
}
}
# / Delete all free added products
if (!empty($special_offers_apply['free_products'])) {
foreach ($special_offers_apply['free_products'] as $pid => $qty) {
#
# Add product to the cart
#
$product = cw_func_call('cw_product_get', array('id' => $pid, 'info_type' => 8192));
$avail_amount = $product['avail'];
$qty = min($qty, $avail_amount);
$min_amount = $product['min_amount'];
if ($qty >= $min_amount) {
cw_load('warehouse');
$possible_warehouses = cw_warehouse_get_avails_customer($pid);
$warehouse = key($possible_warehouses);
$add_product = array();
$add_product["product_id"] = $pid;
$add_product["amount"] = $qty;
$add_product["product_options"] = "";
$add_product["price"] = 0.0;
// warehouse is required, otherwise free product will be placed as separate order
$add_product['warehouse_customer_id'] = $warehouse;
// do to use cw_warehouse_add_to_cart_simple. It operates with global $cart while we use here local $cart copy
// $result = cw_call('cw_warehouse_add_to_cart_simple', array($pid, $qty, '', 0.00));
$result = cw_call('cw_add_to_cart', array(&$cart, $add_product));
# Adjust just added product
foreach ($cart['products'] as $ck => $cv) {
if ($cv["cartid"] == $result['cartid']) {
$cart['products'][$ck]["promotion_suite"]["free_product"] = true;
// mark just added product as offered
}
}
} else {
unset($special_offers_apply['free_products'][$pid]);
}
}
// foreach
}
// if
return new EventReturn($cart['products'], array($cart, $user_info));
// replace cart in input params for main function
}
示例13: order_tracking_redirect
function order_tracking_redirect()
{
global $smarty, $request_prepared;
cw_load('doc');
$order = cw_call('cw_doc_get', array($request_prepared['doc_id'], 0));
if (empty($order) || $order['info']['tracking'] != $request_prepared['tracking']) {
cw_header_location('index.php?target=error_message&error=access_denied&id=59');
}
$smarty->assign('order', $order);
$form = cw_display('addons/shipping_system/tracking.tpl', $smarty, false);
echo $form;
exit;
}
示例14: estimate_cart
function estimate_cart()
{
global $request_prepared;
$user_address =& cw_session_register('user_address', array());
// Declare session var for addresses
$user_address['current_address']['zipcode'] = $request_prepared['zipcode'];
$user_address['current_address']['state'] = $request_prepared['state'];
$user_address['current_address']['country'] = $request_prepared['country'];
if (empty($user_address['current_address']['state']) && $user_address['current_address']['country'] == 'US') {
cw_load('map');
$user_address['current_address']['state'] = cw_call('cw_map_get_state_by_zip', array($user_address['current_address']['zipcode']));
}
cw_header_location('index.php?target=cart');
}
示例15: cw_salesman_change_discount_status
function cw_salesman_change_discount_status($id, $status)
{
global $tables, $smarty;
db_query("update {$tables['discount_coupons']} set status='{$status}' where coupon='{$id}'");
cw_load('mail', 'user');
$coupon = cw_query_first("select * from {$tables['discount_coupons']} where coupon='{$id}'");
if (!$coupon) {
return;
}
$smarty->assign('coupon', $coupon);
$userinfo = cw_user_get_info($coupon['customer_id']);
$smarty->assign('userinfo', $userinfo);
cw_call('cw_send_mail', array($config['Company']['orders_department'], $userinfo['email'], 'mail/salesman_coupon_subj.tpl', 'mail/salesman_coupon.tpl'));
}