Skip to content

Commit

Permalink
Clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Dec 10, 2024
1 parent 6113595 commit 482d18c
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 35 deletions.
5 changes: 3 additions & 2 deletions htdocs/google/admin/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
dol_include_once("/google/lib/google.lib.php");


if (!$user->admin) accessforbidden();
if (!$user->admin) {
accessforbidden();
}


$langs->load("admin");
Expand All @@ -59,7 +61,6 @@

$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("GoogleSetup"), $linkback, 'setup');
print '<br>';

$head=googleadmin_prepare_head();

Expand Down
2 changes: 1 addition & 1 deletion htdocs/google/admin/google_ad.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
/*
* Actions
*/

if ($actionsave) {
$db->begin();

Expand Down Expand Up @@ -77,7 +78,6 @@

$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("GoogleSetup"), $linkback, 'setup');
print '<br>';


print '<form name="googleconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">';
Expand Down
1 change: 0 additions & 1 deletion htdocs/google/admin/google_an.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@

$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("GoogleSetup"), $linkback, 'setup');
print '<br>';


print '<form name="googleconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">';
Expand Down
12 changes: 7 additions & 5 deletions htdocs/google/admin/google_calsync.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,13 @@

$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("GoogleSetup"), $linkback, 'setup');
print '<br>';


if (! function_exists("openssl_open")) print '<div class="warning">Warning: PHP Module \'openssl\' is not installed</div><br>';
if (! class_exists('DOMDocument')) print '<div class="warning">Warning: PHP Module \'xml\' is not installed</div><br>';
if (! function_exists("openssl_open")) {
print '<br><div class="warning">Warning: PHP Module \'openssl\' is not installed</div><br>';
}
if (! class_exists('DOMDocument')) {
print '<br><div class="warning">Warning: PHP Module \'xml\' is not installed</div><br>';
}


print '<form name="googleconfig" action="'.$_SERVER["PHP_SELF"].'" method="POST" autocomplete="off" enctype="multipart/form-data">';
Expand Down Expand Up @@ -611,7 +613,7 @@ function initfields()

print '<div class="tabsActions synccal">';

print '<br><br><hr><br>';
print '<br><br><hr class="showifidagendaset"><br>';

print '<div class="synccal showifidagendaset">';
if (!getDolGlobalString('GOOGLE_DUPLICATE_INTO_GCAL') || !getDolGlobalString('GOOGLE_API_SERVICEACCOUNT_EMAIL') || !getDolGlobalString('GOOGLE_LOGIN')) {
Expand Down
29 changes: 12 additions & 17 deletions htdocs/google/admin/google_calsync_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,36 +383,29 @@

print '<br>';

$userlogin = $conf->global->GOOGLE_LOGIN;
$userlogin = getDolGlobalString('GOOGLE_LOGIN');

if (! empty($userlogin)) { // We use setup of user
print $langs->trans("GoogleSetupIsGlobal", $userlogin);
} else {
print_fiche_titre($langs->trans("AgendaSync"), '', '');

$var=true;
print "<table class=\"noborder\" width=\"100%\">";
print '<table class="noborder centpercent">';

print "<tr class=\"liste_titre\">";
print '<td width="25%">'.$langs->trans("Parameter").'</td>';
print '<td colspan="2">'.$langs->trans("Value").'</td>';
print '<td colspan="2"></td>';
print "</tr>";

// Activation synchronisation
/*
print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("GoogleEnableSyncToCalendar")."</td>";
print "<td>";
print $form->selectyesno("GOOGLE_DUPLICATE_INTO_GCAL",isset($_POST["GOOGLE_DUPLICATE_INTO_GCAL"])?$_POST["GOOGLE_DUPLICATE_INTO_GCAL"]:$object->conf->GOOGLE_DUPLICATE_INTO_GCAL,1);
print "</td>";
print "</tr>";
*/
// Google login
print '<tr class="oddeven">';
print '<td class="fieldrequired">'.$langs->trans("GoogleIDAgenda")."</td>";
print "<td>";
if (! empty($conf->global->GOOGLE_LOGIN)) print $conf->global->GOOGLE_LOGIN;
else print '<input class="flat" type="text" size="30" name="GOOGLE_LOGIN" value="'.$object->conf->GOOGLE_LOGIN.'">';
if (getDolGlobalString('GOOGLE_LOGIN')) {
print getDolGlobalString('GOOGLE_LOGIN');
} else {
print '<input class="flat" type="text" size="30" name="GOOGLE_LOGIN" value="'.$object->conf->GOOGLE_LOGIN.'">';
}
print "</td>";
print '<td>';
print $langs->trans("Example").": yourlogin@gmail.com, email@mydomain.com<br>";
Expand All @@ -434,7 +427,9 @@
print '<tr lass="oddeven">';
print '<td class="fieldrequired">'.$langs->trans("GOOGLE_API_SERVICEACCOUNT_P12KEY")."</td>";
print '<td>';
if (! empty($conf->global->GOOGLE_API_SERVICEACCOUNT_P12KEY)) print getDolGlobalString('GOOGLE_API_SERVICEACCOUNT_P12KEY') . '<br>';
if (getDolGlobalString('GOOGLE_API_SERVICEACCOUNT_P12KEY')) {
print getDolGlobalString('GOOGLE_API_SERVICEACCOUNT_P12KEY') . '<br>';
}
//print '<input type="file" name="GOOGLE_API_SERVICEACCOUNT_P12KEY_file">';
print '</td>';
print '<td>';
Expand Down Expand Up @@ -466,7 +461,7 @@

print info_admin($langs->trans("EnableAPI", "https://console.developers.google.com/apis/library/", "https://console.developers.google.com/apis/library/", "Calendar API"));

$htmltext = $langs->trans("ShareCalendarWithServiceAccount", $conf->global->GOOGLE_API_SERVICEACCOUNT_EMAIL, $langs->transnoentitiesnoconv("GoogleIDAgenda"));
$htmltext = $langs->trans("ShareCalendarWithServiceAccount", getDolGlobalString('GOOGLE_API_SERVICEACCOUNT_EMAIL'), $langs->transnoentitiesnoconv("GoogleIDAgenda"));
$htmltext .= '<br>';
$htmltext .= $langs->trans("ShareCalendarWithServiceAccount2");
print info_admin($htmltext, 0, 0, '1', 'showifidagendaset');
Expand Down
13 changes: 8 additions & 5 deletions htdocs/google/admin/google_contactsync.php
Original file line number Diff line number Diff line change
Expand Up @@ -744,11 +744,14 @@

$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("GoogleSetup"), $linkback, 'setup');
print '<br>';


if (! function_exists("openssl_open")) print '<div class="warning">Warning: PHP Module \'openssl\' is not installed</div><br>';
if (! class_exists('DOMDocument')) print '<div class="warning">Warning: PHP Module \'xml\' is not installed</div><br>';
if (! function_exists("openssl_open")) {
print '<br><div class="warning">Warning: PHP Module \'openssl\' is not installed</div><br>';
}
if (! class_exists('DOMDocument')) {
print '<br><div class="warning">Warning: PHP Module \'xml\' is not installed</div><br>';
}


print '<form name="googleconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">';
Expand Down Expand Up @@ -828,7 +831,7 @@ function initfields()

print '<tr class="liste_titre">';
print '<td class="titlefieldcreate">'.$langs->trans("Parameter")."</td>";
print "<td>".$langs->trans("Value")."</td>";
print "<td></td>";
print "</tr>";
// Label to use for thirdparties
if (isModEnabled('societe')) {
Expand Down Expand Up @@ -860,7 +863,7 @@ function initfields()
print "</table>";
print "</div>";

print '<div class="opacitymedium">'.$langs->trans("GoogleContactSyncInfo").'</div><br>';
print '<div class="opacitymedium small">'.$langs->trans("GoogleContactSyncInfo").'</div><br>';


print "<br>";
Expand Down
1 change: 0 additions & 1 deletion htdocs/google/admin/google_gmaps.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@

$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("GoogleSetup"), $linkback, 'setup');
print '<br>';


print '<form name="googleconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">';
Expand Down
4 changes: 1 addition & 3 deletions htdocs/google/admin/google_other.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
* Actions
*/



// None


/*
Expand All @@ -61,7 +60,6 @@

$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("GoogleSetup"), $linkback, 'setup');
print '<br>';


print '<form name="googleconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">';
Expand Down

0 comments on commit 482d18c

Please sign in to comment.