Esempio n. 1
0
function JB_category_option_list($category_id, $selected, $Markup = null)
{
    // &$Markup=null
    if ($Markup == null) {
        $Markup =& JB_get_DynamicFormMarkupObject();
        $all_enabled = false;
    } elseif (get_class($Markup) == 'JBDynamicSearchForm') {
        $all_enabled = true;
        // when on the search form, all options can be selected
    }
    $cache_key = 'cat_options_fid_' . $Markup->form_id . '_cid_' . $category_id . '_class_' . get_class($Markup) . '_lang_' . $_SESSION['LANG'];
    if (!($options_arr = JB_cache_get($cache_key))) {
        JB_generate_category_option_list($category_id, $selected, $options_arr, $Markup);
        JB_cache_add($cache_key, $options_arr);
    }
    $is_array = is_array($selected);
    for ($i = 0; $i < sizeof($options_arr['name']); $i++) {
        $sel = '';
        if ($is_array) {
            if (in_array($options_arr['value'][$i], $selected)) {
                $sel = ' selected ';
            }
        } elseif ($options_arr['value'][$i] == $selected) {
            $sel = ' selected ';
        }
        if ($all_enabled) {
            // allow selection of all categories - eg. search form
            $options_arr['a'][$i] = 'Y';
        }
        $Markup->category_select_option($options_arr['value'][$i], $options_arr['name'][$i], $sel, $options_arr['a'][$i], $options_arr['depth'][$i]);
    }
}
Esempio n. 2
0
function JB_tag_to_field_id_init_candidate()
{
    global $label;
    global $candidate_tag_to_field_id;
    if ($candidate_tag_to_field_id = JB_cache_get('tag_to_field_id_5_' . $_SESSION['LANG'])) {
        return $candidate_tag_to_field_id;
    }
    $fields = JB_schema_get_fields(5);
    // the template tag becomes the key
    foreach ($fields as $field) {
        $candidate_tag_to_field_id[$field['template_tag']] = $field;
    }
    JBPLUG_do_callback('tag_to_field_id_init_can', $candidate_tag_to_field_id);
    JB_cache_add('tag_to_field_id_5_' . $_SESSION['LANG'], $candidate_tag_to_field_id);
    return $candidate_tag_to_field_id;
}
Esempio n. 3
0
<?php

###########################################################################
# Copyright Jamit Software 2012, http://www.jamit.com
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
###########################################################################
define('NO_HOUSE_KEEPING', true);
require 'config.php';
$code = preg_replace('/[^a-z^0-9^_^-]+/i', '', $_REQUEST['code']);
if (!($row = jb_cache_get('lang_image_' . $code))) {
    $sql = "SELECT * FROM lang where lang_code='" . jb_escape_sql($code) . "' ";
    $result = JB_mysql_query($sql) or die(mysql_error());
    $row = mysql_fetch_array($result, MYSQL_ASSOC);
    JB_cache_add('lang_image_' . $code, $row);
}
header("Content-type: " . $row['mime_type']);
echo base64_decode($row['image_data']);