Merge github.com:Dolibarr/dolibarr into dev_new_add_desc_when_select_product

This commit is contained in:
Florian HENRY
2020-10-28 08:52:29 +01:00
704 changed files with 8683 additions and 8630 deletions

View File

@@ -235,7 +235,7 @@ function journalHead($nom, $variante, $period, $periodlink, $description, $build
print '</table>';
dol_fiche_end();
print dol_get_fiche_end();
print '<div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></div>';

View File

@@ -1258,7 +1258,7 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di
* @param array $links Array of tabs. Currently initialized by calling a function xxx_admin_prepare_head
* @param string $active Active tab name (document', 'info', 'ldap', ....)
* @param string $title Title
* @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using dol_fiche_end() to close tab is not required), -2=Add tab header with no seaparation under tab (to start a tab just after)
* @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using print dol_get_fiche_end() to close tab is not required), -2=Add tab header with no seaparation under tab (to start a tab just after)
* @param string $picto Add a picto on tab title
* @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto.
* @param string $morehtmlright Add more html content on right of tabs title
@@ -1279,7 +1279,7 @@ function dol_fiche_head($links = array(), $active = '0', $title = '', $notab = 0
* @param array $links Array of tabs
* @param string $active Active tab name
* @param string $title Title
* @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using dol_fiche_end() to close tab is not required), -2=Add tab header with no seaparation under tab (to start a tab just after)
* @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using print dol_get_fiche_end() to close tab is not required), -2=Add tab header with no seaparation under tab (to start a tab just after)
* @param string $picto Add a picto on tab title
* @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto.
* @param string $morehtmlright Add more html content on right of tabs title
@@ -1456,6 +1456,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
*
* @param int $notab -1 or 0=Add tab footer, 1=no tab footer
* @return void
* @deprecated Use print dol_get_fiche_end() instead
*/
function dol_fiche_end($notab = 0)
{
@@ -3316,9 +3317,9 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$enabledisablehtml = '<span class="'.$fa.' '.$fakey.($marginleftonlyshort ? ($marginleftonlyshort == 1 ? ' marginleftonlyshort' : ' marginleftonly') : '');
$enabledisablehtml .= ($morecss ? ' '.$morecss : '').'" style="'.($fasize ? ('font-size: '.$fasize.';') : '').($facolor ? (' color: '.$facolor.';') : '').($morestyle ? ' '.$morestyle : '').'"'.(($notitle || empty($titlealt)) ? '' : ' title="'.dol_escape_htmltag($titlealt).'"').($moreatt ? ' '.$moreatt : '').'>';
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
/*if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$enabledisablehtml .= $titlealt;
}
}*/
$enabledisablehtml .= '</span>';
return $enabledisablehtml;
@@ -3952,7 +3953,7 @@ function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin = '1', $morecss
* However, one must try to call it only within php pages, classes must return their error through their property "error".
*
* @param DoliDB $db Database handler
* @param string|[string] $error String or array of errors strings to show
* @param string|string[] $error String or array of errors strings to show
* @param array $errors Array of errors
* @return void
* @see dol_htmloutput_errors()
@@ -6691,7 +6692,7 @@ function dolGetFirstLastname($firstname, $lastname, $nameorder = -1)
* Note: Calling dol_htmloutput_events is done into pages by standard llxFooter() function.
* Note: Prefer to use setEventMessages instead.
*
* @param string|[string] $mesgs Message string or array
* @param string|string[] $mesgs Message string or array
* @param string $style Which style to use ('mesgs' by default, 'warnings', 'errors')
* @return void
* @see dol_htmloutput_events()
@@ -6700,10 +6701,10 @@ function setEventMessage($mesgs, $style = 'mesgs')
{
//dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); This is not deprecated, it is used by setEventMessages function
if (!is_array($mesgs)) {
// If mesgs is a string
// If mesgs is a string
if ($mesgs) $_SESSION['dol_events'][$style][] = $mesgs;
} else {
// If mesgs is an array
// If mesgs is an array
foreach ($mesgs as $mesg)
{
if ($mesg) $_SESSION['dol_events'][$style][] = $mesg;
@@ -8994,8 +8995,7 @@ function addSummaryTableLine($tableColumnCount, $num, $nbofloop = 0, $total = 0,
}
/**
* Return a file on output using a lo memory.
* It can return very large files with no need of memory.
* Return a file on output using a low memory. It can return very large files with no need of memory.
* WARNING: This close output buffers.
*
* @param string $fullpath_original_file_osencoded Full path of file to return.

View File

@@ -227,12 +227,12 @@ function dol_print_object_info($object, $usetable = 0)
else print ': ';
if (is_object($object->user_creation))
{
if ($object->user_creation->id) print $object->user_creation->getNomUrl(1, '', 0, 0, 0);
if ($object->user_creation->id) print $object->user_creation->getNomUrl(-1, '', 0, 0, 0);
else print $langs->trans("Unknown");
} else {
$userstatic = new User($db);
$userstatic->fetch($object->user_creation_id ? $object->user_creation_id : $object->user_creation);
if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0);
else print $langs->trans("Unknown");
}
if ($usetable) print '</td></tr>';
@@ -261,12 +261,12 @@ function dol_print_object_info($object, $usetable = 0)
else print ': ';
if (is_object($object->user_modification))
{
if ($object->user_modification->id) print $object->user_modification->getNomUrl(1, '', 0, 0, 0);
if ($object->user_modification->id) print $object->user_modification->getNomUrl(-1, '', 0, 0, 0);
else print $langs->trans("Unknown");
} else {
$userstatic = new User($db);
$userstatic->fetch($object->user_modification_id ? $object->user_modification_id : $object->user_modification);
if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0);
else print $langs->trans("Unknown");
}
if ($usetable) print '</td></tr>';
@@ -295,12 +295,12 @@ function dol_print_object_info($object, $usetable = 0)
else print ': ';
if (is_object($object->user_validation))
{
if ($object->user_validation->id) print $object->user_validation->getNomUrl(1, '', 0, 0, 0);
if ($object->user_validation->id) print $object->user_validation->getNomUrl(-1, '', 0, 0, 0);
else print $langs->trans("Unknown");
} else {
$userstatic = new User($db);
$userstatic->fetch($object->user_validation_id ? $object->user_validation_id : $object->user_validation);
if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0);
else print $langs->trans("Unknown");
}
if ($usetable) print '</td></tr>';
@@ -329,12 +329,12 @@ function dol_print_object_info($object, $usetable = 0)
else print ': ';
if (is_object($object->user_approve))
{
if ($object->user_approve->id) print $object->user_approve->getNomUrl(1, '', 0, 0, 0);
if ($object->user_approve->id) print $object->user_approve->getNomUrl(-1, '', 0, 0, 0);
else print $langs->trans("Unknown");
} else {
$userstatic = new User($db);
$userstatic->fetch($object->user_approve_id ? $object->user_approve_id : $object->user_approve);
if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0);
else print $langs->trans("Unknown");
}
if ($usetable) print '</td></tr>';
@@ -363,7 +363,7 @@ function dol_print_object_info($object, $usetable = 0)
else print ': ';
$userstatic = new User($db);
$userstatic->fetch($object->user_approve_id2);
if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0);
else print $langs->trans("Unknown");
if ($usetable) print '</td></tr>';
else print '<br>';
@@ -392,12 +392,12 @@ function dol_print_object_info($object, $usetable = 0)
else print ': ';
if (is_object($object->user_closing))
{
if ($object->user_closing->id) print $object->user_closing->getNomUrl(1, '', 0, 0, 0);
if ($object->user_closing->id) print $object->user_closing->getNomUrl(-1, '', 0, 0, 0);
else print $langs->trans("Unknown");
} else {
$userstatic = new User($db);
$userstatic->fetch($object->user_closing);
if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0);
else print $langs->trans("Unknown");
}
if ($usetable) print '</td></tr>';
@@ -427,7 +427,7 @@ function dol_print_object_info($object, $usetable = 0)
else print ': ';
if (is_object($object->user_rappro))
{
if ($object->user_rappro->id) print $object->user_rappro->getNomUrl(1, '', 0, 0, 0);
if ($object->user_rappro->id) print $object->user_rappro->getNomUrl(-1, '', 0, 0, 0);
else print $langs->trans("Unknown");
} else {
$userstatic = new User($db);
@@ -492,7 +492,7 @@ function dolAddEmailTrackId($email, $trackingid)
function isValidMailDomain($mail)
{
list($user, $domain) = explode("@", $mail, 2);
return ($domain ? isValidMXRecord($domain, "MX") : 0);
return ($domain ? isValidMXRecord($domain) : 0);
}
/**
@@ -1641,7 +1641,7 @@ function getListOfModels($db, $type, $maxfilenamelength = 0)
$liste[$obj->id.':'.$key] = ($obj->label ? $obj->label : $obj->doc_template_name).' '.$val['name'];
}
} else {
// Common usage
// Common usage
$liste[$obj->id] = $obj->label ? $obj->label : $obj->doc_template_name;
}
}

View File

@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2008-2013 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2008-2020 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,20 +18,24 @@
/**
* \file htdocs/core/lib/geturl.lib.php
* \brief This file contains functions dedicated to get URL.
* \brief This file contains functions dedicated to get URLs.
*/
/**
* Function to get a content from an URL (use proxy if proxy defined)
* Function to get a content from an URL (use proxy if proxy defined).
* Support Dolibarr setup for timeout and proxy.
* Enhancement of CURL to add an anti SSRF protection.
*
* @param string $url URL to call.
* @param string $postorget 'POST', 'GET', 'HEAD', 'PUT', 'PUTALREADYFORMATED', 'POSTALREADYFORMATED', 'DELETE'
* @param string $param Parameters of URL (x=value1&y=value2) or may be a formated content with PUTALREADYFORMATED
* @param integer $followlocation 1=Follow location, 0=Do not follow
* @param string $param Parameters of URL (x=value1&y=value2) or may be a formated content with $postorget='PUTALREADYFORMATED'
* @param integer $followlocation 0=Do not follow, 1=Follow location.
* @param string[] $addheaders Array of string to add into header. Example: ('Accept: application/xrds+xml', ....)
* @param string[] $allowedschemes List of schemes that are allowed ('http' + 'https' only by default)
* @param int $localurl 0=Only external URL are possible, 1=Only local URL, 2=Both external and local URL are allowed.
* @return array Returns an associative array containing the response from the server array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...)
*/
function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = 1, $addheaders = array())
function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = 1, $addheaders = array(), $allowedschemes = array('http', 'https'), $localurl = 0)
{
//declaring of global variables
global $conf;
@@ -50,13 +54,14 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
print $USE_PROXY."-".$gv_ApiErrorURL."<br>";
print $nvpStr;
exit;*/
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Dolibarr geturl function');
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, ($followlocation ?true:false)); // We use @ here because this may return warning if safe mode is on or open_basedir is on
// We use @ here because this may return warning if safe mode is on or open_basedir is on (following location is forbidden when safe mode is on).
// We force value to false so we will manage redirection ourself later.
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
if (count($addheaders)) curl_setopt($ch, CURLOPT_HTTPHEADER, $addheaders);
if (is_array($addheaders) && count($addheaders)) curl_setopt($ch, CURLOPT_HTTPHEADER, $addheaders);
curl_setopt($ch, CURLINFO_HEADER_OUT, true); // To be able to retrieve request header and log it
// By default use tls decied by PHP.
@@ -64,25 +69,33 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
if (!empty($conf->global->MAIN_CURL_SSLVERSION)) curl_setopt($ch, CURLOPT_SSLVERSION, $conf->global->MAIN_CURL_SSLVERSION);
//curl_setopt($ch, CURLOPT_SSLVERSION, 6); for tls 1.2
//turning off the server and peer verification(TrustManager Concept).
// Turning off the server and peer verification(TrustManager Concept).
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
// Restrict use to some protocols only
$protocols = 0;
if (is_array($allowedschemes)) {
foreach($allowedschemes as $allowedscheme) {
if ($allowedscheme == 'http') $protocols |= CURLPROTO_HTTP;
if ($allowedscheme == 'https') $protocols |= CURLPROTO_HTTPS;
}
curl_setopt($ch, CURLOPT_PROTOCOLS, $protocols);
curl_setopt($ch, CURLOPT_REDIR_PROTOCOLS, $protocols);
}
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, empty($conf->global->MAIN_USE_CONNECT_TIMEOUT) ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT);
curl_setopt($ch, CURLOPT_TIMEOUT, empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT) ? 30 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT);
//curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true); // PHP 5.5
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // We want response
if ($postorget == 'POST')
{
if ($postorget == 'POST') {
curl_setopt($ch, CURLOPT_POST, 1); // POST
curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // Setting param x=a&y=z as POST fields
} elseif ($postorget == 'POSTALREADYFORMATED')
{
} elseif ($postorget == 'POSTALREADYFORMATED') {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); // HTTP request is 'POST' but param string is taken as it is
curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // param = content of post, like a xml string
} elseif ($postorget == 'PUT')
{
} elseif ($postorget == 'PUT') {
$array_param = null;
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT'
if (!is_array($param)) parse_str($param, $array_param);
@@ -91,32 +104,90 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
$array_param = $param;
}
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array_param)); // Setting param x=a&y=z as PUT fields
} elseif ($postorget == 'PUTALREADYFORMATED')
{
} elseif ($postorget == 'PUTALREADYFORMATED') {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT'
curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // param = content of post, like a xml string
} elseif ($postorget == 'HEAD')
{
} elseif ($postorget == 'HEAD') {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD'); // HTTP request is 'HEAD'
curl_setopt($ch, CURLOPT_NOBODY, true);
} elseif ($postorget == 'DELETE')
{
} elseif ($postorget == 'DELETE') {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); // POST
} else {
curl_setopt($ch, CURLOPT_POST, 0); // GET
}
//if USE_PROXY constant set at begin of this method.
if ($USE_PROXY)
{
if ($USE_PROXY) {
dol_syslog("getURLContent set proxy to ".$PROXY_HOST.":".$PROXY_PORT." - ".$PROXY_USER.":".$PROXY_PASS);
//curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); // Curl 7.10
curl_setopt($ch, CURLOPT_PROXY, $PROXY_HOST.":".$PROXY_PORT);
if ($PROXY_USER) curl_setopt($ch, CURLOPT_PROXYUSERPWD, $PROXY_USER.":".$PROXY_PASS);
}
//getting response from server
$response = curl_exec($ch);
$newUrl = $url;
$maxRedirection = 5;
$info = array();
$response = '';
do
{
if ($maxRedirection < 1) break;
curl_setopt($ch, CURLOPT_URL, $newUrl);
// Parse $newUrl
$newUrlArray = parse_url($newUrl);
$hosttocheck = $newUrlArray['host'];
$hosttocheck = str_replace(array('[', ']'), '', $hosttocheck); // Remove brackets of IPv6
if (in_array($hosttocheck, array('localhost', 'localhost.domain'))) {
$iptocheck = '127.0.0.1';
} else {
// TODO Resolve $iptocheck to get an IP and set CURLOPT_CONNECT_TO to use this ip
$iptocheck = $hosttocheck;
}
if (!filter_var($iptocheck, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6)) { // This is not an IP
$iptocheck = 0; //
}
if ($iptocheck) {
if ($localurl == 0) { // Only external url allowed (dangerous, may allow to get malware)
if (!filter_var($iptocheck, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
$info['http_code'] = 400;
$info['content'] = 'Error bad hostname IP (private or reserved range). Must be an external URL.';
break;
}
if (in_array($iptocheck, array('100.100.100.200'))) {
$info['http_code'] = 400;
$info['content'] = 'Error bad hostname IP (Used by Alibaba metadata). Must be an external URL.';
break;
}
}
if ($localurl == 1) { // Only local url allowed (dangerous, may allow to get metadata on server or make internal port scanning)
if (filter_var($iptocheck, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
$info['http_code'] = 400;
$info['content'] = 'Error bad hostname. Must be a local URL.';
break;
}
}
}
// Getting response from server
$response = curl_exec($ch);
$info = curl_getinfo($ch); // Reading of request must be done after sending request
$http_code = $info['http_code'];
if ($followlocation && ($http_code == 301 || $http_code == 302 || $http_code == 303 || $http_code == 307)) {
$newUrl = $info['redirect_url'];
$maxRedirection--;
// TODO Use $info['local_ip'] and $info['primary_ip'] ?
continue;
} else {
$http_code = 0;
}
}
while($http_code);
$request = curl_getinfo($ch, CURLINFO_HEADER_OUT); // Reading of request must be done after sending request
@@ -136,7 +207,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
dol_syslog("getURLContent response array is ".join(',', $rep));
} else {
$info = curl_getinfo($ch);
//$info = curl_getinfo($ch);
// Ad keys to $rep
$rep = $info;
@@ -148,11 +219,11 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
$rep['content'] = $response;
$rep['curl_error_no'] = '';
$rep['curl_error_msg'] = '';
//closing the curl
curl_close($ch);
}
//closing the curl
curl_close($ch);
return $rep;
}

View File

@@ -32,10 +32,10 @@
*/
function loan_prepare_head($object)
{
global $db, $langs, $conf;
global $db, $langs, $conf;
$tab = 0;
$head = array();
$tab = 0;
$head = array();
$head[$tab][0] = DOL_URL_ROOT.'/loan/card.php?id='.$object->id;
$head[$tab][1] = $langs->trans('Card');
@@ -47,17 +47,17 @@ function loan_prepare_head($object)
$head[$tab][2] = 'FinancialCommitment';
$tab++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $tab, 'loan');
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $tab, 'loan');
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->loan->dir_output."/".dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks = Link::count($db, $object->element, $object->id);
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$tab][0] = DOL_URL_ROOT.'/loan/document.php?id='.$object->id;
$head[$tab][1] = $langs->trans("Documents");
if (($nbFiles + $nbLinks) > 0) $head[$tab][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
@@ -73,14 +73,14 @@ function loan_prepare_head($object)
$tab++;
}
$head[$tab][0] = DOL_URL_ROOT.'/loan/info.php?id='.$object->id;
$head[$tab][1] = $langs->trans("Info");
$head[$tab][2] = 'info';
$tab++;
$head[$tab][0] = DOL_URL_ROOT.'/loan/info.php?id='.$object->id;
$head[$tab][1] = $langs->trans("Info");
$head[$tab][2] = 'info';
$tab++;
complete_head_from_modules($conf, $langs, $object, $head, $tab, 'loan', 'remove');
complete_head_from_modules($conf, $langs, $object, $head, $tab, 'loan', 'remove');
return $head;
return $head;
}
/**
@@ -95,42 +95,42 @@ function loan_prepare_head($object)
*/
function loanCalcMonthlyPayment($mens, $capital, $rate, $echance, $nbterm)
{
global $conf, $db;
require_once DOL_DOCUMENT_ROOT.'/loan/class/loanschedule.class.php';
$object = new LoanSchedule($db);
$output = array();
global $conf, $db;
require_once DOL_DOCUMENT_ROOT.'/loan/class/loanschedule.class.php';
$object = new LoanSchedule($db);
$output = array();
// If mensuality is 0 we don't pay interests and remaining capital not modified
if ($mens == 0) {
$int = 0;
$cap_rest = $capital;
} else {
$int = ($capital * ($rate / 12));
$int = round($int, 2, PHP_ROUND_HALF_UP);
$cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP);
}
$output[$echance] = array('cap_rest'=>$cap_rest, 'cap_rest_str'=>price($cap_rest, 0, '', 1, -1, -1, $conf->currency), 'interet'=>$int, 'interet_str'=>price($int, 0, '', 1, -1, -1, $conf->currency), 'mens'=>$mens);
// If mensuality is 0 we don't pay interests and remaining capital not modified
if ($mens == 0) {
$int = 0;
$cap_rest = $capital;
} else {
$int = ($capital * ($rate / 12));
$int = round($int, 2, PHP_ROUND_HALF_UP);
$cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP);
}
$output[$echance] = array('cap_rest'=>$cap_rest, 'cap_rest_str'=>price($cap_rest, 0, '', 1, -1, -1, $conf->currency), 'interet'=>$int, 'interet_str'=>price($int, 0, '', 1, -1, -1, $conf->currency), 'mens'=>$mens);
$echance++;
$capital = $cap_rest;
while ($echance <= $nbterm) {
$mens = round($object->calcMonthlyPayments($capital, $rate, $nbterm - $echance + 1), 2, PHP_ROUND_HALF_UP);
$echance++;
$capital = $cap_rest;
while ($echance <= $nbterm) {
$mens = round($object->calcMonthlyPayments($capital, $rate, $nbterm - $echance + 1), 2, PHP_ROUND_HALF_UP);
$int = ($capital * ($rate / 12));
$int = round($int, 2, PHP_ROUND_HALF_UP);
$cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP);
$int = ($capital * ($rate / 12));
$int = round($int, 2, PHP_ROUND_HALF_UP);
$cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP);
$output[$echance] = array(
'cap_rest' => $cap_rest,
'cap_rest_str' => price($cap_rest, 0, '', 1, -1, -1, $conf->currency),
'interet' => $int,
'interet_str' => price($int, 0, '', 1, -1, -1, $conf->currency),
'mens' => $mens,
);
$output[$echance] = array(
'cap_rest' => $cap_rest,
'cap_rest_str' => price($cap_rest, 0, '', 1, -1, -1, $conf->currency),
'interet' => $int,
'interet_str' => price($int, 0, '', 1, -1, -1, $conf->currency),
'mens' => $mens,
);
$capital = $cap_rest;
$echance++;
}
$capital = $cap_rest;
$echance++;
}
return $output;
return $output;
}

View File

@@ -357,7 +357,7 @@ function show_stats_for_company($product, $socid)
print '<td class="right" width="25%">'.$langs->trans("TotalQuantity").'</td>';
print '</tr>';
// Customer proposals
// Customer proposals
if (!empty($conf->propal->enabled) && $user->rights->propale->lire)
{
$nblines++;
@@ -509,7 +509,6 @@ function show_stats_for_company($product, $socid)
print '</tr>';
}
// MO
if (!empty($conf->mrp->enabled) && $user->rights->mrp->read)
{

View File

@@ -115,7 +115,7 @@ function report_header($reportname, $notused, $period, $periodlink, $description
print '</table>'."\n";
dol_fiche_end();
print dol_get_fiche_end();
print '<div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></div>';

View File

@@ -38,8 +38,7 @@ function user_prepare_head($object)
$langs->load("users");
$canreadperms = true;
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS))
{
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
$canreadperms = ($user->admin || ($user->id != $object->id && $user->rights->user->user_advance->readperms) || ($user->id == $object->id && $user->rights->user->self_advance->readperms));
}
@@ -52,8 +51,7 @@ function user_prepare_head($object)
$h++;
if ((!empty($conf->ldap->enabled) && !empty($conf->global->LDAP_SYNCHRO_ACTIVE))
&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || !empty($user->admin)))
{
&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || !empty($user->admin))) {
$langs->load("ldap");
$head[$h][0] = DOL_URL_ROOT.'/user/ldap.php?id='.$object->id;
$head[$h][1] = $langs->trans("LDAPCard");
@@ -61,8 +59,7 @@ function user_prepare_head($object)
$h++;
}
if ($canreadperms)
{
if ($canreadperms) {
$head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id;
$head[$h][1] = $langs->trans("Rights").(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.($object->nb_rights).'</span>' : '');
$head[$h][2] = 'rights';
@@ -74,15 +71,13 @@ function user_prepare_head($object)
$head[$h][2] = 'guisetup';
$h++;
if (!empty($conf->agenda->enabled))
{
if (!empty($conf->agenda->enabled)) {
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB = 5;
$MAXAGENDA = $conf->global->AGENDA_EXT_NB;
$i = 1;
$nbagenda = 0;
while ($i <= $MAXAGENDA)
{
while ($i <= $MAXAGENDA) {
$key = $i;
$name = 'AGENDA_EXT_NAME_'.$object->id.'_'.$key;
$src = 'AGENDA_EXT_SRC_'.$object->id.'_'.$key;
@@ -99,8 +94,7 @@ function user_prepare_head($object)
$h++;
}
if (!empty($conf->clicktodial->enabled))
{
if (!empty($conf->clicktodial->enabled)) {
$head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id;
$head[$h][1] = $langs->trans("ClickToDial");
$head[$h][2] = 'clicktodial';
@@ -108,19 +102,16 @@ function user_prepare_head($object)
}
// Notifications
if ($user->socid == 0 && !empty($conf->notification->enabled))
{
if ($user->socid == 0 && !empty($conf->notification->enabled)) {
$nbNote = 0;
$sql = "SELECT COUNT(n.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."notify_def as n";
$sql .= " WHERE fk_user = ".$object->id;
$resql = $db->query($sql);
if ($resql)
{
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
while ($i < $num) {
$obj = $db->fetch_object($resql);
$nbNote = $obj->nb;
$i++;
@@ -147,8 +138,7 @@ function user_prepare_head($object)
|| (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read))
|| (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall))
|| (!empty($conf->holiday->enabled) && !empty($user->rights->holiday->read) && ($user->id == $object->id || $user->rights->holiday->read_all))
)
{
) {
// Bank
$head[$h][0] = DOL_URL_ROOT.'/user/bank.php?id='.$object->id;
$head[$h][1] = $langs->trans("HRAndBank");
@@ -157,8 +147,7 @@ function user_prepare_head($object)
}
// Such info on users is visible only by internal user
if (empty($user->socid))
{
if (empty($user->socid)) {
// Notes
$nbNote = 0;
if (!empty($object->note)) $nbNote++;
@@ -202,8 +191,7 @@ function group_prepare_head($object)
global $langs, $conf, $user;
$canreadperms = true;
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS))
{
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
$canreadperms = ($user->admin || $user->rights->user->group_advance->readperms);
}
@@ -216,8 +204,7 @@ function group_prepare_head($object)
$h++;
if ((!empty($conf->ldap->enabled) && !empty($conf->global->LDAP_SYNCHRO_ACTIVE))
&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || !empty($user->admin)))
{
&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || !empty($user->admin))) {
$langs->load("ldap");
$head[$h][0] = DOL_URL_ROOT.'/user/group/ldap.php?id='.$object->id;
$head[$h][1] = $langs->trans("LDAPCard");
@@ -225,8 +212,7 @@ function group_prepare_head($object)
$h++;
}
if ($canreadperms)
{
if ($canreadperms) {
$head[$h][0] = DOL_URL_ROOT.'/user/group/perms.php?id='.$object->id;
$head[$h][1] = $langs->trans("GroupRights").'<span class="badge marginleftonlyshort">'.($object->nb_rights).'</span>';
$head[$h][2] = 'rights';
@@ -305,10 +291,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
$formother = new FormOther($db);
$dirthemes = array('/theme');
if (!empty($conf->modules_parts['theme'])) // Using this feature slow down application
{
foreach ($conf->modules_parts['theme'] as $reldir)
{
if (!empty($conf->modules_parts['theme'])) { // Using this feature slow down application
foreach ($conf->modules_parts['theme'] as $reldir) {
$dirthemes = array_merge($dirthemes, (array) ($reldir.'theme'));
}
}
@@ -334,8 +318,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<table class="noborder centpercent'.($edit ? ' editmode' : '').' tableforfield">';
// Title
if ($foruserprofile)
{
if ($foruserprofile) {
print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("Parameter").'</th><th>'.$langs->trans("DefaultValue").'</th>';
print '<th colspan="2">&nbsp;</th>';
print '</tr>';
@@ -348,8 +331,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '</tr>';
} else {
$dirthemestring = '';
foreach ($dirthemes as $dirtheme)
{
foreach ($dirthemes as $dirtheme) {
$dirthemestring .= '"'.$dirtheme.'" ';
}
@@ -369,22 +351,17 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<table class="nobordernopadding" width="100%"><tr><td><div class="center">';
$i = 0;
foreach ($dirthemes as $dir)
{
foreach ($dirthemes as $dir) {
//print $dirroot.$dir;exit;
$dirtheme = dol_buildpath($dir, 0); // This include loop on $conf->file->dol_document_root
$urltheme = dol_buildpath($dir, 1);
if (is_dir($dirtheme))
{
if (is_dir($dirtheme)) {
$handle = opendir($dirtheme);
if (is_resource($handle))
{
while (($subdir = readdir($handle)) !== false)
{
if (is_resource($handle)) {
while (($subdir = readdir($handle)) !== false) {
if (is_dir($dirtheme."/".$subdir) && substr($subdir, 0, 1) <> '.'
&& substr($subdir, 0, 3) <> 'CVS' && !preg_match('/common|phones/i', $subdir))
{
&& substr($subdir, 0, 3) <> 'CVS' && !preg_match('/common|phones/i', $subdir)) {
// Disable not stable themes (dir ends with _exp or _dev)
if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i', $subdir)) continue;
if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i', $subdir)) continue;
@@ -398,8 +375,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
else $title = $langs->trans("ShowPreview");
print '<img class="img-skinthumb shadow" src="'.$url.'" alt="'.$title.'" title="'.$title.'" style="border: none; margin-bottom: 5px;">';
print '</a><br>';
if ($subdir == $selected_theme)
{
if ($subdir == $selected_theme) {
print '<input '.($edit ? '' : 'disabled').' type="radio" class="themethumbs" style="border: 0px;" checked name="main_theme" value="'.$subdir.'"> <b>'.$subdir.'</b>';
} else {
print '<input '.($edit ? '' : 'disabled').' type="radio" class="themethumbs" style="border: 0px;" name="main_theme" value="'.$subdir.'"> '.$subdir;
@@ -435,14 +411,12 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
}
// Show logo
if ($foruserprofile)
{
if ($foruserprofile) {
// Nothing
} else {
// Show logo
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("EnableShowLogo").'</td><td>';
if ($edit)
{
if ($edit) {
print ajax_constantonoff('MAIN_SHOW_LOGO', array(), null, 0, 0, 1);
//print $form->selectyesno('MAIN_SHOW_LOGO', $conf->global->MAIN_SHOW_LOGO, 1);
} else {
@@ -457,8 +431,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
// TopMenuDisableImages
if ($foruserprofile)
{
if ($foruserprofile) {
/*
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TopMenuDisableImages").'</td>';
@@ -469,7 +442,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>';
if ($edit)
{
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_TOPMENU_DISABLE_IMAGE,array()),''),'THEME_TOPMENU_DISABLE_IMAGE','formcolor',1).' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_TOPMENU_DISABLE_IMAGE,array()),''),'THEME_TOPMENU_DISABLE_IMAGE','',1).' ';
}
else
{
@@ -484,8 +457,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TopMenuDisableImages").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit)
{
if ($edit) {
print ajax_constantonoff('THEME_TOPMENU_DISABLE_IMAGE', array(), null, 0, 0, 1);
//print $form->selectyesno('THEME_TOPMENU_DISABLE_IMAGE', $conf->global->THEME_TOPMENU_DISABLE_IMAGE, 1);
} else {
@@ -498,8 +470,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
}
// Background color THEME_ELDY_BACKBODY
if ($foruserprofile)
{
if ($foruserprofile) {
/*
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
@@ -510,7 +481,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>';
if ($edit)
{
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','',1).' ';
}
else
{
@@ -525,9 +496,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("BackgroundColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
//var_dump($conf->global->THEME_ELDY_BACKBODY);
if ($edit)
{
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), ''), 'THEME_ELDY_BACKBODY', 'formcolor', 1, '', '', 'colorbackbody').' ';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), ''), 'THEME_ELDY_BACKBODY', '', 1, '', '', 'colorbackbody').' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), '');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
@@ -540,8 +510,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
}
// TopMenuBackgroundColor
if ($foruserprofile)
{
if ($foruserprofile) {
/*
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
@@ -552,7 +521,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>';
if ($edit)
{
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','',1).' ';
}
else
{
@@ -568,9 +537,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit)
{
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), ''), 'THEME_ELDY_TOPMENU_BACK1', 'formcolor', 1, '', '', 'colorbackhmenu1').' ';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), ''), 'THEME_ELDY_TOPMENU_BACK1', '', 1, '', '', 'colorbackhmenu1').' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), '');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
@@ -583,8 +551,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
}
// LeftMenuBackgroundColor
if ($foruserprofile)
{
if ($foruserprofile) {
/*
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
@@ -595,7 +562,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>';
if ($edit)
{
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''),'THEME_ELDY_VERMENU_BACK1','formcolor',1).' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1,array()),''),'THEME_ELDY_VERMENU_BACK1','',1).' ';
}
else
{
@@ -611,9 +578,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<tr class="oddeven">';
print '<td>'.$langs->trans("LeftMenuBackgroundColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit)
{
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), ''), 'THEME_ELDY_VERMENU_BACK1', 'formcolor', 1, '', '', 'colorbackvmenu1').' ';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), ''), 'THEME_ELDY_VERMENU_BACK1', '', 1, '', '', 'colorbackvmenu1').' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), '');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
@@ -626,17 +592,15 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
}
// TextTitleColor for title of Pages
if ($foruserprofile)
{
if ($foruserprofile) {
} else {
$default = (empty($colortexttitlenotab) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitlenotab)));
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TextTitleColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit)
{
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB, array()), ''), 'THEME_ELDY_TEXTTITLENOTAB', 'formcolor', 1, '', '', 'colortexttitlenotab').' ';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB, array()), ''), 'THEME_ELDY_TEXTTITLENOTAB', '', 1, '', '', 'colortexttitlenotab').' ';
} else {
print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default"));
}
@@ -648,17 +612,15 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
}
// BackgroundTableTitleColor
if ($foruserprofile)
{
if ($foruserprofile) {
} else {
$default = (empty($colorbacktitle1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacktitle1)));
print '<tr class="oddeven">';
print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit)
{
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1, array()), ''), 'THEME_ELDY_BACKTITLE1', 'formcolor', 1, '', '', 'colorbacktitle1').' ';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1, array()), ''), 'THEME_ELDY_BACKTITLE1', '', 1, '', '', 'colorbacktitle1').' ';
} else {
print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default"));
}
@@ -670,17 +632,15 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
}
// TextTitleColor
if ($foruserprofile)
{
if ($foruserprofile) {
} else {
$default = (empty($colortexttitle) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitle)));
print '<tr class="oddeven">';
print '<td>'.$langs->trans("BackgroundTableTitleTextColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit)
{
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLE, array()), ''), 'THEME_ELDY_TEXTTITLE', 'formcolor', 1, '', '', 'colortexttitle').' ';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLE, array()), ''), 'THEME_ELDY_TEXTTITLE', '', 1, '', '', 'colortexttitle').' ';
} else {
print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default"));
}
@@ -692,17 +652,15 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
}
// TextTitleLinkColor
if ($foruserprofile)
{
if ($foruserprofile) {
} else {
$default=(empty($colortexttitlelink) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitlelink)));
print '<tr class="oddeven">';
print '<td>'.$langs->trans("BackgroundTableTitleTextlinkColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit)
{
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLELINK, array()), ''), 'THEME_ELDY_TEXTTITLELINK', 'formcolor', 1, '', '', 'colortexttitlelink').' ';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLELINK, array()), ''), 'THEME_ELDY_TEXTTITLELINK', '', 1, '', '', 'colortexttitlelink').' ';
} else {
print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLELINK, $langs->trans("Default"));
}
@@ -715,17 +673,15 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
}
// BackgroundTableLineOddColor
if ($foruserprofile)
{
if ($foruserprofile) {
} else {
$default = (empty($colorbacklineimpair1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklineimpair1)));
print '<tr class="oddeven">';
print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit)
{
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), ''), 'THEME_ELDY_LINEIMPAIR1', 'formcolor', 1, '', '', 'colorbacklinepair2').' ';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), ''), 'THEME_ELDY_LINEIMPAIR1', '', 1, '', '', 'colorbacklinepair2').' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), '');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
@@ -738,17 +694,15 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
}
// BackgroundTableLineEvenColor
if ($foruserprofile)
{
if ($foruserprofile) {
} else {
$default = (empty($colorbacklinepair1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepair1)));
print '<tr class="oddeven">';
print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit)
{
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), ''), 'THEME_ELDY_LINEPAIR1', 'formcolor', 1, '', '', 'colorbacklineimpair2').' ';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), ''), 'THEME_ELDY_LINEPAIR1', '', 1, '', '', 'colorbacklineimpair2').' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), '');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
@@ -761,8 +715,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
}
// Text LinkColor
if ($foruserprofile)
{
if ($foruserprofile) {
/*
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
@@ -773,7 +726,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>';
if ($edit)
{
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','formcolor',1).' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','',1).' ';
}
else
{
@@ -789,9 +742,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<tr class="oddeven">';
print '<td>'.$langs->trans("LinkColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit)
{
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), ''), 'THEME_ELDY_TEXTLINK', 'formcolor', 1, '', '', 'colortextlink').' ';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), ''), 'THEME_ELDY_TEXTLINK', '', 1, '', '', 'colortextlink').' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), '');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
@@ -808,8 +760,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
}
// Use Hover
if ($foruserprofile)
{
if ($foruserprofile) {
/* Must first change option to choose color of highlight instead of yes or no.
print '<tr class="oddeven">';
print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
@@ -828,16 +779,14 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td colspan="'.($colspan - 1).'">';
//print '<input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
//print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
if ($edit)
{
if ($edit) {
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover));
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), '');
print $formother->selectColor($color, 'THEME_ELDY_USE_HOVER', 'formcolor', 1, '', '', 'colorbacklinepairhover').' ';
print $formother->selectColor($color, 'THEME_ELDY_USE_HOVER', '', 1, '', '', 'colorbacklinepairhover').' ';
} else {
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover));
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), '');
if ($color)
{
if ($color) {
if ($color != colorArrayToHex(colorStringToArray($colorbacklinepairhover))) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
else print $langs->trans("Default");
} else print $langs->trans("Default");
@@ -848,8 +797,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
}
// Use Checked
if ($foruserprofile)
{
if ($foruserprofile) {
/* Must first change option to choose color of highlight instead of yes or no.
print '<tr class="oddeven">';
print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
@@ -868,16 +816,14 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td colspan="'.($colspan - 1).'">';
//print '<input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
//print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
if ($edit)
{
if ($edit) {
if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color = 'e6edf0';
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED, array()), '');
print $formother->selectColor($color, 'THEME_ELDY_USE_CHECKED', 'formcolor', 1, '', '', 'colorbacklinepairchecked').' ';
print $formother->selectColor($color, 'THEME_ELDY_USE_CHECKED', '', 1, '', '', 'colorbacklinepairchecked').' ';
} else {
if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color = 'e6edf0';
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED, array()), '');
if ($color)
{
if ($color) {
if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
else print $langs->trans("Default");
} else print $langs->trans("Default");
@@ -889,20 +835,17 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
}
// Use MAIN_OPTIMIZEFORTEXTBROWSER
if ($foruserprofile)
{
if ($foruserprofile) {
//$default=yn($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER);
$default = $langs->trans('No');
print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_OPTIMIZEFORTEXTBROWSER").'</td>';
print '<td colspan="'.($colspan - 1).'">';
//print ajax_constantonoff("MAIN_OPTIMIZEFORTEXTBROWSER", array(), null, 0, 0, 1, 0);
if ($edit)
{
if ($edit) {
print $form->selectyesno('MAIN_OPTIMIZEFORTEXTBROWSER', $fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER, 1);
} else {
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
print yn($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER);
} else {
print yn(1);
@@ -937,8 +880,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
// Use MAIN_OPTIMIZEFORTEXTBROWSER
if ($foruserprofile)
{
if ($foruserprofile) {
//$default=yn($conf->global->MAIN_OPTIMIZEFORCOLORBLIND);
$default = $langs->trans('No');
print '<tr class="oddeven">';
@@ -953,8 +895,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
'tritanopes' => $langs->trans('Tritanopes'),
);
if ($edit)
{
if ($edit) {
print $form->selectArray('MAIN_OPTIMIZEFORCOLORBLIND', $colorBlindOptions, $fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND, 0);
} else {
if (!empty($fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND) && isset($colorBlindOptions[$fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND])) {