Example #1
0
function fn_watermarks_images_access_info()
{
    $is_applied = false;
    $option_types = fn_get_apply_watermark_options();
    foreach ($option_types as $options) {
        foreach ($options as $name => $option_id) {
            if (Registry::get('addons.watermarks.' . $name) == 'Y') {
                $is_applied = true;
                break;
            }
        }
    }
    if ($is_applied) {
        if (fn_allowed_for('ULTIMATE')) {
            $img_instr = "# Rewrite watermarks rules\n" . "<IfModule mod_rewrite.c>\n" . "RewriteEngine on\n" . "RewriteCond %{REQUEST_URI} \\/images\\/(product|category|detailed|thumbnails)\\/*\n" . "RewriteCond %{REQUEST_FILENAME} -f\n" . "RewriteRule .(gif|jpeg|jpg|png)\$ " . DIR_ROOT . "/" . fn_url('watermark.create', 'C', 'rel') . " [NC]\n" . "</IfModule>\n" . "# /Rewrite watermarks rules";
        } else {
            $img_instr = "# Rewrite watermarks rules\n" . "<IfModule mod_rewrite.c>\n" . "RewriteEngine on\n" . "RewriteCond %{REQUEST_URI} \\/images\\/(product|category|detailed|thumbnails)\\/*\n" . "RewriteCond %{REQUEST_FILENAME} -f\n" . "RewriteRule (.*)\$ ./watermarked/\$1 [NC]\n" . "</IfModule>\n" . "# /Rewrite watermarks rules";
        }
        $img_instr = nl2br(htmlentities($img_instr));
        $wt_instr = "# Generate watermarks rules\n" . "<IfModule mod_rewrite.c>\n" . "RewriteEngine on\n" . "RewriteCond %{REQUEST_FILENAME} !-f\n" . "RewriteRule .(gif|jpeg|jpg|png)\$ " . DIR_ROOT . "/" . fn_url('watermark.create', 'C', 'rel') . " [NC]\n" . "</IfModule>\n" . "# /Generate watermarks rules";
        $wt_instr = nl2br(htmlentities($wt_instr));
        $res = '<h2 class="subheader">' . __('wt_images_access_info') . '</h2>' . '<p>' . __('wt_images_access_description') . '</p>' . '<p><code>' . $img_instr . '</code></p>' . '<p>' . __('wt_watermarks_access_description') . '</p>' . '<p><code>' . $wt_instr . '</code></p>' . '<p>' . __('wt_access_note') . '</p>';
        return $res;
    }
    return '';
}
Example #2
0
}
//
// Delete image
//
if ($mode == 'delete_image') {
    if (AREA == 'A' && !empty($auth['user_id'])) {
        if ($_REQUEST['object_type'] == 'watermark' || $_REQUEST['object_type'] == 'detailed') {
            $images_data = db_get_row("SELECT image_id, detailed_id FROM ?:images_links WHERE pair_id = ?i AND object_type = ?s", $_REQUEST['pair_id'], 'watermark');
            if (!empty($images_data) && (!fn_allowed_for('ULTIMATE') || Registry::get('runtime.company_id'))) {
                if ($_REQUEST['image_id'] == $images_data['image_id']) {
                    $type = 'icons';
                } elseif ($_REQUEST['image_id'] == $images_data['detailed_id']) {
                    $type = 'detailed';
                }
                if (!empty($type)) {
                    $option_types = fn_get_apply_watermark_options();
                    $unset_options = array();
                    $is_unset = false;
                    foreach ($option_types[$type] as $name => $option_id) {
                        if (Settings::instance()->getValue($name, '') == 'Y') {
                            Settings::instance()->updateValueById($option_id, 'N');
                            $is_unset = true;
                        }
                    }
                    if ($is_unset) {
                        fn_set_notification('E', __('error'), __('wt_fail_apply_graphic_watermark', array('[image_type]' => __('wt_' . $type))));
                        fn_delete_watermarks(array($type => true));
                    }
                }
            }
        }