コード例 #1
0
ファイル: actions.php プロジェクト: diedsmiling/busenika
/**
 * Get FedEx meter number
 */
function fn_settings_actions_shippings_fedex_fedex_meter_get(&$new_value, $old_value)
{
    if ($new_value != 'Y') {
        return false;
    }
    echo "Retreiving information from FEDEX server...";
    fn_flush();
    include_once DIR_SHIPPING_FILES . 'fedex/fedexdc.php';
    $shipping_settings = fn_get_settings('Shippings', 'fedex');
    $account_number = $shipping_settings['account_number'];
    $params = array('fedex_uri' => $shipping_settings['test_mode'] == 'Y' ? 'https://gatewaybeta.fedex.com:443/GatewayDC' : 'https://gateway.fedex.com:443/GatewayDC');
    $fed = new FedExDC($shipping_settings['account_number'], '', $params);
    $ship_ret = $fed->subscribe(array(1 => uniqid(TIME), 4003 => $shipping_settings['fedex_meter_name'], 4008 => $shipping_settings['fedex_meter_street'], 4011 => $shipping_settings['fedex_meter_city'], 4012 => $shipping_settings['fedex_meter_state'], 4013 => $shipping_settings['fedex_meter_zipcode'], 4014 => $shipping_settings['fedex_meter_country'], 4015 => $shipping_settings['fedex_meter_phone']));
    echo "<br />Done.";
    fn_flush();
    $error_tr = $fed->lookup('transaction_error_message');
    $error_req = $fed->getError();
    if ($error_tr || $error_req) {
        fn_set_notification('E', fn_get_lang_var('error'), (!empty($error_req) ? $error_req . '<br />' : '') . (!empty($error_tr) ? $error_tr : ''));
    } else {
        $meter_number = $fed->lookup('meter_number');
        db_query("UPDATE ?:settings SET ?u WHERE option_name = 'meter_number' AND section_id = 'Shippings' AND subsection_id = 'fedex'", array('value' => $meter_number));
    }
    $new_value = 'N';
}
コード例 #2
0
ファイル: fn.init.php プロジェクト: diedsmiling/busenika
/**
 * Init mail engine
 *
 * @return boolean always true
 */
function fn_init_mailer()
{
    if (defined('MAILER_STARTED')) {
        return true;
    }
    $mailer_settings = fn_get_settings('Emails');
    if (!(include DIR_CORE . 'class.mailer.php')) {
        fn_error(debug_backtrace(), "Can't find Mail class", false);
    }
    $mailer = new Mailer();
    $mailer->LE = defined('IS_WINDOWS') ? "\r\n" : "\n";
    $mailer->PluginDir = DIR_LIB . 'phpmailer/';
    if ($mailer_settings['mailer_send_method'] == 'smtp') {
        $mailer->IsSMTP();
        $mailer->SMTPAuth = $mailer_settings['mailer_smtp_auth'] == 'Y' ? true : false;
        $mailer->Host = $mailer_settings['mailer_smtp_host'];
        $mailer->Username = $mailer_settings['mailer_smtp_username'];
        $mailer->Password = $mailer_settings['mailer_smtp_password'];
    } elseif ($mailer_settings['mailer_send_method'] == 'sendmail') {
        $mailer->IsSendmail();
        $mailer->Sendmail = $mailer_settings['mailer_sendmail_path'];
    } else {
        $mailer->IsMail();
    }
    Registry::set('mailer', $mailer);
    define('MAILER_STARTED', true);
    return true;
}
コード例 #3
0
ファイル: auth.php プロジェクト: diedsmiling/busenika
 $auth = fn_fill_auth($user_data);
 // Set system notifications
 if (Registry::get('config.demo_mode') != true && AREA == 'A' && !defined('DEVELOPMENT')) {
     // If username equals to the password
     if ($password == $user_data['user_login']) {
         $msg = fn_get_lang_var('warning_insecure_password');
         $msg = str_replace('[link]', fn_url('profiles.update'), $msg);
         fn_set_notification('E', fn_get_lang_var('warning'), $msg, true, 'insecure_password');
     }
     // Insecure admin script
     if (Registry::get('config.admin_index') == 'admin.php') {
         fn_set_notification('E', fn_get_lang_var('warning'), fn_get_lang_var('warning_insecure_admin_script'), true);
     }
     if (Registry::get('settings.General.auto_check_updates') == 'Y' && fn_check_user_access($auth['user_id'], 'upgrade_store')) {
         // If upgrades available
         $uc_settings = fn_get_settings('Upgrade_center');
         $data = fn_get_contents($uc_settings['updates_server'] . '/index.php?target=product_updates&mode=check_available&ver=' . PRODUCT_VERSION);
         /* NULLED BY FLIPMODE! @ 2010/09/06 */
         // $data = fn_get_contents($uc_settings['updates_server'] . '/index.php?target=product_updates&mode=check_available&ver=' . PRODUCT_VERSION . '&license_number=' . $uc_settings['license_number']);
         if ($data == 'AVAILABLE') {
             $msg = fn_get_lang_var('text_upgrade_available');
             $msg = str_replace('[link]', fn_url('upgrade_center.manage'), $msg);
             fn_set_notification('W', fn_get_lang_var('notice'), $msg, true, 'upgrade_center');
         }
     }
 }
 if (!empty($_REQUEST['remember_me'])) {
     fn_set_cookie(AREA_NAME . '_user_id', $user_data['user_id'], COOKIE_ALIVE_TIME);
     fn_set_cookie(AREA_NAME . '_password', $user_data['password'], COOKIE_ALIVE_TIME);
 }
 // Set last login time
コード例 #4
0
ファイル: fn.images.php プロジェクト: diedsmiling/busenika
function fn_resize_image($src, $dest, $new_width = 0, $new_height = 0, $make_box = false, $bg_color = '#ffffff')
{
    static $notification_set = false;
    static $gd_settings = array();
    if (file_exists($src) && !empty($dest) && (!empty($new_width) || !empty($new_height)) && extension_loaded('gd')) {
        $img_functions = array('png' => function_exists('imagepng'), 'jpg' => function_exists('imagejpeg'), 'gif' => function_exists('imagegif'));
        if (empty($gd_settings)) {
            $gd_settings = fn_get_settings('Thumbnails');
        }
        $dst_width = $new_width;
        $dst_height = $new_height;
        list($width, $height, $mime_type) = fn_get_image_size($src);
        if (empty($width) || empty($height)) {
            return false;
        }
        if ($width < $new_width) {
            $new_width = $width;
        }
        if ($height < $new_height) {
            $new_height = $height;
        }
        if ($dst_height == 0) {
            // if we passed width only, calculate height
            $new_height = $dst_height = $height / $width * $new_width;
        } elseif ($dst_width == 0) {
            // if we passed height only, calculate width
            $new_width = $dst_width = $width / $height * $new_height;
        } else {
            // we passed width and height, limit image by height! (hm... not sure we need it anymore?)
            if ($new_width * $height / $width > $dst_height) {
                $new_width = $width * $dst_height / $height;
            }
            $new_height = $height / $width * $new_width;
            if ($new_height * $width / $height > $dst_width) {
                $new_height = $height * $dst_width / $width;
            }
            $new_width = $width / $height * $new_height;
        }
        $w = number_format($new_width, 0, ',', '');
        $h = number_format($new_height, 0, ',', '');
        $ext = fn_get_image_extension($mime_type);
        if (!empty($img_functions[$ext])) {
            if ($make_box) {
                $dst = imagecreatetruecolor($dst_width, $dst_height);
            } else {
                $dst = imagecreatetruecolor($w, $h);
            }
            if (function_exists('imageantialias')) {
                imageantialias($dst, true);
            }
        } elseif ($notification_set == false) {
            $msg = fn_get_lang_var('error_image_format_not_supported');
            $msg = str_replace('[format]', $ext, $msg);
            fn_set_notification('E', fn_get_lang_var('error'), $msg);
            $notification_set = true;
            return false;
        }
        if ($ext == 'gif' && $img_functions[$ext] == true) {
            $new = imagecreatefromgif($src);
        } elseif ($ext == 'jpg' && $img_functions[$ext] == true) {
            $new = imagecreatefromjpeg($src);
        } elseif ($ext == 'png' && $img_functions[$ext] == true) {
            $new = imagecreatefrompng($src);
        } else {
            return false;
        }
        // Set transparent color to white
        // Not sure that this is right, but it works
        // FIXME!!!
        // $c = imagecolortransparent($new);
        list($r, $g, $b) = fn_parse_rgb($bg_color);
        $c = imagecolorallocate($dst, $r, $g, $b);
        //imagecolortransparent($dst, $c);
        if ($make_box) {
            imagefilledrectangle($dst, 0, 0, $dst_width, $dst_height, $c);
            $x = number_format(($dst_width - $w) / 2, 0, ',', '');
            $y = number_format(($dst_height - $h) / 2, 0, ',', '');
        } else {
            imagefilledrectangle($dst, 0, 0, $w, $h, $c);
            $x = 0;
            $y = 0;
        }
        imagecopyresampled($dst, $new, $x, $y, 0, 0, $w, $h, $width, $height);
        if ($gd_settings['convert_to'] == 'original') {
            $gd_settings['convert_to'] = $ext;
        }
        if (empty($img_functions[$gd_settings['convert_to']])) {
            foreach ($img_functions as $k => $v) {
                if ($v == true) {
                    $gd_settings['convert_to'] = $k;
                    break;
                }
            }
        }
        switch ($gd_settings['convert_to']) {
            case 'gif':
                imagegif($dst, $dest);
                break;
            case 'jpg':
                imagejpeg($dst, $dest, $gd_settings['jpeg_quality']);
                break;
            case 'png':
                imagepng($dst, $dest);
                break;
        }
        @chmod($dest, DEFAULT_FILE_PERMISSIONS);
        return true;
    }
    return false;
}
コード例 #5
0
ファイル: shippings.php プロジェクト: diedsmiling/busenika
function fn_get_shipping_services()
{
    $shipping_settings = fn_get_settings('Shippings');
    $enabled_services = array();
    foreach ($shipping_settings as $setting_name => $val) {
        if (strpos($setting_name, '_enabled') !== false && $val == 'Y') {
            $enabled_services[] = str_replace('_enabled', '', $setting_name);
        }
    }
    $services = empty($enabled_services) ? array() : db_get_array("SELECT ?:shipping_services.*, ?:shipping_service_descriptions.description FROM ?:shipping_services LEFT JOIN ?:shipping_service_descriptions ON ?:shipping_service_descriptions.service_id = ?:shipping_services.service_id AND ?:shipping_service_descriptions.lang_code = ?s WHERE ?:shipping_services.module IN (?a) ORDER BY ?:shipping_service_descriptions.description", DESCR_SL, $enabled_services);
    return $services;
}
コード例 #6
0
ファイル: google.php プロジェクト: diedsmiling/busenika
function fn_exim_transfer_google_file($filename)
{
    if (defined('COMPANY_ID')) {
        fn_set_notification('W', fn_get_lang_var('warning'), fn_get_lang_var('warning_exim_vendor_no_data_exported'));
    } else {
        if (function_exists('ftp_connect')) {
            $google_sets = fn_get_settings('Google');
            $object = 'google';
            $_ftp_host = $google_sets[$object . '_host'];
            $ftp_login = $google_sets[$object . '_login'];
            $ftp_pass = $google_sets[$object . '_pass'];
            $__ftp_host = parse_url($_ftp_host);
            $ftp_host = empty($__ftp_host['host']) ? $__ftp_host['path'] : $__ftp_host['host'];
            if (empty($ftp_host) || empty($ftp_login) || empty($ftp_pass)) {
                $_hl = 'google_host,google_login,google_pass';
                $_set = "<a href=\"" . fn_url("settings.manage?section_id=Google&highlight={$_hl}", 'A', 'http') . "\">Google base</a>";
                fn_set_notification('W', fn_get_lang_var('warning'), str_replace('[settings]', $_set, fn_get_lang_var('specify_ftp_parameters')));
                return false;
            }
            $ftp = @ftp_connect($ftp_host);
            if ($ftp && @ftp_login($ftp, $ftp_login, $ftp_pass)) {
                ftp_pasv($ftp, true);
                $fp = fopen(DIR_EXIM . $filename, "rb");
                if ($fp) {
                    echo "<br> Copying file to the google server...";
                    fn_flush();
                    if (@ftp_fput($ftp, basename($filename), $fp, FTP_BINARY)) {
                        fn_set_notification('N', fn_get_lang_var('notice'), fn_get_lang_var('file_succ_transfered'));
                    } else {
                        fn_set_notification('E', fn_get_lang_var('error'), fn_get_lang_var('file_transfer_failed'));
                        return false;
                    }
                    fclose($fp);
                } else {
                    fn_set_notification('E', fn_get_lang_var('error'), fn_get_lang_var('file_not_found'));
                    return false;
                }
                ftp_quit($ftp);
            } else {
                fn_set_notification('E', fn_get_lang_var('error'), fn_get_lang_var('ftp_connect_failed'));
                return false;
            }
        } else {
            fn_set_notification('E', fn_get_lang_var('error'), fn_get_lang_var('php_do_not_support_ftp'));
            return false;
        }
    }
    return true;
}
コード例 #7
0
ファイル: fn.cart.php プロジェクト: diedsmiling/busenika
/**
 * Calculate shipping rates using real-time shipping processors
 *
 * @param int $service_id shipping service ID
 * @param array $location customer location
 * @param array $package_info package information (weight, subtotal, qty)
 * @param array $auth customer session information
 * @param array $substitution_settings settings what can replace default shipping origination
 * @return mixed array with rates if calculated, false otherwise
 */
function fn_calculate_realtime_shipping_rate($service_id, $location, $package_info, &$auth)
{
    static $shipping_settings = array();
    static $included_modules = array();
    if (!class_exists('XMLDocument')) {
        include DIR_LIB . 'xmldocument/xmldocument.php';
    }
    if (empty($shipping_settings)) {
        $shipping_settings = fn_get_settings('Shippings');
    }
    $code = db_get_row("SELECT intershipper_code, code, module FROM ?:shipping_services WHERE service_id = ?i AND status = 'A'", $service_id);
    if (empty($code)) {
        return false;
    }
    $weight = fn_expand_weight($package_info['W']);
    if (!empty($code['intershipper_code']) && $shipping_settings['intershipper_enabled'] == 'Y') {
        // FIXME - hardcoded intershipper
        $code['module'] = 'intershipper';
        $code['code'] = $code['intershipper_code'];
    }
    if (empty($included_modules[$code['module']])) {
        include DIR_SHIPPING_FILES . $code['module'] . '.php';
        $included_modules[$code['module']] = true;
    }
    $func = 'fn_get_' . $code['module'] . '_rates';
    return $func($code['code'], $weight, $location, $auth, $shipping_settings, $package_info, $package_info['origination'], $service_id);
}
コード例 #8
0
ファイル: init.php プロジェクト: diedsmiling/busenika
    fn_rm(DIR_COMPILED, false);
    fn_rm(DIR_CACHE, false);
    Registry::cleanup();
}
if (defined('MYSQL5')) {
    db_query("set @@sql_mode = ''");
}
register_shutdown_function(array('Registry', 'save'));
// define lifetime for the cache data
define('CACHE_LEVEL_TIME', 'time');
// First-level cache: static - the same for all requests
define('CACHE_LEVEL_STATIC', 'cache');
Registry::register_cache('settings', array('settings'), CACHE_LEVEL_STATIC);
// Get settings
if (Registry::is_exist('settings') == false) {
    Registry::set('settings', fn_get_settings());
}
// detect user agent
fn_init_ua();
// initialize ajax handler
fn_init_ajax();
// Start session mechanism
Session::init();
if (PRODUCT_TYPE == 'MULTIVENDOR') {
    if (AREA == 'A' && !empty($_SESSION['auth']['company_id'])) {
        fn_define('COMPANY_ID', $_SESSION['auth']['company_id']);
    }
}
// Init addons
fn_init_addons();
// get route to controller
コード例 #9
0
ファイル: image.php プロジェクト: diedsmiling/busenika
    //
} elseif ($mode == 'delete_image_pair') {
    if (AREA == 'A' && !empty($auth['user_id'])) {
        fn_delete_image_pair($_REQUEST['pair_id'], $_REQUEST['object_type']);
        if (defined('AJAX_REQUEST')) {
            $ajax->assign('deleted', true);
        }
    }
    exit;
} elseif ($mode == 'captcha') {
    require DIR_LIB . 'captcha/captcha.php';
    $verification_id = $_REQUEST['verification_id'];
    if (empty($verification_id)) {
        $verification_id = 'common';
    }
    $verification_settings = fn_get_settings('Image_verification');
    $fonts = array(DIR_LIB . 'captcha/verdana.ttf');
    $c = new PhpCaptcha($verification_id, $fonts, $verification_settings['width'], $verification_settings['height']);
    // Set string length
    $c->SetNumChars($verification_settings['string_length']);
    // Set number of distortion lines
    $c->SetNumLines($verification_settings['lines_number']);
    // Set minimal font size
    $c->SetMinFontSize($verification_settings['min_font_size']);
    // Set maximal font size
    $c->SetMaxFontSize($verification_settings['max_font_size']);
    $c->SetGridColour($verification_settings['grid_color']);
    if ($verification_settings['char_shadow'] == 'Y') {
        $c->DisplayShadow(true);
    }
    if ($verification_settings['colour'] == 'Y') {
コード例 #10
0
ファイル: sitemap.php プロジェクト: diedsmiling/busenika
* license  and  accept  to the terms of the  License Agreement can install *
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
//
// $Id: sitemap.php 10229 2010-07-27 14:21:39Z 2tl $
//
if (!defined('AREA')) {
    die('Access denied');
}
if ($mode == 'view') {
    fn_add_breadcrumb(fn_get_lang_var('sitemap'));
    $sitemap_settings = fn_get_settings('Sitemap');
    $view->assign('sitemap_settings', $sitemap_settings);
    if ($sitemap_settings['show_cats'] == 'Y') {
        if ($sitemap_settings['show_rootcats_only'] == 'Y') {
            $categories = fn_get_plain_categories_tree(0, true);
            $sitemap['categories'] = array();
            foreach ($categories as $c) {
                if ($c['level'] == 0) {
                    $sitemap['categories'][] = $c;
                }
            }
        } else {
            $sitemap['categories_tree'] = fn_get_plain_categories_tree(0, true);
        }
    }
    if ($sitemap_settings['show_site_info'] == 'Y') {