Skip to content

Commit

Permalink
Remove TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Sep 2, 2018
1 parent 0bf850c commit 887a40c
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 72 deletions.
2 changes: 1 addition & 1 deletion htdocs/admin/system/index.php
Expand Up @@ -105,7 +105,7 @@
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\"><td colspan=\"2\">".$langs->trans("Browser")."</td></tr>\n";
print "<tr $bc[0]><td width=\"280\">".$langs->trans("UserAgent")."</td><td>" .$_SERVER["HTTP_USER_AGENT"]."</td></tr>\n";
print "<tr $bc[1]><td width=\"280\">".$langs->trans("Smartphone")."</td><td>".(empty($conf->browser->phone)?$langs->trans("No"):$conf->browser->phone)."</td></tr>\n";
print "<tr $bc[1]><td width=\"280\">".$langs->trans("Smartphone")."</td><td>".(($conf->browser->layout != 'phone')?$langs->trans("No"):$langs->trans("Yes"))."</td></tr>\n";
print '</table>';
print '<br>';

Expand Down
5 changes: 2 additions & 3 deletions htdocs/core/class/html.form.class.php
Expand Up @@ -51,12 +51,12 @@ class Form
* @var DoliDB Database handler.
*/
public $db;

/**
* @var string Error code (or message)
*/
public $error='';

var $num;

// Cache arrays
Expand Down Expand Up @@ -4957,7 +4957,6 @@ function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_nam
if (! empty($conf->use_javascript_ajax) && (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR != "none")) {
$usecalendar = ((empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR == 'eldy')?'jquery':$conf->global->MAIN_POPUP_CALENDAR);
}
//if (! empty($conf->browser->phone)) $usecalendar='combo';

if ($d)
{
Expand Down
8 changes: 4 additions & 4 deletions htdocs/core/class/html.formfile.class.php
Expand Up @@ -40,7 +40,7 @@ class FormFile
* @var string Error code (or message)
*/
public $error;

public $numoffiles;
public $infofiles; // Used to return informations by function getDocumentsLink

Expand Down Expand Up @@ -678,7 +678,7 @@ function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed
$formadmin=new FormAdmin($this->db);
$defaultlang=$codelang?$codelang:$langs->getDefaultLang();
$morecss='maxwidth150';
if (! empty($conf->browser->phone)) $morecss='maxwidth100';
if ($conf->browser->layout == 'phone') $morecss='maxwidth100';
$out.= $formadmin->select_language($defaultlang, 'lang_id', 0, 0, 0, 0, 0, $morecss);
}
else
Expand Down Expand Up @@ -1318,7 +1318,7 @@ function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownlo

if (empty($disablemove))
{
if ($nboffiles > 1 && empty($conf->browser->phone)) {
if ($nboffiles > 1 && $conf->browser->layout != 'phone') {
print '<td align="center" class="linecolmove tdlineupdown">';
if ($i > 0) {
print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=up&amp;rowid='.$line->id.'">'.img_up('default',0,'imgupforline').'</a>';
Expand All @@ -1329,7 +1329,7 @@ function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownlo
print '</td>';
}
else {
print '<td align="center"'.((empty($conf->browser->phone) && empty($disablemove)) ?' class="linecolmove tdlineupdown"':' class="linecolmove"').'>';
print '<td align="center"'.($conf->browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown"':' class="linecolmove"').'>';
print '</td>';
}
}
Expand Down
8 changes: 4 additions & 4 deletions htdocs/core/class/html.formother.class.php
Expand Up @@ -38,7 +38,7 @@
class FormOther
{
private $db;

/**
* @var string Error code (or message)
*/
Expand Down Expand Up @@ -1029,7 +1029,7 @@ static function getBoxesArea($user,$areacode)
if (! empty($boxidactivatedforuser[$box->id])) continue; // Already visible for user
$label=$langs->transnoentitiesnoconv($box->boxlabel);
//if (preg_match('/graph/',$box->class)) $label.=' ('.$langs->trans("Graph").')';
if (preg_match('/graph/',$box->class) && empty($conf->browser->phone))
if (preg_match('/graph/',$box->class) && $conf->browser->layout != 'phone')
{
$label=$label.' <span class="fa fa-bar-chart"></span>';
}
Expand Down Expand Up @@ -1163,7 +1163,7 @@ function updateBoxOrder(closing) {
}
}

if (empty($conf->browser->phone))
if ($conf->browser->layout != 'phone')
{
$emptybox->box_id='A';
$emptybox->info_box_head=array();
Expand All @@ -1190,7 +1190,7 @@ function updateBoxOrder(closing) {
}
}

if (empty($conf->browser->phone))
if ($conf->browser->layout != 'phone')
{
$emptybox->box_id='B';
$emptybox->info_box_head=array();
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/get_info.php
Expand Up @@ -134,7 +134,7 @@

// Link to print main content area
/*
if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && empty($conf->browser->phone))
if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $conf->browser->layout != 'phone')
{
$qs=dol_escape_htmltag($_SERVER["QUERY_STRING"]);
Expand Down
8 changes: 4 additions & 4 deletions htdocs/core/lib/agenda.lib.php
Expand Up @@ -68,7 +68,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh

print '<div class="fichecenter">';

if (! empty($conf->browser->phone)) print '<div class="fichehalfleft">';
if ($conf->browser->layout == 'phone') print '<div class="fichehalfleft">';
else print '<table class="nobordernopadding" width="100%"><tr><td class="borderright">';

print '<table class="nobordernopadding centpercent">';
Expand Down Expand Up @@ -180,10 +180,10 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh

print '</table>';

if (! empty($conf->browser->phone)) print '</div>';
if ($conf->browser->layout == 'phone') print '</div>';
else print '</td>';

if (! empty($conf->browser->phone)) print '<div class="fichehalfright">';
if ($conf->browser->layout == 'phone') print '<div class="fichehalfright">';
else print '<td align="center" valign="middle" class="nowrap">';

print '<table class="centpercent"><tr><td align="center">';
Expand All @@ -193,7 +193,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '</td></tr>';
print '</table>';

if (! empty($conf->browser->phone)) print '</div>';
if ($conf->browser->layout == 'phone') print '</div>';
else print '</td></tr></table>';

print '</div>'; // Close fichecenter
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/ajax.lib.php
Expand Up @@ -377,7 +377,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $

// select2 disabled for smartphones with standard browser.
// TODO With select2 v4, it seems ok, except that responsive style on table become crazy when scrolling at end of array)
if (! empty($conf->browser->phone)) return '';
if ($conf->browser->layout == 'phone') return '';

if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return '';
if (empty($conf->use_javascript_ajax)) return '';
Expand Down
6 changes: 3 additions & 3 deletions htdocs/core/lib/functions.lib.php
Expand Up @@ -1353,7 +1353,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
$width=80; $cssclass='photoref';
$showimage=$object->is_photo_available($conf->product->multidir_output[$entity]);
$maxvisiblephotos=(isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO)?$conf->global->PRODUCT_MAX_VISIBLE_PHOTO:5);
if ($conf->browser->phone) $maxvisiblephotos=1;
if ($conf->browser->layout == 'phone') $maxvisiblephotos=1;
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('product', $conf->product->multidir_output[$entity],'small',$maxvisiblephotos,0,0,0,$width,0).'</div>';
else
{
Expand All @@ -1372,7 +1372,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
$width=80; $cssclass='photoref';
$showimage=$object->is_photo_available($conf->ticket->multidir_output[$entity].'/'.$object->track_id);
$maxvisiblephotos=(isset($conf->global->TICKETSUP_MAX_VISIBLE_PHOTO)?$conf->global->TICKETSUP_MAX_VISIBLE_PHOTO:2);
if ($conf->browser->phone) $maxvisiblephotos=1;
if ($conf->browser->layout == 'phone') $maxvisiblephotos=1;
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('ticket', $conf->ticket->multidir_output[$entity],'small',$maxvisiblephotos,0,0,0,$width,0).'</div>';
else
{
Expand Down Expand Up @@ -2549,7 +2549,7 @@ function dol_print_phone($phone,$countrycode='',$cid=0,$socid=0,$addlink='',$sep
}
if (! empty($addlink)) // Link on phone number (+ link to add action if conf->global->AGENDA_ADDACTIONFORPHONE set)
{
if (! empty($conf->browser->phone) || (! empty($conf->clicktodial->enabled) && ! empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) // If phone or option for, we use link of phone
if ($conf->browser->layout == 'phone' || (! empty($conf->clicktodial->enabled) && ! empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) // If phone or option for, we use link of phone
{
$newphone ='<a href="tel:'.$phone.'"';
$newphone.='>'.$phone.'</a>';
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/tpl/objectline_view.tpl.php
Expand Up @@ -292,7 +292,7 @@
</td>

<?php
if ($num > 1 && empty($conf->browser->phone) && ($this->situation_counter == 1 || !$this->situation_cycle_ref) && empty($disablemove)) { ?>
if ($num > 1 && $conf->browser->layout != 'phone' && ($this->situation_counter == 1 || !$this->situation_cycle_ref) && empty($disablemove)) { ?>
<td align="center" class="linecolmove tdlineupdown"><?php $coldisplay++; ?>
<?php if ($i > 0) { ?>
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=up&amp;rowid='.$line->id; ?>">
Expand All @@ -306,7 +306,7 @@
<?php } ?>
</td>
<?php } else { ?>
<td align="center"<?php echo ((empty($conf->browser->phone) && empty($disablemove)) ?' class="linecolmove tdlineupdown"':' class="linecolmove"'); ?>><?php $coldisplay++; ?></td>
<td align="center"<?php echo (($conf->browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown"':' class="linecolmove"'); ?>><?php $coldisplay++; ?></td>
<?php } ?>
<?php } else { ?>
<td colspan="3"><?php $coldisplay=$coldisplay+3; ?></td>
Expand Down
48 changes: 1 addition & 47 deletions htdocs/main.inc.php
Expand Up @@ -256,8 +256,6 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type)
$conf->browser->os=$tmp['browseros'];
$conf->browser->version=$tmp['browserversion'];
$conf->browser->layout=$tmp['layout']; // 'classic', 'phone', 'tablet'
$conf->browser->phone=$tmp['phone']; // TODO deprecated, use ->layout
$conf->browser->tablet=$tmp['tablet']; // TODO deprecated, use ->layout
//var_dump($conf->browser);

if ($conf->browser->layout == 'phone') $conf->dol_no_mouse_hover=1;
Expand Down Expand Up @@ -486,17 +484,6 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type)
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadValueForCode");
$test=false;

// TODO @deprecated Remove this. Hook must be used, not this trigger.
$user->trigger_mesg='ErrorBadValueForCode - login='.GETPOST("username","alpha",2);
// Call of triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);
$result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf);
if ($result < 0) {
$error++;
}
// End Call of triggers

// Hooks on failed login
$action='';
$hookmanager->initHooks(array('login'));
Expand Down Expand Up @@ -565,17 +552,6 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type)
// We set a generic message if not defined inside function checkLoginPassEntity or subfunctions
if (empty($_SESSION["dol_loginmesg"])) $_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword");

// TODO @deprecated Remove this. Hook must be used, not this trigger.
$user->trigger_mesg=$langs->trans("ErrorBadLoginPassword").' - login='.GETPOST("username","alpha",2);
// Call of triggers
include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
$interface=new Interfaces($db);
$result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf,GETPOST("username","alpha",2));
if ($result < 0) {
$error++;
}
// End Call of triggers

// Hooks on failed login
$action='';
$hookmanager->initHooks(array('login'));
Expand Down Expand Up @@ -612,27 +588,12 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type)
$langs->loadLangs(array('main', 'errors'));

$_SESSION["dol_loginmesg"]=$langs->trans("ErrorCantLoadUserFromDolibarrDatabase",$login);

// TODO @deprecated Remove this. Hook must be used, not this trigger.
$user->trigger_mesg='ErrorCantLoadUserFromDolibarrDatabase - login='.$login;
}
if ($resultFetchUser < 0)
{
$_SESSION["dol_loginmesg"]=$user->error;

// TODO @deprecated Remove this. Hook must be used, not this trigger.
$user->trigger_mesg=$user->error;
}

// Call triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);
$result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf);
if ($result < 0) {
$error++;
}
// End call triggers

// Hooks on failed login
$action='';
$hookmanager->initHooks(array('login'));
Expand Down Expand Up @@ -671,16 +632,10 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type)
$langs->loadLangs(array('main', 'errors'));

$_SESSION["dol_loginmesg"]=$langs->trans("ErrorCantLoadUserFromDolibarrDatabase",$login);

// TODO @deprecated Remove this. Hook must be used, not this trigger.
$user->trigger_mesg='ErrorCantLoadUserFromDolibarrDatabase - login='.$login;
}
if ($resultFetchUser < 0)
{
$_SESSION["dol_loginmesg"]=$user->error;

// TODO @deprecated Remove this. Hook must be used, not this trigger.
$user->trigger_mesg=$user->error;
}

// TODO @deprecated Remove this. Hook must be used, not this trigger.
Expand Down Expand Up @@ -900,7 +855,6 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type)
$conf->theme='eldy';
$conf->css = "/theme/".$conf->theme."/style.css.php";
}
//var_dump($conf->browser->phone);

if (! defined('NOREQUIRETRAN'))
{
Expand Down Expand Up @@ -1574,7 +1528,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
}

// Link to print main content area
if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && empty($conf->browser->phone))
if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $conf->browser->layout != 'phone')
{
$qs=dol_escape_htmltag($_SERVER["QUERY_STRING"]);

Expand Down
2 changes: 1 addition & 1 deletion htdocs/societe/paymentmodes.php
Expand Up @@ -1184,7 +1184,7 @@
$formadmin=new FormAdmin($db);
$defaultlang=$codelang?$codelang:$langs->getDefaultLang();
$morecss='maxwidth150';
if (! empty($conf->browser->phone)) $morecss='maxwidth100';
if ($conf->browser->layout == 'phone') $morecss='maxwidth100';
$out.= $formadmin->select_language($defaultlang, 'lang_idrib'.$rib->id, 0, 0, 0, 0, 0, $morecss);
}
// Button
Expand Down
2 changes: 1 addition & 1 deletion htdocs/user/class/user.class.php
Expand Up @@ -2232,7 +2232,7 @@ function getNomUrl($withpictoimg=0, $option='', $infologin=0, $notooltip=0, $max
$label.= '<br><b>'.$langs->trans("Browser").':</b> '.$conf->browser->name.($conf->browser->version?' '.$conf->browser->version:'').' ('.$_SERVER['HTTP_USER_AGENT'].')';
$label.= '<br><b>'.$langs->trans("Layout").':</b> '.$conf->browser->layout;
$label.= '<br><b>'.$langs->trans("Screen").':</b> '.$_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight'];
if (! empty($conf->browser->phone)) $label.= '<br><b>'.$langs->trans("Phone").':</b> '.$conf->browser->phone;
if ($conf->browser->layout == 'phone') $label.= '<br><b>'.$langs->trans("Phone").':</b> '.$langs->trans("Yes");;
if (! empty($_SESSION["disablemodules"])) $label.= '<br><b>'.$langs->trans("DisabledModules").':</b> <br>'.join(', ',explode(',',$_SESSION["disablemodules"]));
}
if ($infologin < 0) $label='';
Expand Down

0 comments on commit 887a40c

Please sign in to comment.