예제 #1
0
function fn_companies_update_logos($company_id, $old_logos)
{
    $logotypes = fn_filter_uploaded_data('logotypes');
    $areas = fn_companies_get_manifest_definition();
    // Update company logotypes
    if (!empty($logotypes)) {
        $logos = $old_logos;
        foreach ($logotypes as $type => $logo) {
            $area = $areas[$type];
            $short_name = "company/{$company_id}/{$type}_{$logo['name']}";
            $filename = DIR_IMAGES . $short_name;
            fn_mkdir(dirname($filename));
            if (fn_copy($logo['path'], $filename)) {
                list($w, $h, ) = fn_get_image_size($filename);
                $logos[$area['name']] = array('vendor' => 1, 'filename' => $short_name, 'width' => $w, 'height' => $h);
            } else {
                $text = fn_get_lang_var('text_cannot_create_file');
                $text = str_replace('[file]', $filename, $text);
                fn_set_notification('E', fn_get_lang_var('error'), $text);
            }
            @unlink($logo['path']);
        }
        $logos = serialize($logos);
        db_query("UPDATE ?:companies SET logos = ?s WHERE company_id = ?i", $logos, $company_id);
    }
    fn_save_logo_alt($areas, $company_id);
}
예제 #2
0
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    fn_trusted_vars("lang_data");
    $suffix = '';
    if ($mode == 'update_design_mode') {
        db_query("UPDATE ?:settings SET value = ?s WHERE option_name = ?s AND section_id = ?s", $action == $_REQUEST['design_mode'] ? 'Y' : 'N', $_REQUEST['design_mode'], '');
        if (!empty($_REQUEST['disable_mode'])) {
            db_query("UPDATE ?:settings SET value = 'N' WHERE option_name = ?s AND section_id = ?s", $_REQUEST['disable_mode'], '');
        }
        fn_rm(DIR_COMPILED . 'customer', false);
        fn_rm(DIR_COMPILED . 'admin', false);
        $suffix = '.design_mode';
    }
    if ($mode == 'update_logos') {
        $logos = fn_filter_uploaded_data('logotypes');
        $areas = fn_get_manifest_definition();
        fn_save_logo_alt($areas);
        // Update customer logotype
        if (!empty($logos)) {
            foreach ($logos as $type => $logo) {
                $area = $areas[$type];
                $manifest = parse_ini_file(DIR_SKINS . Registry::get('settings.skin_name_' . $area['skin']) . '/' . SKIN_MANIFEST, true);
                $filename = DIR_SKINS . Registry::get('settings.skin_name_' . $area['skin']) . '/' . $area['path'] . '/images/' . $logo['name'];
                if (fn_copy($logo['path'], $filename)) {
                    list($w, $h, ) = fn_get_image_size($filename);
                    $manifest[$area['name']]['filename'] = $logo['name'];
                    $manifest[$area['name']]['width'] = $w;
                    $manifest[$area['name']]['height'] = $h;
                    fn_write_ini_file(DIR_SKINS . Registry::get('settings.skin_name_' . $area['skin']) . '/' . SKIN_MANIFEST, $manifest);
                } else {
                    $text = fn_get_lang_var('text_cannot_create_file');
                    $text = str_replace('[file]', $filename, $text);