function JB_get_default_currency() { static $jb_default_currency; if (!isset($jb_default_currency)) { if (!($jb_default_currency = jb_cache_get('jb_default_currency'))) { $sql = "SELECT code from currencies WHERE is_default='Y' "; $result = JB_mysql_query($sql) or die(mysql_error()); $jb_default_currency = mysql_fetch_array($result, MYSQL_ASSOC); jb_cache_set('jb_default_currency', $jb_default_currency); } return $jb_default_currency['code']; } return $jb_default_currency['code']; }
function JB_getCatStruct($cat_id, $lang, $f_id) { if (!is_numeric($f_id)) { return false; } if ($cat_id == false) { $cat_id = '0'; } if ($cat_struct = jb_cache_get("cat_f" . $f_id . "_c" . $cat_id . "_" . $_SESSION['LANG'])) { return $cat_struct; } # query to get all the nodes that are the # children of child id $query = "SELECT categories.category_id, categories.category_name, lang, cat_name_translations.category_name AS NAME, obj_count, seo_fname, has_child FROM categories LEFT JOIN cat_name_translations ON categories.category_id=cat_name_translations.category_id WHERE parent_category_id='" . jb_escape_sql($cat_id) . "' AND (lang='" . jb_escape_sql($lang) . "') and form_id={$f_id} ORDER BY list_order, NAME "; $x = 0; $result = JB_mysql_query($query) or die($query . mysql_error()); $i = 0; while ($row = mysql_fetch_row($result)) { $children = array(); if ($row[6] == 'Y') { $children = JB_getCategoryChildrenStruct($row[0], $lang, $f_id); } $category_table[$i]['cid'] = $row[0]; // category id $category_table[$i]['cpid'] = $cat_id; // parent id // $category_table[$i]['t'] = "PARENT"; // type $category_table[$i]['n'] = $row[3]; // name $category_table[$i]['oc'] = $row[4]; // object count $category_table[$i]['ch'] = $children; // children $category_table[$i]['chc'] = sizeof($children); // children count $category_table[$i]['seo'] = $row[5]; // seo file name $i++; } jb_cache_set("cat_f" . $f_id . "_c" . $cat_id . "_" . $_SESSION['LANG'], $category_table); return $category_table; }
function JB_getCodeDescription($field_id, $code) { $field_id = (int) $field_id; if ($jb_code_table = jb_cache_get('jb_code_table_fid_' . $field_id . '_lang_' . $_SESSION['LANG'])) { if (isset($jb_code_table[$field_id][$code])) { return $jb_code_table[$field_id][$code]; // return the description } } if ($_SESSION['LANG'] != '') { $sql = "SELECT `description` FROM `codes_translations` WHERE field_id='" . jb_escape_sql($field_id) . "' AND `code` = '" . jb_escape_sql($code) . "' AND lang='" . jb_escape_sql($_SESSION['LANG']) . "' "; } else { $sql = "SELECT `description` FROM `codes` WHERE field_id='" . jb_escape_sql($field_id) . "' AND `code` = '" . jb_escape_sql($code) . "'"; } $result = JB_mysql_query($sql) or die($sql . mysql_error()); if ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { if (strlen($row['description']) > 0) { $jb_code_table[$field_id][$code] = $row['description']; jb_cache_set('jb_code_table_fid_' . $field_id . '_lang_' . $_SESSION['LANG'], $jb_code_table); return $row['description']; } } else { $jb_code_table[$field_id][$code] = ' '; jb_cache_set('jb_code_table_fid_' . $field_id . '_lang_' . $_SESSION['LANG'], $jb_code_table); return $row['description']; } }
function JB_get_post_count($type = '') { static $post_stats; if (!isset($post_stats)) { // perhaps it's in the cache? $post_stats = jb_cache_get('post_stats'); } if (isset($post_stats[$type])) { return $post_stats[$type]; } elseif (isset($post_stats['AP'])) { return $post_stats['AP']; } switch ($type) { case 'AP': $sql = "SELECT val FROM jb_variables WHERE `key`='POST_COUNT_AP' "; break; case 'PAP': $sql = "SELECT val FROM jb_variables WHERE `key`='POST_COUNT_PAP' "; break; case 'NA': $sql = "SELECT val FROM jb_variables WHERE `key`='POST_COUNT_NA' "; break; case 'WA': $sql = "SELECT val FROM jb_variables WHERE `key`='POST_COUNT_WA' "; break; case 'EX': $sql = "SELECT val FROM jb_variables WHERE `key`='POST_COUNT_EX' "; break; case 'SAP': $sql = "SELECT val FROM jb_variables WHERE `key`='POST_COUNT_SAP' "; break; default: $sql = "SELECT val FROM jb_variables WHERE `key`='POST_COUNT_AP' "; break; } $result = JB_mysql_query($sql); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_row($result); $post_stats[$type] = $row[0]; jb_cache_set('post_stats', $post_stats); // update the cache return $post_stats[$type]; } else { return null; } }
function JB_echo_list_head_data($form_id, $admin) { global $q_string, $column_list, $column_info; # HTML output for this function comes from ListMarkup Class # include/themes/default/JBListMarkup.php # Any HTML customizations should be done there. # Please copy this class in to your custom theme directory, and # customize form there $LM =& JB_get_ListMarkupObject($form_id); // load the ListMarkup Class $LM->set_admin($admin); if ($form_id == 1) { global $JobListAttributes; $q_string = $JobListAttributes->get_query_string('&'); } $ord = strtolower($_REQUEST['ord']); if ($ord == 'asc') { $ord = 'desc'; } elseif ($ord == 'desc') { $ord = 'asc'; } else { $ord = 'asc'; } $colspan = 0; if (!($cached_list = jb_cache_get('column_info_' . $form_id))) { $sql = "SELECT `template_tag`, `truncate_length`, `admin`, `linked`, `is_bold`, `no_wrap`, `clean_format`, `is_sortable`, `admin`, `field_type` FROM form_lists WHERE form_id='" . jb_escape_sql($form_id) . "' ORDER BY sort_order ASC "; $result = JB_mysql_query($sql); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $cached_list[] = $row; } jb_cache_set('column_info_' . $form_id, $cached_list); } foreach ($cached_list as $row) { $colspan++; $column_list[$row['template_tag']] = $row['template_tag']; $column_info[$row['template_tag']]['field_type'] = $row['field_type']; $column_info[$row['template_tag']]['trunc'] = $row['truncate_length']; $column_info[$row['template_tag']]['admin'] = $row['admin']; $column_info[$row['template_tag']]['link'] = $row['linked']; $column_info[$row['template_tag']]['is_bold'] = $row['is_bold']; $column_info[$row['template_tag']]['no_wrap'] = $row['no_wrap']; $column_info[$row['template_tag']]['clean'] = $row['clean_format']; $column_info[$row['template_tag']]['is_sortable'] = $row['is_sortable']; if ($row['admin'] == 'Y' && !$admin) { continue; // do not render this column if not viewed by Admin. } $LM->list_head_cell_open($row['template_tag']); if ($row['is_sortable'] == 'Y') { // show column order by link? $field_id = JB_get_template_field_id($row['template_tag'], $form_id); if ($form_id == 1) { // posts // post summary is not sortable.. if ($field_id == 'summary') { $field_id = JB_get_template_field_id('TITLE', 1); // order by title instead! } } if ($form_id == 4) { // employers // post count is not sortable. if ($field_id == 'posts') { $row['is_sortable'] = 'N'; } // sort name by last name if ($field_id == 'Name') { $field_id = JB_get_template_field_id('LNAME', 4); // order by title instead! } if ($field_id == 'has_profile') { $row['is_sortable'] = 'N'; } } if ($form_id == 5) { // candidates // resume id is not sortable. if ($field_id == 'resume_id') { $row['is_sortable'] = 'N'; } // sort name by last name if ($field_id == 'Name') { $field_id = JB_get_template_field_id('LNAME', 5); // order by title instead! } } $LM->list_head_open_link($field_id, $ord, $q_string); // output the start of the link } $LM->list_head_cell_label($column_info[$row['template_tag']], $row['template_tag'], $form_id); if ($row['is_sortable'] == 'Y') { // show column order by link? $LM->list_head_close_link(); } $LM->list_head_cell_close(); } $LM->set_column_list($column_list); $LM->set_column_info($column_info); return $colspan; }
function JB_display_dynamic_search_form($form_id, $NO_COLS = 2, $search_form_mode = null) { $SearchFormObj =& getDynamicSearchFormObject($form_id); // we can cache these search form on the home page, // employer's resume search // candidate's job browse / search if (!$search_form_mode && (strpos($_SERVER['PHP_SELF'], 'index.php') !== false || strpos($_SERVER['PHP_SELF'], JB_EMPLOYER_FOLDER . 'search.php') !== false || strpos($_SERVER['PHP_SELF'], JB_CANDIDATE_FOLDER . 'browse.php') !== false || strpos($_SERVER['PHP_SELF'], JB_EMPLOYER_FOLDER . 'search.php') !== false) && $_REQUEST['action'] != 'search') { // serve the cached version if (!($search_form = jb_cache_get('search_form_' . $form_id . '_cols_' . $NO_COLS . '_' . $_SESSION['LANG']))) { // cache miss, generate the search form, add to cache ob_start(); $SearchFormObj->display_dynamic_search_form($NO_COLS); $search_form = ob_get_contents(); ob_end_clean(); jb_cache_add('search_form_' . $form_id . '_cols_' . $NO_COLS . '_' . $_SESSION['LANG'], $search_form); } // output the search form echo $search_form; } else { // generate & serve the search form $SearchFormObj->display_dynamic_search_form($NO_COLS, $search_form_mode); } }
function JB_init_lang_vars() { //global $jb_mysql_link; global $label; global $AVAILABLE_LANGS; global $ACT_LANG_FILES; // active languages global $LANG_FILES; // all language files global $FCK_LANG_FILES; // FCK editor language global $JB_LANG_THEMES; $AVAILABLE_LANGS = array(); $ACT_LANG_FILES = array(); // active languages $LANG_FILES = array(); // all language files $FCK_LANG_FILES = array(); // FCK editor language $JB_LANG_THEMES = array(); if ($lang_vars = jb_cache_get('lang_vars')) { $AVAILABLE_LANGS = $lang_vars['AVAILABLE_LANGS']; $ACT_LANG_FILES = $lang_vars['ACT_LANG_FILES']; $LANG_FILES = $lang_vars['LANG_FILES']; $FCK_LANG_FILES = $lang_vars['FCK_LANG_FILES']; $JB_LANG_THEMES = $lang_vars['JB_LANG_THEMES']; $lang_vars = null; } else { $sql = "SELECT * FROM lang "; if ($result = jb_mysql_query($sql)) { // load languages into array.. map the language code to the filename // if mapping didn't work, default to english.. while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $lang_code = strtoupper($row['lang_code']); $AVAILABLE_LANGS[$lang_code] = $row['name']; $LANG_FILES[$lang_code] = $row['lang_filename']; $FCK_LANG_FILES[$lang_code] = $row['fckeditor_lang']; if ($row['is_active'] == 'Y') { $ACT_LANG_FILES[$lang_code] = $row['lang_filename']; } $JB_LANG_THEMES[$lang_code] = $row['theme']; } $lang_vars['AVAILABLE_LANGS'] = $AVAILABLE_LANGS; $lang_vars['ACT_LANG_FILES'] = $ACT_LANG_FILES; $lang_vars['LANG_FILES'] = $LANG_FILES; $lang_vars['FCK_LANG_FILES'] = $FCK_LANG_FILES; $lang_vars['JB_LANG_THEMES'] = $JB_LANG_THEMES; jb_cache_add('lang_vars', $lang_vars); } else { $DB_ERROR = mysql_error(); } } if (isset($_REQUEST['jb_theme']) && $_SESSION['ADMIN']) { // do this if the theme is being changed in Admin preg_match('#([a-z0-9_\\-]+)#i', stripslashes($_REQUEST['jb_theme']), $m); $lang = isset($_SESSION['LANG']) ? $_SESSION['LANG'] : 'EN'; $sql = "UPDATE `lang` SET `theme`='" . jb_escape_sql($m[1]) . "' WHERE lang_code='" . jb_escape_sql($lang) . "' "; jb_mysql_query($sql); jb_cache_delete('lang_vars'); } if (!$DB_ERROR) { // the $label array is used to store all the language strings loaded from // the language file. if (!isset($label)) { $label = array(); if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . $LANG_FILES[$_SESSION["LANG"]])) { // load the currently selected language include dirname(__FILE__) . DIRECTORY_SEPARATOR . $LANG_FILES[$_SESSION["LANG"]]; } else { // default to eng include dirname(__FILE__) . DIRECTORY_SEPARATOR . "english.php"; } } } }
<?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']);
function display_form_section($mode, $section, $admin, $dont_break_container = false) { global $label; # HTML output for this function comes from JBDynamicFormMarkup Class # include/themes/default/JBDynamicFormMarkup.php # Any HTML customizations should be done there. # Please copy this class in to your custom theme directory, and # customize form there $DFM =& $this->get_DynamicFormMarkup(); $this->set_mode($mode); $cache_key = 'field_list_' . $section . '_' . $this->form_id . '_' . $_SESSION['LANG']; if (!($field_list = jb_cache_get($cache_key))) { $sql = "SELECT t2.field_label AS FLABEL, t1.*, t1.field_id AS ID, t2.field_comment AS FCOMMENT FROM form_fields AS t1, form_field_translations AS t2 WHERE t1.field_id=t2.field_id AND lang='" . JB_escape_sql($_SESSION['LANG']) . "' AND section='" . JB_escape_sql($section) . "' AND form_id='" . JB_escape_sql($this->form_id) . "' ORDER BY field_sort "; $result = JB_mysql_query($sql) or die(mysql_error()); $field_list = array(); while ($field_row = mysql_fetch_array($result, MYSQL_ASSOC)) { $field_list[] = $field_row; } jb_cache_add($cache_key, $field_list); } if (!$dont_break_container) { $DFM->open_container(); // put in a tag to start the element containing the form } if (!sizeof($field_list)) { } // There are no fields in this section to render... $i = 0; foreach ($field_list as $field_row) { $i++; if (method_exists($DFM, 'set_field_row')) { $DFM->set_field_row($field_row); } if ($DFM->get_mode() == 'EDIT' && $_REQUEST['field_id'] == $field_row['field_id']) { // edit the form via Admin, and the field is being edited $bg_selected = ' style="background-color: #FFFFCC;" '; } else { $bg_selected = ''; } // load init value... if ($this->data[$field_row['field_id']] == '') { $this->data[$field_row['field_id']] = $field_row['field_init']; } // For blocked fields, has the user chosen to remain annonymous? $is_restricted = JB_process_field_restrictions($this->data, $field_row, $DFM->get_mode(), $admin); JBPLUG_do_callback('pre_process_field', $this->data, $field_row); ######################## JBPLUG_do_callback('display_custom_2col_field', $field_row, $this->data, $admin, $DFM->get_mode()); // your plugin should set $field_row['field_type'] to 'PLUGIN' to signal that it printed something out if ($field_row['is_hidden'] == 'Y' && $DFM->get_mode() == 'view' && !$admin) { # Hidden Fields, do not appear on website (view mode) } elseif ($field_row['field_type'] == 'PLUGIN') { // do nothing, already printed by plugin } elseif ($field_row['field_type'] == 'SEPERATOR') { $DFM->field_start(); $DFM->seperator_open($bg_selected); if ($DFM->get_mode() == 'EDIT') { JB_echo_order_arrows($field_row); echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $field_row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-"> '; } $DFM->seperator_display(); // display the label if ($DFM->get_mode() == 'EDIT') { echo '</a>'; } $DFM->seperator_close(); $DFM->field_end(); } elseif ($field_row['field_type'] == "SKILL_MATRIX") { $DFM->field_start($bg_selected); $DFM->skill_matrix_field_open($bg_selected); if ($DFM->get_mode() == 'EDIT') { JB_echo_order_arrows($field_row); echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $field_row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-"> '; } $DFM->skill_matrix_field_label(); if ($DFM->get_mode() == 'EDIT') { echo '</a>'; ?> <br> - <a href="" onclick="window.open('build_matrix.php?field_id=<?php echo $field_row['field_id']; ?> ', '', 'toolbar=no,scrollbars=yes,location=no,statusbar=no,menubar=no,resizable=1,width=550,height=500,left = 50,top = 50');return false;"> [Skill Matrix Settings...] </a> <?php } $DFM->skill_matrix_field_close(); $DFM->skill_matrix_value_open($bg_selected); if ($is_restricted) { echo $this->data[$field_row['field_id']]; } else { $DFM->skill_matrix_form(); } $DFM->skill_matrix_value_close(); $DFM->field_end(); } elseif ($field_row['field_type'] == 'YOUTUBE') { if ($DFM->get_mode() == 'view' && $this->data[$field_row['field_id']] == '') { // do not show the youtube field if it is blank continue; } $DFM->field_start(); $DFM->youtube_field_open($bg_selected); if ($DFM->get_mode() == 'EDIT') { JB_echo_order_arrows($field_row); echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $field_row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-">'; } $DFM->youtube_label(); if ($DFM->get_mode() == 'EDIT') { echo '</a>'; } if ($DFM->get_mode() == 'EDIT' && JB_is_reserved_template_tag($field_row['template_tag'])) { $alt = JB_get_reserved_tag_description($field_row['template_tag']); ?> <a href="" onclick="alert('<?php echo htmlentities($alt); ?> ');return false;"> <IMG SRC="../admin/reserved.gif" WIDTH="13" HEIGHT="13" BORDER="0" ALT="<?php echo $alt; ?> "> </a> <?php } if ($_REQUEST['del_video' . $field_row['field_id']] != '') { // delete video if (!$admin) { $user_sql = " AND user_id='" . JB_escape_sql($_SESSION['JB_ID']) . "' "; } else { $user_sql = " AND user_id='" . JB_escape_sql($this->data['user_id']) . "'"; } $where = ' 1=2 '; if (is_numeric($_REQUEST['resume_id'])) { $where = " `resume_id`='" . JB_escape_sql($_REQUEST['resume_id']) . "' "; } elseif (is_numeric($_REQUEST['post_id'])) { $where = " `post_id`='" . JB_escape_sql($_REQUEST['post_id']) . "' "; } elseif (is_numeric($_REQUEST['profile_id'])) { $where = " `profile_id`='" . JB_escape_sql($_REQUEST['profile_id']) . "' "; } elseif (is_numeric($_REQUEST['user_id'])) { $where = " `ID`='" . JB_escape_sql($_REQUEST['user_id']) . "' "; } $table_name = JB_get_table_name_by_id($this->form_id); $sql = "UPDATE `" . $table_name . "` SET `" . JB_escape_sql($field_row['field_id']) . "` = '' WHERE {$where} {$user_sql} "; JB_mysql_query($sql) or die(mysql_error()); $this->data[$field_row['field_id']] = ''; $_REQUEST[$field_row['field_id']] = ''; } if ($this->data[$field_row['field_id']] != '') { if ($is_restricted) { echo $this->data[$field_row['field_id']]; } else { // embed the field if ($field_row['field_width'] < 30) { $field_row['field_width'] = 325; } if ($field_row['field_height'] < 30) { $field_row['field_height'] = 250; } $DFM->youtube_display(); // embed youtube vid } } if (strtolower($DFM->get_mode()) == 'edit') { // display input fields for the form if (!$this->data[$field_row['field_id']]) { $DFM->youtube_field(); // input youtube url } else { $DFM->youtube_delete_button(); } } $DFM->youtube_field_close(); $DFM->field_end(); } elseif ($field_row['field_type'] == "IMAGE") { $DFM->field_start(); $DFM->image_field_open($bg_selected); if ($DFM->get_mode() == 'EDIT') { // admin's form editor JB_echo_order_arrows($field_row); echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $field_row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-">'; } if ($field_row['is_required'] == 'Y' && $DFM->get_mode() != 'view') { echo $DFM->get_required_mark(); } $DFM->image_label($field_row); if ($DFM->get_mode() == 'EDIT') { echo '</a>'; } if ($DFM->get_mode() == 'EDIT' && JB_is_reserved_template_tag($field_row['template_tag'])) { $alt = JB_get_reserved_tag_description($field_row['template_tag']); ?> <a href="" onclick="alert('<?php echo htmlentities($alt); ?> ');return false;"> <IMG SRC="../admin/reserved.gif" WIDTH="13" HEIGHT="13" BORDER="0" ALT="<?php echo $alt; ?> "> </a> <?php } if ($this->data[$field_row['field_id']] != '') { if ($is_restricted) { echo $this->data[$field_row['field_id']]; } else { // display the field if ($_REQUEST['del_image' . $field_row['field_id']] != '') { if ($admin || strpos($this->data[$field_row['field_id']], $_SESSION['JB_ID'] . '_') === 0) { // if Admin or the filename starts with the user's id JB_delete_image($this->data[$field_row['field_id']]); } } if (JB_image_thumb_file_exists($this->data[$field_row['field_id']])) { // display the image if (JB_KEEP_ORIGINAL_IMAGES == 'YES' && JB_image_original_file_exists($this->data[$field_row['field_id']])) { $DFM->image_linked_display(); } else { $DFM->image_thumb_display(); } } else { // no image (but value exists in the database!) $DFM->image_display_null(); } } } else { // no data uploaded $DFM->image_display_null(); } if (strtolower($DFM->get_mode()) == 'edit') { // display input fields for the form // delete image button if (JB_image_thumb_file_exists($this->data[$field_row['field_id']]) && $this->data[$field_row['field_id']] != '') { $DFM->image_delete_button(); } else { // upload image form $DFM->image_field(); } } $DFM->image_field_close(); $DFM->field_end(); } elseif ($field_row['field_type'] == 'FILE') { $DFM->field_start(); $DFM->file_field_open($bg_selected); if ($DFM->get_mode() == 'EDIT') { JB_echo_order_arrows($field_row); echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $field_row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-">'; } $DFM->file_label(); if ($DFM->get_mode() == 'EDIT') { echo '</a>'; } if ($field_row['is_required'] == 'Y' && $DFM->get_mode() != 'view') { echo $DFM->get_required_mark(); } if ($DFM->get_mode() == 'EDIT' && JB_is_reserved_template_tag($field_row['template_tag'])) { $alt = JB_get_reserved_tag_description($field_row['template_tag']); ?> <a href="" onclick="alert('<?php echo htmlentities($alt); ?> ');return false;"> <IMG SRC="../admin/reserved.gif" WIDTH="13" HEIGHT="13" BORDER="0" ALT="<?php echo $alt; ?> "> </a> <?php } if ($_REQUEST['del_file' . $field_row['field_id']] != '') { if ($admin || strpos($this->data[$field_row['field_id']], $_SESSION['JB_ID'] . '_') === 0) { // if admin or the filename starts with the user's id JB_delete_file($this->data[$field_row['field_id']]); } } if ($is_restricted) { echo $this->data[$field_row['field_id']]; } elseif (JB_upload_file_exists($this->data[$field_row['field_id']])) { $DFM->file_display_link(); } elseif ($DFM->get_mode() == 'view') { $DFM->file_not_uploaded(); } if (strtolower($DFM->get_mode()) == 'edit') { if (JB_upload_file_exists($this->data[$field_row['field_id']]) && $this->data[$field_row['field_id']] != '') { $DFM->file_delete_button(); } else { $DFM->file_field(); } } $DFM->file_field_close(); $DFM->field_end(); } elseif ($field_row['field_type'] == 'NOTE') { if ($DFM->get_mode() == 'view') { // note is only shown when edting the form } else { $DFM->field_start(); $DFM->note_open($bg_selected); if ($DFM->get_mode() == 'EDIT') { JB_echo_order_arrows($field_row); echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $field_row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-"> '; } $DFM->note_field(); if ($DFM->get_mode() == 'EDIT') { echo '</a>'; } if ($DFM->get_mode() == 'EDIT' && JB_is_reserved_template_tag($field_row['template_tag'])) { $alt = JB_get_reserved_tag_description($field_row['template_tag']); ?> <a href="" onclick="alert('<?php echo htmlentities($alt); ?> ');return false;"> <IMG SRC="../admin/reserved.gif" WIDTH="13" HEIGHT="13" BORDER="0" ALT="<?php echo $alt; ?> "> </a> <?php } $DFM->note_close(); $DFM->field_end(); } } elseif ($field_row['field_type'] == 'GMAP') { // Google map if ($DFM->get_mode() == 'view' && JB_GMAP_SHOW_IF_MAP_EMPTY != 'YES' && $this->data[$field_row['field_id'] . '_lat'] == 0) { continue; // do not show this field } require_once JB_basedirpath() . 'include/classes/JBGoogleMap.php'; $DFM->field_start(); $DFM->gmap_open($bg_selected); if ($DFM->get_mode() == 'EDIT') { JB_echo_order_arrows($field_row); echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $field_row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-">'; } if ($field_row['is_required'] == 'Y' && $DFM->get_mode() != 'view') { echo $DFM->get_required_mark(); } $DFM->gmap_field_label(); if ($DFM->get_mode() == 'EDIT') { echo '</a>'; } if ($DFM->get_mode() == 'view') { if ($is_restricted) { echo $this->data[$field_row['field_id']]; } else { $DFM->gmap_show(); } } else { $DFM->gmap_mark(); } $DFM->gmap_close(); $DFM->field_end(); } else { // Fields below are made from two sides // Left side: field_left_open() // - The left side is used to display the field's label // // Right side: field_right_open() // - The right side is where the form widget is displayed when // editing the form, or where the data value is displayed // close with field_right_clode() if ($field_row['FLABEL'] == '') { // field label is blank? $field_row['FLABEL'] = $DFM->get_blank_field_label(); } $DFM->field_start(); $DFM->field_left_open($bg_selected); if ($DFM->get_mode() == 'EDIT') { JB_echo_order_arrows($field_row); echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $field_row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-">'; } $DFM->field_label(); if ($DFM->get_mode() == 'EDIT') { echo '</a>'; } if ($field_row['is_required'] == 'Y' && $DFM->get_mode() != 'view') { echo $DFM->get_required_mark(); } if ($DFM->get_mode() == 'EDIT' && JB_is_reserved_template_tag($field_row['template_tag'])) { $alt = JB_get_reserved_tag_description($field_row['template_tag']); ?> <a href="" onclick="alert('<?php echo htmlentities($alt); ?> ');return false;"> <IMG SRC="../admin/reserved.gif" WIDTH="13" HEIGHT="13" BORDER="0" ALT="<?php echo $alt; ?> "> </a> <?php } if ($DFM->get_mode() == 'EDIT' && $field_row['field_type'] == 'BLANK') { echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $field_row['field_id'] . '&mode=EDIT">[]</a>'; } $DFM->field_left_close(); $DFM->field_right_open($bg_selected); if ($is_restricted) { echo $this->data[$field_row['field_id']]; // display blocked field message } else { switch ($field_row['field_type']) { case 'URL': $val = $this->get_template_value($field_row['template_tag'], $admin); if ($DFM->get_mode() == 'view') { echo $DFM->get_url_templated($val); } else { $DFM->text_field(); } break; case "TEXT": case "URL": case "CURRENCY": case "NUMERIC": case "INTEGER": if ($DFM->get_mode() == 'view') { // $this->get_template_value() will get and process the data value // for example, if CURRENCY, then it format in to a currency $val = $this->get_template_value($field_row['template_tag'], $admin); $val = JB_email_at_replace($val); $DFM->_print($val); } else { $DFM->text_field(); } break; case 'EDITOR': if ($DFM->get_mode() == 'view') { $val = $this->get_template_value($field_row['template_tag'], $admin); if (!preg_match("/<.*?>/U", $val)) { // Not text mode? $val = preg_replace('/\\n/', '<br>', $val); } if (JB_EMAIL_AT_REPLACE != 'NO') { // eliminate tags with mailto: $val = preg_replace('@<a href=["|\']mailto:.*["|\'] *>(.*)</a>@Ui', '$1', $val); $val = JB_email_at_replace($val); } # $DFM->_print($val); } else { $DFM->editor_field(); } break; case "TEXTAREA": if ($DFM->get_mode() == 'view') { $val = $this->get_template_value($field_row['template_tag'], $admin); $val = str_replace("\n", "<br>", $val); $val = JB_email_at_replace($val); echo $DFM->_print($val); } else { $DFM->textarea_field(); } break; case "CATEGORY": if ($DFM->get_mode() == 'view') { if ($this->form_id != 1 || strpos($_SERVER['PHP_SELF'], 'index.php') === false) { // not posting form, not index.php, assuming index.php is the home page. Only the home page has functionality for displaying the category after the links are clicked // not linked to the category $DFM->_print($this->get_template_value($field_row['template_tag'], $admin)); } elseif (JB_CAT_PATH_ONLY_LEAF == 'YES') { // with link $cat = array(); $cat = JB_get_category($this->data[$field_row['field_id']]); $cat_url = JB_cat_url_write($this->data[$field_row['field_id']], $cat['NAME'], $cat['seo_fname']); $DFM->category_link($cat_url, $cat['NAME']); } else { // Multiple links - // Output the category using breadcrumb navigation // eg. Location -> Australia -> NSW $DFM->category_breadcrumbs(); } } else { $DFM->category_field(); } break; case "DATE": case "DATE_CAL": if ($DFM->get_mode() == 'view') { $val = $this->get_template_value($field_row['template_tag'], $admin); $DFM->_print($val); } else { if ($field_row['field_type'] == 'DATE') { // traditional date input if ($this->data[$field_row['field_id']] == '0000-00-00 00:00:00' || $this->data[$field_row['field_id']] == '') { $year = ''; $day = ''; $month = ''; } else { preg_match("/(\\d+)-(\\d+)-(\\d+)/", $this->data[$field_row['field_id']], $m); // Year - Month - Day (database output format) $year = $m[1]; $day = $m[3]; $month = $m[2]; } $DFM->date_field($day, $month, $year); } else { // scw input $DFM->date_field_scw(); } } break; case "SELECT": if ($DFM->get_mode() == 'view') { $val = $this->get_template_value($field_row['template_tag'], $admin); $DFM->_print($val); } else { $DFM->select_field(); } if ($DFM->get_mode() == 'EDIT') { ?> <a href="" onclick="window.open('maintain_codes.php?field_id=<?php echo $field_row['field_id']; ?> ', '', 'toolbar=no,scrollbars=yes,location=no,statusbar=no,menubar=no,resizable=1,width=400,height=500,left = 50,top = 50');return false;"> [Edit Options]</a> <?php } break; case "RADIO": if ($DFM->get_mode() == 'view') { $val = $this->get_template_value($field_row['template_tag'], $admin); $DFM->_print($val); } else { $DFM->radio_field(); } if ($DFM->get_mode() == 'EDIT') { ?> <a href="" onclick="window.open('maintain_codes.php?field_id=<?php echo $field_row['field_id']; ?> ', '', 'toolbar=no,scrollbars=yes,location=no,statusbar=no,menubar=no,resizable=1,width=400,height=500,left = 50,top = 50');return false;"> [Edit Options]</a> <?php } break; case "CHECK": if ($DFM->get_mode() == 'view') { $val = $this->get_template_value($field_row['template_tag'], $admin); $DFM->_print($val); } else { $DFM->checkbox_field(); } if ($DFM->get_mode() == 'EDIT') { ?> <a href="" onclick="window.open('maintain_codes.php?field_id=<?php echo $field_row['field_id']; ?> ', '', 'toolbar=no,scrollbars=yes,location=no,statusbar=no,menubar=no,resizable=1,width=400,height=500,left = 50,top = 50');return false;"> [Edit Options]</a> <?php } break; case "MSELECT": if ($DFM->get_mode() == 'view') { $val = $this->get_template_value($field_row['template_tag'], $admin); $DFM->_print($val); } else { $DFM->multiple_select_field(); } if ($DFM->get_mode() == 'EDIT') { ?> <a href="" onclick="window.open('maintain_codes.php?field_id=<?php echo $field_row['field_id']; ?> ', '', 'toolbar=no,scrollbars=yes,location=no,statusbar=no,menubar=no,resizable=1,width=400,height=500,left = 50,top = 50');return false;"> [Edit Options] </a> <?php } break; case "BLANK": $DFM->blank_field(); break; default: JBPLUG_do_callback('display_custom_field', $field_row, $this->data, $admin, $DFM->get_mode()); // Your module should change $field_row['field_type'] to 'PLUGIN' break; } } $DFM->field_right_close(); $DFM->field_end(); } } if (!$dont_break_container) { $DFM->close_container(); } }