diff --git a/htdocs/api/admin/index.php b/htdocs/api/admin/index.php
index 1d15d5b9e75..3743d61b639 100644
--- a/htdocs/api/admin/index.php
+++ b/htdocs/api/admin/index.php
@@ -32,50 +32,44 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
// Load translation files required by the page
$langs->load("admin");
-if (!$user->admin)
+if (!$user->admin) {
accessforbidden();
+}
$action = GETPOST('action', 'aZ09');
//Activate ProfId
-if ($action == 'setproductionmode')
-{
+if ($action == 'setproductionmode') {
$status = GETPOST('status', 'alpha');
- if (dolibarr_set_const($db, 'API_PRODUCTION_MODE', $status, 'chaine', 0, '', 0) > 0)
- {
+ if (dolibarr_set_const($db, 'API_PRODUCTION_MODE', $status, 'chaine', 0, '', 0) > 0) {
$error = 0;
- if ($status == 1)
- {
+ if ($status == 1) {
$result = dol_mkdir($conf->api->dir_temp);
- if ($result < 0)
- {
+ if ($result < 0) {
setEventMessages($langs->trans("ErrorFailedToCreateDir", $conf->api->dir_temp), null, 'errors');
$error++;
}
} else {
// Delete the cache file otherwise it does not update
$result = dol_delete_file($conf->api->dir_temp.'/routes.php');
- if ($result < 0)
- {
+ if ($result < 0) {
setEventMessages($langs->trans("ErrorFailedToDeleteFile", $conf->api->dir_temp.'/routes.php'), null, 'errors');
$error++;
}
}
- if (!$error)
- {
+ if (!$error) {
header("Location: ".$_SERVER["PHP_SELF"]);
- exit;
+ exit;
}
} else {
dol_print_error($db);
}
}
-if ($action == 'save')
-{
+if ($action == 'save') {
dolibarr_set_const($db, 'API_RESTRICT_ON_IP', GETPOST('API_RESTRICT_ON_IP', 'alpha'));
}
@@ -110,8 +104,7 @@ print "";
print '
';
print '| '.$langs->trans("ApiProductionMode").' | ';
$production_mode = (empty($conf->global->API_PRODUCTION_MODE) ?false:true);
-if ($production_mode)
-{
+if ($production_mode) {
print '';
print img_picto($langs->trans("Activated"), 'switch_on');
print ' | ';
@@ -155,8 +148,7 @@ print '
';
// Explorer
print ''.$langs->trans("ApiExporerIs").':
';
-if (dol_is_dir(DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/explorer'))
-{
+if (dol_is_dir(DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/explorer')) {
$url = DOL_MAIN_URL_ROOT.'/api/index.php/explorer';
print img_picto('', 'globe').' '.$url."
\n";
} else {
diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php
index ddb043292f6..3c3e03ecb37 100644
--- a/htdocs/bookmarks/card.php
+++ b/htdocs/bookmarks/card.php
@@ -52,8 +52,7 @@ $object = new Bookmark($db);
* Actions
*/
-if ($action == 'add' || $action == 'addproduct' || $action == 'update')
-{
+if ($action == 'add' || $action == 'addproduct' || $action == 'update') {
if ($action == 'update') {
$invertedaction = 'edit';
} else {
@@ -62,14 +61,17 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
$error = 0;
- if (GETPOST('cancel', 'alpha'))
- {
- if (empty($backtopage)) $backtopage = ($urlsource ? $urlsource : ((!empty($url) && !preg_match('/^http/i', $url)) ? $url : DOL_URL_ROOT.'/bookmarks/list.php'));
+ if (GETPOST('cancel', 'alpha')) {
+ if (empty($backtopage)) {
+ $backtopage = ($urlsource ? $urlsource : ((!empty($url) && !preg_match('/^http/i', $url)) ? $url : DOL_URL_ROOT.'/bookmarks/list.php'));
+ }
header("Location: ".$backtopage);
exit;
}
- if ($action == 'update') $object->fetch(GETPOST("id", 'int'));
+ if ($action == 'update') {
+ $object->fetch(GETPOST("id", 'int'));
+ }
// Check if null because user not admin can't set an user and send empty value here.
if (!empty($userid)) {
$object->fk_user = $userid;
@@ -89,21 +91,23 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("UrlOrLink")), null, 'errors');
}
- if (!$error)
- {
+ if (!$error) {
$object->favicon = 'none';
- if ($action == 'update') $res = $object->update();
- else $res = $object->create();
+ if ($action == 'update') {
+ $res = $object->update();
+ } else {
+ $res = $object->create();
+ }
- if ($res > 0)
- {
- if (empty($backtopage)) $backtopage = ($urlsource ? $urlsource : ((!empty($url) && !preg_match('/^http/i', $url)) ? $url : DOL_URL_ROOT.'/bookmarks/list.php'));
+ if ($res > 0) {
+ if (empty($backtopage)) {
+ $backtopage = ($urlsource ? $urlsource : ((!empty($url) && !preg_match('/^http/i', $url)) ? $url : DOL_URL_ROOT.'/bookmarks/list.php'));
+ }
header("Location: ".$backtopage);
exit;
} else {
- if ($object->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS')
- {
+ if ($object->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$langs->load("errors");
setEventMessages($langs->transnoentities("WarningBookmarkAlreadyExists"), null, 'warnings');
} else {
@@ -137,8 +141,7 @@ $h++;
$hselected = 'card';
-if ($action == 'create')
-{
+if ($action == 'create') {
/*
* Fact bookmark creation mode
*/
@@ -189,8 +192,7 @@ if ($action == 'create')
}
-if ($id > 0 && !preg_match('/^add/i', $action))
-{
+if ($id > 0 && !preg_match('/^add/i', $action)) {
/*
* Fact bookmark mode or visually edition
*/
@@ -205,8 +207,7 @@ if ($id > 0 && !preg_match('/^add/i', $action))
)
);
- if ($action == 'edit')
- {
+ if ($action == 'edit') {
print '
';
print '| ';
@@ -252,28 +256,32 @@ if ($id > 0 && !preg_match('/^add/i', $action))
print '';
}
print ' | ';
- if ($action == 'edit') print 'url).'">';
- else print 'target ? ' target="_blank"' : '').'>'.$object->url.'';
+ if ($action == 'edit') {
+ print 'url).'">';
+ } else {
+ print 'target ? ' target="_blank"' : '').'>'.$object->url.'';
+ }
print ' |
';
print '| '.$langs->trans("BehaviourOnClick").' | ';
- if ($action == 'edit')
- {
+ if ($action == 'edit') {
$liste = array(1=>$langs->trans("OpenANewWindow"), 0=>$langs->trans("ReplaceWindow"));
print $form->selectarray('target', $liste, GETPOSTISSET("target") ? GETPOST("target") : $object->target);
} else {
- if ($object->target == 0) print $langs->trans("ReplaceWindow");
- if ($object->target == 1) print $langs->trans("OpenANewWindow");
+ if ($object->target == 0) {
+ print $langs->trans("ReplaceWindow");
+ }
+ if ($object->target == 1) {
+ print $langs->trans("OpenANewWindow");
+ }
}
print ' |
';
print '| '.$langs->trans("Owner").' | ';
- if ($action == 'edit' && $user->admin)
- {
+ if ($action == 'edit' && $user->admin) {
print img_picto('', 'user').' '.$form->select_dolusers(GETPOSTISSET('userid') ? GETPOST('userid', 'int') : ($object->fk_user ? $object->fk_user : ''), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
} else {
- if ($object->fk_user > 0)
- {
+ if ($object->fk_user > 0) {
$fuser = new User($db);
$fuser->fetch($object->fk_user);
print $fuser->getNomUrl(1);
@@ -285,8 +293,11 @@ if ($id > 0 && !preg_match('/^add/i', $action))
// Position
print ' |
| '.$langs->trans("Position").' | ';
- if ($action == 'edit') print 'position).'">';
- else print $object->position;
+ if ($action == 'edit') {
+ print 'position).'">';
+ } else {
+ print $object->position;
+ }
print ' |
';
// Date creation
@@ -298,8 +309,7 @@ if ($id > 0 && !preg_match('/^add/i', $action))
print dol_get_fiche_end();
- if ($action == 'edit')
- {
+ if ($action == 'edit') {
print '
';
print '';
}
@@ -310,14 +320,12 @@ if ($id > 0 && !preg_match('/^add/i', $action))
print "\n";
// Edit
- if ($user->rights->bookmark->creer && $action != 'edit')
- {
+ if ($user->rights->bookmark->creer && $action != 'edit') {
print '
id.'&action=edit&token='.newToken().'">'.$langs->trans("Edit").''."\n";
}
// Remove
- if ($user->rights->bookmark->supprimer && $action != 'edit')
- {
+ if ($user->rights->bookmark->supprimer && $action != 'edit') {
print '
'.$langs->trans("Delete").''."\n";
}
diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php
index 6ad2770aa25..e4405f0aea6 100644
--- a/htdocs/bookmarks/list.php
+++ b/htdocs/bookmarks/list.php
@@ -45,12 +45,18 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
-if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
+if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
+ $page = 0;
+} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if (!$sortfield) $sortfield = 'position';
-if (!$sortorder) $sortorder = 'ASC';
+if (!$sortfield) {
+ $sortfield = 'position';
+}
+if (!$sortorder) {
+ $sortorder = 'ASC';
+}
$id = GETPOST("id", 'int');
@@ -65,11 +71,9 @@ $permissiontodelete = $user->rights->bookmark->delete;
* Actions
*/
-if ($action == 'delete')
-{
+if ($action == 'delete') {
$res = $object->remove($id);
- if ($res > 0)
- {
+ if ($res > 0) {
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
} else {
@@ -93,32 +97,30 @@ $sql .= " u.login, u.lastname, u.firstname";
$sql .= " FROM ".MAIN_DB_PREFIX."bookmark as b LEFT JOIN ".MAIN_DB_PREFIX."user as u ON b.fk_user=u.rowid";
$sql .= " WHERE 1=1";
$sql .= " AND b.entity IN (".getEntity('bookmark').")";
-if (!$user->admin) $sql .= " AND (b.fk_user = ".$user->id." OR b.fk_user is NULL OR b.fk_user = 0)";
+if (!$user->admin) {
+ $sql .= " AND (b.fk_user = ".$user->id." OR b.fk_user is NULL OR b.fk_user = 0)";
+}
$sql .= $db->order($sortfield.", position", $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
-if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
-{
+if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
- if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
- {
+ if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
$page = 0;
$offset = 0;
}
}
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
-if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
-{
+if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) {
$num = $nbtotalofrecords;
} else {
$sql .= $db->plimit($limit + 1, $offset);
$resql = $db->query($sql);
- if (!$resql)
- {
+ if (!$resql) {
dol_print_error($db);
exit;
}
@@ -127,9 +129,15 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
}
$param = "";
-if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
-if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
-if ($optioncss != '') $param = '&optioncss='.urlencode($optioncss);
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
+ $param .= '&contextpage='.urlencode($contextpage);
+}
+if ($limit > 0 && $limit != $conf->liste_limit) {
+ $param .= '&limit='.urlencode($limit);
+}
+if ($optioncss != '') {
+ $param = '&optioncss='.urlencode($optioncss);
+}
$moreforfilter = '';
@@ -140,12 +148,18 @@ $arrayofmassactions = array(
//'builddoc'=>$langs->trans("PDFMerge"),
//'presend'=>$langs->trans("SendByMail"),
);
-if ($permissiontodelete) $arrayofmassactions['predelete'] = '
'.$langs->trans("Delete");
-if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
+if ($permissiontodelete) {
+ $arrayofmassactions['predelete'] = '
'.$langs->trans("Delete");
+}
+if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
+ $arrayofmassactions = array();
+}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
print '