';
return $list;
}
function getTranslatedString($str) {
global $app_strings;
return (isset($app_strings[$str])) ? $app_strings[$str] : $str;
}
// The function to get html format list data
// input array
// output htmlsource list array
//only for product
function getblock_fieldlistview_product($block_array, $module) {
$header = array();
$header[0] = getTranslatedString($module);
$header[1] = getTranslatedString('QUOTE_RELATED').getTranslatedString($module);
$header[2] = getTranslatedString('INVOICE_RELATED').getTranslatedString($module);
if ($block_array == '') {
$list.='
';
}
return $list;
}
// The function to get html format list data
// input array
// output htmlsource list array
//for quotes,notes and invoice
function getblock_fieldlistview($block_array, $block) {
if ($block_array[0] == "#MODULE INACTIVE#") {
$list.='
';
}
if ($noofdata != '') {
for ($j = 0; $j < $noofdata; $j++) {
if ($j == 0 || $j % 2 == 0)
$list .='
';
else
$list .='
';
for ($i = 0; $i < $nooffields; $i++) {
$data = $data_arr[$j][$i]['fielddata'];
if ($data == '')
$data = ' ';
if (stripos($data_arr[$j][$i]['fielddata'], 'download') != 0) {
$list .= '
'.$data."
";
} else {
$list .= "
".$data."
";
}
}
$list .='
';
}
$list .= '
';
}
return $list;
}
// The function to get html format url_list data
// input array
// output htmlsource list array
function getblockurl_fieldlistview($block_array, $block) {
$header_arr = $block_array[0][$block]['head'][0][0];
$nooffields = count($header_arr);
$data_arr = $block_array[1][$block]['data'];
$noofdata = count($data_arr);
if ($nooffields != '') {
$list .='
';
}
if ($noofdata != '') {
for ($j = 0; $j < $noofdata; $j++) {
for ($j1 = 0; $j1 < count($data_arr[$j]); $j1++) {
if ($j1 == '0' || $j1 % 2 == 0)
$list .='
';
else
$list .='
';
for ($i = 0; $i < $nooffields; $i++) {
$data = $data_arr[$j][$j1][$i]['fielddata'];
if ($data == '')
$data = ' ';
if ($i == '0' || $i == '1') {
if ($j1 == '0')
$list .= '
'.$data."
";
} else
$list .= "
".$data."
";
}
$list .='
';
}
}
}
$list .= '
';
return $list;
}
/* Function to Show the languages in the Login page
* Takes an array from PortalConfig.php file $language
* Returns a list of available Language
*/
function getPortalLanguages() {
global $languages, $default_language;
foreach ($languages as $name => $label) {
if (strcmp($default_language, $name) == 0) {
$list .= '';
} else {
$list .= '';
}
}
return $list;
}
/* Function to set the Current Language
* Sets the Session with the Current Language
*/
function setPortalCurrentLanguage() {
global $default_language;
if (isset($_REQUEST['login_language']) && $_REQUEST['login_language'] != '') {
$_SESSION['portal_login_language'] = $_REQUEST['login_language'];
} else {
$_SESSION['portal_login_language'] = $default_language;
}
}
/* Function to get the Current Language
* Returns the Current Language
*/
function getPortalCurrentLanguage() {
global $default_language;
if (isset($_SESSION['portal_login_language']) && $_SESSION['portal_login_language'] != '') {
$default_language = $_SESSION['portal_login_language'];
} else {
$default_language = 'en_us';
}
return $default_language;
}
/** HTML Purifier global instance */
$__htmlpurifier_instance = false;
/*
* Purify (Cleanup) malicious snippets of code from the input
*
* @param String $value
* @param Boolean $ignore Skip cleaning of the input
* @return String
*/
function portal_purify($input, $ignore = false) {
global $default_charset, $__htmlpurifier_instance;
$use_charset = $default_charset;
$value = $input;
if ($ignore === false) {
// Initialize the instance if it has not yet done
if (empty($use_charset))
$use_charset = 'UTF-8';
if ($__htmlpurifier_instance === false) {
require_once('include/htmlpurify/library/HTMLPurifier.auto.php');
$config = HTMLPurifier_Config::createDefault();
$config->set('Core.Encoding', $use_charset);
$config->set('Cache.SerializerPath', "test/cache");
$config->set('HTML', 'ForbiddenAttributes', 'img@src');
$__htmlpurifier_instance = new HTMLPurifier($config);
}
if ($__htmlpurifier_instance) {
$value = $__htmlpurifier_instance->purify($value);
}
}
$value = str_replace('&', '&', $value);
return $value;
}
?>